LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
exMPI03.cc File Reference
#include "G4MPImanager.hh"
#include "G4MPIsession.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "FTFP_BERT.hh"
#include "G4ScoringManager.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 A MPI example code. More...
 

Function Documentation

int main ( int  argc,
char **  argv 
)

A MPI example code.

Definition at line 49 of file exMPI03.cc.

References Initialize(), and session.

50 {
51  // --------------------------------------------------------------------
52  // MPI session
53  // --------------------------------------------------------------------
54  // At first, G4MPImanager/G4MPIsession should be created.
55  G4MPImanager* g4MPI = new G4MPImanager(argc, argv);
56 
57  // MPI session (G4MPIsession) instead of G4UIterminal
58  // Terminal availability depends on your MPI implementation.
59  G4MPIsession* session = g4MPI-> GetMPIsession();
60 
61  // LAM/MPI users can use G4tcsh.
62  G4String prompt = "";
63  prompt += "G4MPI";
64  prompt += "(%s)[%/]:";
65  session-> SetPrompt(prompt);
66 
67  // --------------------------------------------------------------------
68  // user application setting
69  // --------------------------------------------------------------------
70 #ifdef G4MULTITHREADED
71  G4MTRunManager* runManager = new G4MTRunManager();
72  runManager-> SetNumberOfThreads(4);
73 #else
74  G4RunManager* runManager = new G4RunManager();
75 #endif
76 G4ScoringManager * scManager = G4ScoringManager::GetScoringManager();
77  scManager->SetVerboseLevel(1);
78  // setup your application
79  runManager-> SetUserInitialization(new DetectorConstruction);
80  runManager-> SetUserInitialization(new FTFP_BERT);
81  runManager-> SetUserInitialization(new ActionInitialization);
82 
83  runManager-> Initialize();
84 
85 #ifdef G4VIS_USE
86  G4VisExecutive* visManager = new G4VisExecutive;
87  visManager-> Initialize();
88  G4cout << G4endl;
89 #endif
90 
91  // --------------------------------------------------------------------
92  // ready for go
93  // MPIsession treats both interactive and batch modes.
94  // Just start your session as below.
95  // --------------------------------------------------------------------
96  session-> SessionStart();
97 
98  // --------------------------------------------------------------------
99  // termination
100  // --------------------------------------------------------------------
101 #ifdef G4VIS_USE
102  delete visManager;
103 #endif
104 
105  delete g4MPI;
106 
107  delete runManager;
108 
109  return EXIT_SUCCESS;
110 }
static G4UIterminal * session
void Initialize()
Definition: errprop.cc:101