LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
exMPI03.cc File Reference
#include "G4MPImanager.hh"
#include "G4MPIsession.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4VisExecutive.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 46 of file exMPI03.cc.

References Initialize(), and session.

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