yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #04125
Re: Energy tracing vs. multithread?
Thank you, I'll look at this template.
I realize using the FOREACH macro by default everytime we have a loop is
perhaps not a good idea. What about this loop in GSTimeStepper, with
stiffnesses a class member?
FOREACH(const shared_ptr<Interaction>& contact, *rb->interactions){
[...]
stiffnesses [contact->getId1()]+=diag_stiffness;
stiffnesses [contact->getId2()]+=diag_stiffness;
Bruno
Václav Šmilauer a écrit :
What will happen if two threads increment the value at the same time?
Pretty much random things (garbage, not incremented, etc), depending on
atomicity of reads/writes. There is OpenMPAcuumulator template for this
purpose, used e.g. for unbalanced force callback.
Cheers, v.
_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~yade-dev
More help : https://help.launchpad.net/ListHelp
--
_______________
Bruno Chareyre
Associate Professor
Grenoble INP
Lab. 3SR
BP 53 - 38041, Grenoble cedex 9 - France
Tél : 33 4 56 52 86 21
Fax : 33 4 76 82 70 43
________________
Follow ups
References