Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
exMPI02.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"
Include dependency graph for exMPI02.cc:

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 exMPI02.cc.

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_DISABLE //ROOT ISSUES WITH MT, SEE exMPI03 FOR A MT
71  G4MTRunManager* runManager = new G4MTRunManager();
72  runManager-> SetNumberOfThreads(4);
73 #else
74  G4RunManager* runManager = new G4RunManager();
75 #endif
76 
77  // setup your application
78  runManager-> SetUserInitialization(new DetectorConstruction);
79  runManager-> SetUserInitialization(new FTFP_BERT);
80  runManager-> SetUserInitialization(new ActionInitialization);
81 
82  runManager-> Initialize();
83 
84 #ifdef G4VIS_USE
85  G4VisExecutive* visManager = new G4VisExecutive;
86  visManager-> Initialize();
87  G4cout << G4endl;
88 #endif
89 
90  // --------------------------------------------------------------------
91  // ready for go
92  // MPIsession treats both interactive and batch modes.
93  // Just start your session as below.
94  // --------------------------------------------------------------------
95  session-> SessionStart();
96 
97  // --------------------------------------------------------------------
98  // termination
99  // --------------------------------------------------------------------
100 #ifdef G4VIS_USE
101  delete visManager;
102 #endif
103 
104  delete g4MPI;
105 
106  delete runManager;
107 
108  return EXIT_SUCCESS;
109 }
void Initialize()
Definition: errprop.cc:101
G4GLOB_DLL std::ostream G4cout
static G4UIterminal * session
Detector construction class to define materials and geometry.
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function: