Message: Re: Geant4 error propagation package in MT Frameworks Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Idea Re: Geant4 error propagation package in MT Frameworks 

Forum: Multithreading
Re: Question Geant4 error propagation package in MT Frameworks (Thomas Hauth)
Date: 18 Apr, 2014
From: Andrea Dotti <Andrea Dotti>

Dear Thomas,

Unfortunately given the manpower we have we had to set priorities and this module was not tested extensively for the final release. However the basic migration to MT was carried out, and in principle it is possible to test the module in a MT environment.

In particular, regarding the use of static data: you may notice that the additional keyword "G4ThreadLocal" is used in conjunction with static data in the class G4ErrorPropagationData. This is a #define to __thread (on linux) that implements thread-local-storage. That is each thread has its own (static) copy of the objects. This mean that the use of this class (at least at first order) should be thread-safe. Since the singleton itself if a "thread local" object, you can safely call concurencly GetErrorPropagatorData::GetErrorPropagatorData() instance getter.

Important: Note that G4ThreadLocal is defined only if G4MULTITHREADED is a defined compilation option (e.g. -DG4MULTITHREADED), if you use G4's cmake or makefile system that is already done for you, otherwise take care of adding this to the compilation options of your system. Take a look at file: geant4-source/source/global/management/include/tls.hh for more information.

Some information on Thread-safety in G4 is given in these presentations: Introduction: http://geant4.slac.stanford.edu/SLACTutorial14/MultiThreadingI.pdf Details: http://geant4.slac.stanford.edu/SLACTutorial14/MultiThreading2.pdf Much more info on memory management in G4 for MT: http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForToolkitDeveloper/html/ch02s14.html

Please let me know if you need more information. Andrea

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: Geant4 error propagation package in MT Frameworks   (Thomas Hauth - 24 Apr, 2014)
(_ Idea: Re: Geant4 error propagation package in MT Frameworks   (Andrea Dotti - 29 Apr, 2014)
 Add Message Add Message
to: "Re: Geant4 error propagation package in MT Frameworks"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews