|Message: How to correctly (most efficiently) collect thread local data?||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)|
Hey Geant users,
I'm building a simulation that's basically a gamma source (662 keV) and a detector. The detector is a sensitive detector so I can gather hit information like the position of interaction, energy deposited, etc. The non-MT version, to the best of my knowledge, works fine and runs a million particles in a few minutes. When I MT on my desktop to 15 workers + 1 master (8 core hyperthreaded intel processor), I get a similar speed: 1 million particles in a few minutes. I would expect the speed to be 10x faster but it isn't.
So my question is, how do I collect the thread local hit data when I'm multithreading? Are there any examples I should look at?
I'm very new to Geant4 and fairly new to c++ so I lack a lot of knowledge. I used B5 as a guild to build my simulation.
I've tried two methods to collect the event specific hit data. The first was to directly append it to a file in EndOfEventAction (that is, all of the threads write to one file). This method worked but had similar performance and at the time I wasn't using any Mutex locks so I was concerned about data integrity. I thought maybe the writing was slowing Geant4, so then I built a DataCollector class that I construct in main() and pass through as a pointer to EndOfEventAction. DataCollector has a bunch of deques that hold all the data I want and at the end of main() I dump them all to a file. This time, I am using Mutex locks so only one thread is writing to the DataCollector at a time. Again, I saw no increase in speed. I am assuming this is because the Mutex locks are preventing the threads from working too fast.
The last idea I have is to run multiple non-MT Geant4 simulations with multiple output files and tie them together at the end.
|Inline Depth:||Outline Depth:||Add message:|