Problem 1653 - MPI not Distributing Different Random Number Seeds to Each Rank
Summary: MPI not Distributing Different Random Number Seeds to Each Rank
Status: RESOLVED FIXED
Alias: None
Product: Examples/Extended
Classification: Unclassified
Component: paralle/MPI (show other problems)
Version: 10.0
Hardware: PC Linux
: P5 major
Assignee: Andrea Dotti
URL:
Depends on:
Blocks:
 
Reported: 2014-07-07 22:21 CEST by Matthew Lund
Modified: 2014-10-04 02:33 CEST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Matthew Lund 2014-07-07 22:21:56 CEST
After building an application based on examples and testing on Cluster of computers using Redhat Linux Enterprise 6, G4MPI is not using different random number seeds from MPI on beamOn for each node. For both exMPI01 and exMPI02, when using the command /run/printProgress ... the exact same random number appears for both ranks every time. When running exMPI02, slightly different results occur just because of the randomized medical beam, not because of different number seeds. In my application using GPS beam source, GEANT4 is using the exact same random number for all nodes even thou /mpi/showSeeds gives different random number seeds for each rank, and the results from each rank are exactly the same. I have tried setting seeds manually with the exact same results for all nodes.
Comment 1 asai 2014-07-19 18:14:25 CEST
Thank you for reporting this.
In the latest releases of 10.0 through 10.0-p02, we identified a bug in manually setting random number seeds in multithreaded application. Your issue seems to be caused by this same bug. We will verify it and update you.
Comment 2 Andrea Dotti 2014-07-21 18:57:40 CEST
Hello Matthew,
thank you for reporting this.
I am sorry about this problem. However I need some more information before proposing a fix. In particular: 

1- which version of Geant4 are you using exactly?

2- have you compiled Geant4 in multi-threading mode or sequential mode (it can be seen from the Geant4 banner of G4 when you start an application. It should read (version number/date is different, but please note the "<< in Multi-threaded mode >>" line
*************************************************************
 Geant4 version Name: geant4-10-00-ref-07 [MT]   (31-July-2014)
  << in Multi-threaded mode >> 
                      Copyright : Geant4 Collaboration
                      Reference : NIM A 506 (2003), 250-303
                            WWW : http://cern.ch/geant4
*************************************************************

3- Finally do you use a UI command to set the random-seed? Or, more in general, how do you set the random seed?

Thank you for your help and your patience,
   Andrea
Comment 3 Andrea Dotti 2014-07-22 00:06:44 CEST
Possible solution being tested in tag.
Note this pug affects only 10.1.beta and not 10.0 series
Comment 4 Andrea Dotti 2014-07-22 00:08:45 CEST
Sorry my previous comment is wrong: bug is also present in 10.0 series. Thus the fix will go into a possible 10.0 patch
Comment 5 Matthew Lund 2014-08-14 05:00:08 CEST
MPI Libraries set the seed in G4MPImanager.cc. There are two errors in the current file

Line 290 reads 
CLHEP::HepRandom::setTheSeed(seed_list[rank_]);

should be
  G4Random::setTheSeed(seed_list[rank_]);

Line 301 read
           << " seed= " << CLHEP::HepRandom::getTheSeed()

should be
           << " seed= " << G4Random::getTheSeed()

I'm applying the fix listed in 1657 G4RunMessenger.cc to see if it fixes the setting random number.
Comment 6 Andrea Dotti 2014-10-04 02:33:25 CEST
Solved in MPI-V10-00-02. Will be included in revised MPI in 10.1