← Back to team overview

yade-dev team mailing list archive

Re: Energy tracing vs. multithread?

 

> I don't get the relation with "reset" behaviour. The problem is not to 
> load the value, but to save it. I see no way to synchronize the 
> registered Real with the different threads values. I'm thinking a 
> virtual member void Functor::sync() could be the solution, it could be 
> called after the parallel sections in the dispatcher. It would 
> synchronize things once per step. Other than that, I don't see any 
> solution. Perhaps I'll just let energy be a temporary variable, always 0 
> in loaded scenes, and let users store it with python if they need.

The accumulator has conversion to T defined (operator T()), so if you
have 

  OpenMPAccumulator<Real,...> foo;

then

	Real bar=foo;

will get the value (or Real bar=(Real)foo if you want to make it more
"readable").

Does that solve your problem? 

v




Follow ups

References