Problem 2476

Summary: Different behavior of /random/resetEngineFrom in multithreaded mode and sequential mode
Product: Geant4 Reporter: kroehnke
Component: globalAssignee: Makoto.Asai
Status: ASSIGNED ---    
Severity: normal CC: Alberto.Ribon
Priority: P4    
Version: 11.0   
Hardware: PC   
OS: Linux   

Description kroehnke 2022-03-16 15:42:57 CET
Hi,
please have a look to this link:
https://geant4-forum.web.cern.ch/t/random-resetenginefrom-does-not-reproduce-same-engine-states/7383

In short, the results of multithreaded mode with only one thread differ to the results in sequential mode.
Executing a macro with these lines:

# run0
/run/beamOn 50
/random/saveThisRun
#
# run1
/run/beamOn 50
/random/saveThisRun
#
# run2 : restart run0
/random/resetEngineFrom run0.rndm
/run/beamOn 50
#
# run3 : restart run1
/random/resetEngineFrom run1.rndm
/run/beamOn 50


The result is in sequential mode as expected. run0 is equal to run2 and run1 is equal to run3.
But in multithreaded mode (with 1 thread) this in not the case. All four runX are different.


In the attached file "output.txt" in line 116 (see link to Geant4 forum above; third post) you can see a change of the random engine state after G4TaskRunManager::CreateAndStartWorkers().
I think there the differences arise.

Best regards
Henning