29 #include "G4MPImanager.hh" 30 #include "G4MPIsession.hh" 31 #include "G4MPIextraWorker.hh" 33 #ifdef G4MULTITHREADED 34 #include "G4MTRunManager.hh" 36 #include "G4RunManager.hh" 39 #include "G4UImanager.hh" 40 #include "G4UserRunAction.hh" 41 #include "G4VisExecutive.hh" 43 #include "ActionInitialization.hh" 45 #include "RunActionMaster.hh" 46 #include "FTFP_BERT.hh" 47 #include "G4ScoringManager.hh" 50 int main(
int argc,
char** argv)
55 bool useNtuple =
true;
56 bool mergeNtuple =
true;
62 G4int nofExtraWorkers = 0;
63 #ifndef G4MULTITHREADED 64 if ( mergeNtuple ) nofExtraWorkers = 1;
66 G4MPImanager* g4MPI =
new G4MPImanager(argc, argv, nofExtraWorkers);
71 G4MPIsession*
session = g4MPI-> GetMPIsession();
76 prompt +=
"[40;31m(%s)[40;36m[%/][00;30m:";
77 session-> SetPrompt(prompt);
82 #ifdef G4MULTITHREADED 83 G4MTRunManager* runManager =
new G4MTRunManager();
84 runManager-> SetNumberOfThreads(4);
86 G4RunManager* runManager =
new G4RunManager();
88 G4ScoringManager * scManager = G4ScoringManager::GetScoringManager();
89 scManager->SetVerboseLevel(1);
92 runManager-> SetUserInitialization(
new FTFP_BERT);
93 runManager-> SetUserInitialization(
94 new ActionInitialization(useNtuple, mergeNtuple));
99 if ( g4MPI->IsExtraWorker() ) {
100 G4cout <<
"Set extra worker" << G4endl;
101 G4UserRunAction* runAction
102 =
const_cast<G4UserRunAction*
>(runManager->GetUserRunAction());
103 g4MPI->SetExtraWorker(
new G4MPIextraWorker(runAction));
106 G4VisExecutive* visManager =
new G4VisExecutive;
115 session-> SessionStart();
static G4UIterminal * session
int main(int argc, char **argv)
A MPI example code.