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

None Re: Geant4 error propagation package in MT Frameworks 

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

Dear Andrea,

thank you very much for your explanations and the pointers to the documentation. Following your suggestions, I did a first test:
I compiled Geant4 version 10.00.p01 in MT mode and adapted the erropropagation example coming with the release to use multiple threads. You can find the adapted example on my github page [1]. It can be compiled & run with:

git clone https://github.com/ThomasHauth/G4e-MT.git
cd G4e-MT
mkdir build/
cd build/
cmake -DGeant4_DIR=<path to G4 install> ..
make
./errprop

As C++11 threads are used, the c++11 standard must be enabled in the compile. Furthermore, you can set the number of used threads via ( in bash ):

export G4ERROR_THREAD_NUM=<N>

While the changed code works fine with N=1, going to more threads ( I tried N=6 ) results in either segfaults [3] and/or warnings that a region is defined multiple times [2]. 

If I add a lock around the Initialization part ( so only one thread is calling G4ErrorPropagatorManager::InitGeant4e at the same time ), the problem is that the particles are defined multiple times [4]. The std::lock_guard line is commented out in the errprop.c on github.

My understanding from looking at the G4 source is that both G4ParticleTable and G4Region are both not thread-local but shared among all. Is that correct? Furthermore, the G4ErrorPropagatorManager is using ( via G4ErrorRunManagerHelper ) the G4RunManagerKernel ( sequential ) and not the MT-enabled version. 

Do you think, the G4MTRunManagerKernel can be used here instead? And will it take care of the correct (one-time) initialization of G4Region & G4ParticleTable ?

Thanks,
Thomas

[1]
https://github.com/ThomasHauth/G4e-MT

[2]
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomMgt1001
      issued by : G4Region::G4Region()
The region has NOT been registered !
          Region DefaultRegionForParallelWorld already existing in store !

*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------

[3]
#0  0x00007ffff3587036 in G4Region::G4Region (this=0x7fffe4099b60, pName=...) at /build/hauth/dev/geant4.10.00.p01/source/geometry/management/src/G4Region.cc:74
#1  0x00007ffff5c60df3 in G4RunManagerKernel::G4RunManagerKernel (this=0x7fffe4000940) at /build/hauth/dev/geant4.10.00.p01/source/run/src/G4RunManagerKernel.cc:116
#2  0x00007ffff638cfb5 in G4ErrorRunManagerHelper::G4ErrorRunManagerHelper (this=0x7fffe4000910) at /build/hauth/dev/geant4.10.00.p01/source/error_propagation/src/G4ErrorRunManagerHelper.cc:69
#3  0x00007ffff638c205 in G4ErrorPropagatorManager::StartG4ErrorRunManagerHelper (this=0x7fffe40008c0) at /build/hauth/dev/geant4.10.00.p01/source/error_propagation/src/G4ErrorPropagatorManager.cc:126
#4  0x00007ffff638c280 in G4ErrorPropagatorManager::G4ErrorPropagatorManager (this=0x7fffe40008c0) at /build/hauth/dev/geant4.10.00.p01/source/error_propagation/src/G4ErrorPropagatorManager.cc:96
#5  0x00007ffff638c318 in G4ErrorPropagatorManager::GetErrorPropagatorManager () at /build/hauth/dev/geant4.10.00.p01/source/error_propagation/src/G4ErrorPropagatorManager.cc:72
#6  0x000000000040ed58 in Initialize() ()

[4]
-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : Run0002
      issued by : G4RunManagerKernel::G4RunManagerKernel()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 G4RunManagerKernel fatal exception
  -- Following particles have already been registered
     before G4RunManagerKernel is instantiated.
     e+
     e-
     gamma
     geantino
     mu+
     mu-
     pi+
     pi-
     proton
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

*** Fatal Exception *** core dump ***

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

1 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