|Message: Re: G4-MT and ROOT||Not Logged In (login)|
Click on the Forum title, e.g. on the "Forums by Category" page, to read a sequence of postings to the Forum and its threads all in one page. If you are only interested in one thread or the thread following a specific posting, click the thread or the posting, which takes you to a smaller page, which contains only the part you are interested in and may be easier to navigate.
Messages are "chained" if there are only replies at the first level, i.e. 1/1.html, 1/1/1.html etc. In case of "chained" messages the message number is replaced by the icon and there is no indentation.
Inline: Display the subject line only or also the text of the posting(s); for the choice "All" the "Outline" choices are switched off.
|1||0||1||no text / full text of posting|
|2||1||All||text for level 1 only / text for All postings|
Outline: Choose the depth of the posting thread, successive toggle controls provide increasing detail.
|1||2||1||2 levels / 1 level (original posting)|
|2||3||2||3 levels / 2 levels|
|3||3||All||3 levels / all levels (all postings)|
I've some experience with G4MT & ROOT since I'm porting an application we use to perform G4 validation to the MT version. I can give here my notes and experience. Please consider these are not yet final.
I am having too all kind of crashes with ROOT and MT applications. To better understand the issues I've created a stand-alone MT application that is NOT using G4 at all, but spawns threads. Each thread opens a ROOT file, books an histogram and a TTree. Then fills the two and it closes the file. I get crashes in this application for more than one thread. Thus I can say that there are pieces of code in ROOT that seems not thread safe. If needed I can send you this code so you can test yourself the ROOT classes you need in a MT application.
In particular in my test I've noticed that the following operations are not thread safe: 1- Using a constructor of TH* and TTree objects (this mean objects created on the stack or on the heap are both non-thread safe) 2- TTree::Fill seems to be non thread-safe if the tree contains branches of type "std::vector", in my test if it contains only simple data (bools/doubles/etc) I could run smoothly without crashes. I did not have problems with TH*::Fill 3- Destructors. This implies that also operations like TFile::Close are not thread-safe
For me the problem was solved using a mutex for the non thread-safe parts of the code to make the thread work sequentially. My solution is the same used in ROOT tutorials on the subject: http://root.cern.ch/root/html/tutorials/thread/threadsh1.C.html
If you are starting your project from scratch, I suggest you to take a look at the relatively new g4tools package that gives tuple and histogramming facility with ROOT writers (example basic B4 available from 9.5 on how to use it).
Hope this helps, Andrea
|Inline Depth:||Outline Depth:||Add message:|