This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Thread safety

Tags: None
(comma "," separated)
phorton
Registered Member
Posts
4
Karma
0
OS

Thread safety  Topic is solved

Fri Sep 17, 2010 7:29 am
Hi,

Thanks for your great work!

I'm not sure about one thing: Is Eigen thread-safe? I mean if I take care myself not to read and write on the same elements.

Can I use multiple threads to read elements in parallel in the same matrix ? And can I write elements in the same matrix if I take care to never edit the same element at the same time ?

I ask this as my code, that was stable, now crashes randomly after I introduced multi-threading, and I cannot find the reason for it now.

Thanks
User avatar
bjacob
Registered Member
Posts
658
Karma
3

Re: Thread safety

Fri Sep 17, 2010 8:00 am
phorton wrote:Hi,

Thanks for your great work!

I'm not sure about one thing: Is Eigen thread-safe? I mean if I take care myself not to read and write on the same elements.


Yes it is, in that sense.

Can I use multiple threads to read elements in parallel in the same matrix ?


Yes, just like reading from any plain buffer.

And can I write elements in the same matrix if I take care to never edit the same element at the same time ?


Yes, assuming you're not at the same time reading from a part you're overwriting in another thread, for the same reason, plain buffer.

I ask this as my code, that was stable, now crashes randomly after I introduced multi-threading, and I cannot find the reason for it now.

Thanks


I can't either :-)


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
phorton
Registered Member
Posts
4
Karma
0
OS

Re: Thread safety

Fri Sep 17, 2010 8:18 am
Thanks for this quick answer !


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]