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1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/README.HowToRunMT (Version 11.3.0) and /examples/README.HowToRunMT (Version 10.6.p1)


  1 ----------------------------------------------      1 -------------------------------------------------------------------
  2                                                     2 
  3      =========================================      3      =========================================================
  4      Geant4 - an Object-Oriented Toolkit for S      4      Geant4 - an Object-Oriented Toolkit for Simulation in HEP
  5      =========================================      5      =========================================================
  6                                                     6 
  7         Tips how to run an example in multi-th      7         Tips how to run an example in multi-threading mode
  8         --------------------------------------      8         --------------------------------------------------
  9                                                     9 
 10  Only migrated examples or user applications c     10  Only migrated examples or user applications can be run in multi-threading (MT) mode. 
 11  The instructions for migrating user applicati     11  The instructions for migrating user applications can be found in Geant4 documentation guides 
 12  and a short howto is available here:              12  and a short howto is available here:
 13                                                    13  
 14  https://twiki.cern.ch/twiki/bin/view/Geant4/Q     14  https://twiki.cern.ch/twiki/bin/view/Geant4/QuickMigrationGuideForGeant4V10 
 15                                                    15 
 16  In this file, we give just useful tips for ru     16  In this file, we give just useful tips for running already migrated examples
 17  (or user applications).                           17  (or user applications).
 18                                                    18 
 19  1) RUN EXAMPLE IN MULTI-THREADING MODE            19  1) RUN EXAMPLE IN MULTI-THREADING MODE
 20                                                    20 
 21  No special steps are needed to build an examp <<  21  No special steps are needed to build an example in multi-threading mode.
 22  The examples which has been migrated to multi     22  The examples which has been migrated to multi-threading will automatically 
 23  run in MT when they are built against the Gea     23  run in MT when they are built against the Geant4 libraries built with MT mode
 24  activated, otherwise they will run in sequent     24  activated, otherwise they will run in sequential mode.
 25  Not migrated examples will run in sequential      25  Not migrated examples will run in sequential mode even when built against
 26  Geant4 libraries built with MT mode activated     26  Geant4 libraries built with MT mode activated.
 27                                                    27 
 28  The examples which do NOT support MT can be e <<  28  The examples which support MT can be easily recognized by the following lines
 29  of code in main ():                               29  of code in main ():
 30                                                    30 
                                                   >>  31  #ifdef G4MULTITHREADED
                                                   >>  32    G4MTRunManager* runManager = new G4MTRunManager;
                                                   >>  33  #else
 31    G4RunManager* runManager = new G4RunManager     34    G4RunManager* runManager = new G4RunManager;
                                                   >>  35  #endif
 32                                                    36 
 33 or                                             <<  37  The compiler flag -DG4MULTITHREADED is automatically set when building applications
 34                                                <<  38  using Geant4's CMake (via GEANT4_USE_FILE) and GNUmake systems, and is listed in 
 35    auto* runManager = G4RunManagerFactory::Cre <<  39  the flags reported by the --cflags option of the geant4-config program.
 36                                                    40 
 37  2) SET NUMBER OF THREADS                          41  2) SET NUMBER OF THREADS
 38                                                    42 
 39  When the number of threads is not selected in     43  When the number of threads is not selected in the application, the default number
 40  (which is actually 2) will be used. Another n     44  (which is actually 2) will be used. Another number of threads can be set in several
 41  ways:                                             45  ways:
 42                                                    46 
 43  - in the code                                     47  - in the code
 44                                                    48 
 45    auto* runManager = ...;                     <<  49    #ifdef G4MULTITHREADED
 46    runManager->SetNumberOfThreads(4);          <<  50      G4MTRunManager* runManager = new G4MTRunManager;
                                                   >>  51      runManager->SetNumberOfThreads(4);
                                                   >>  52    #else
                                                   >>  53      ...
 47                                                    54 
 48  - in a macro file via UI command added just b     55  - in a macro file via UI command added just before /run/initialize
 49                                                    56 
 50    /run/numberOfThreads 4                          57    /run/numberOfThreads 4
 51                                                    58 
 52  - by setting the environment variable             59  - by setting the environment variable 
 53                                                    60   
 54    export G4FORCENUMBEROFTHREADS = 4               61    export G4FORCENUMBEROFTHREADS = 4  
 55    or                                              62    or
 56    setenv G4FORCENUMBEROFTHREADS 4                 63    setenv G4FORCENUMBEROFTHREADS 4
 57                                                    64 
 58  The environment variable value is forced and      65  The environment variable value is forced and it cannot be changed from a code 
 59  call or a macro. A warning is issued in such      66  call or a macro. A warning is issued in such situation.
 60                                                    67 
 61  3) OUTPUT FROM THREADS                            68  3) OUTPUT FROM THREADS
 62                                                    69 
 63  In MT processing each worker produces its out     70  In MT processing each worker produces its output and these messages are interlayed
 64  on the screen. The messeges from threads are      71  on the screen. The messeges from threads are preceded with a predefined string 
 65  G4WTi> where i is the thread number.  Users c     72  G4WTi> where i is the thread number.  Users can change this default behaviour 
 66  and choose                                        73  and choose
 67                                                    74 
                                                   >>  75  - to buffer the output from each thread at a time, so that the output of each 
                                                   >>  76    thread is grouped and printed at the end of the job
                                                   >>  77 
                                                   >>  78    /control/cout/useBuffer true|false
                                                   >>  79 
 68  - to limit the output from threads to one sel     80  - to limit the output from threads to one selected thread only: 
 69                                                    81 
 70   /control/cout/ignoreThreadsExcept 0              82   /control/cout/ignoreThreadsExcept 0
 71                                                    83 
 72  - to redirect the output from threads in a fi     84  - to redirect the output from threads in a file:
 73                                                    85 
 74    /control/cout/setCoutFile coutFileName          86    /control/cout/setCoutFile coutFileName
 75    /control/cout/setCerrFile cerrFileName          87    /control/cout/setCerrFile cerrFileName
 76                                                << 
 77  - to buffer the output from each thread at a  << 
 78    thread is grouped and printed at the end of << 
 79                                                << 
 80    /control/cout/useBuffer true|false          <<