#include <G4MPImanager.hh>
Definition at line 45 of file G4MPImanager.hh.
◆ anonymous enum
◆ anonymous enum
Enumerator |
---|
kTAG_G4COMMAND | |
kTAG_G4STATUS | |
kTAG_G4SEED | |
kTAG_DATA | |
kTAG_HISTO | |
kTAG_RUN | |
kTAG_CMDSCR | |
Definition at line 50 of file G4MPImanager.hh.
◆ G4MPImanager() [1/2]
G4MPImanager::G4MPImanager |
( |
| ) |
|
Definition at line 68 of file G4MPImanager.cc.
73 MPI::Init_thread(MPI::THREAD_SERIALIZED);
◆ G4MPImanager() [2/2]
G4MPImanager::G4MPImanager |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 78 of file G4MPImanager.cc.
83 MPI::Init_thread(argc, argv, MPI::THREAD_SERIALIZED);
void ParseArguments(G4int argc, char **argv)
◆ ~G4MPImanager()
G4MPImanager::~G4MPImanager |
( |
| ) |
|
Definition at line 89 of file G4MPImanager.cc.
G4MPImessenger * messenger_
MPI::Intracomm COMM_G4COMMAND_
◆ BcastCommand()
Definition at line 416 of file G4MPImanager.cc.
418 enum { kBUFF_SIZE = 512 };
419 static char sbuff[kBUFF_SIZE];
420 command.copy(sbuff, kBUFF_SIZE);
421 G4int len = command.size();
431 for (
G4int islave = 1; islave <
size_; islave++ ) {
437 MPI::Request request=
COMM_G4COMMAND_.Irecv(sbuff, kBUFF_SIZE, MPI::CHAR,
440 while(! request.Test()) {
MPI::Intracomm COMM_G4COMMAND_
◆ BeamOn()
void G4MPImanager::BeamOn |
( |
G4int |
nevent, |
|
|
G4bool |
qdivide = true |
|
) |
| |
Definition at line 460 of file G4MPImanager.cc.
462 #ifndef G4MULTITHREADED 472 G4cout <<
"#events in master=" << nproc0 <<
" / " 473 <<
"#events in slave=" << nproc <<
G4endl;
478 #ifdef G4MULTITHREADED 483 UI-> ApplyCommand(
"/run/beamOn " + str_nevt);
486 else runManager->
BeamOn(nproc);
498 #ifdef G4MULTITHREADED 501 UI-> ApplyCommand(
"/run/beamOn " + str_nevt);
static G4String ConvertToString(G4bool boolVal)
static G4UImanager * GetUIpointer()
G4GLOB_DLL std::ostream G4cout
static G4RunManager * GetRunManager()
void BeamOn(G4int nevent, G4bool qdivide=true)
◆ CheckThreadStatus()
G4bool G4MPImanager::CheckThreadStatus |
( |
| ) |
|
Definition at line 325 of file G4MPImanager.cc.
328 unsigned qstatus = 0;
333 for (
G4int islave = 1; islave <
size_; islave++ ) {
336 while( ! request.Test() ) {
351 if ( qstatus != 0 )
return true;
MPI::Intracomm COMM_G4COMMAND_
◆ DISALLOW_COPY_AND_ASSIGN()
◆ DistributeSeeds()
void G4MPImanager::DistributeSeeds |
( |
| ) |
|
Definition at line 287 of file G4MPImanager.cc.
290 G4Random::setTheSeed(seed_list[
rank_]);
G4VMPIseedGenerator * seed_generator_
◆ ExecuteBeamOnThread()
void G4MPImanager::ExecuteBeamOnThread |
( |
const G4String & |
command | ) |
|
Definition at line 385 of file G4MPImanager.cc.
391 G4cout <<
"G4MPIsession:: beamOn is still running." <<
G4endl;
397 (
Func_t)thread_ExecuteThreadCommand,
402 "Failed to create a beamOn thread.");
G4GLOB_DLL std::ostream G4cout
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4bool CheckThreadStatus()
◆ ExecuteMacroFile()
void G4MPImanager::ExecuteMacroFile |
( |
const G4String & |
fname, |
|
|
G4bool |
qbatch = false |
|
) |
| |
◆ ExecuteThreadCommand()
void G4MPImanager::ExecuteThreadCommand |
( |
const G4String & |
command | ) |
|
Definition at line 356 of file G4MPImanager.cc.
360 G4int rc = UI-> ApplyCommand(command);
362 G4int commandStatus = rc - (rc%100);
364 switch( commandStatus ) {
368 G4cerr <<
"illegal application state -- command refused" <<
G4endl;
371 G4cerr <<
"command refused (" << commandStatus <<
")" <<
G4endl;
static G4UImanager * GetUIpointer()
G4GLOB_DLL std::ostream G4cerr
◆ GetInitFileName()
const G4String & G4MPImanager::GetInitFileName |
( |
| ) |
const |
|
inline |
◆ GetMacroFileName()
const G4String & G4MPImanager::GetMacroFileName |
( |
| ) |
const |
|
inline |
◆ GetManager()
Definition at line 103 of file G4MPImanager.cc.
106 G4Exception(
"G4MPImanager::GetManager()",
"MPI001",
static G4MPImanager * g4mpi_
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
◆ GetMasterWeight()
G4double G4MPImanager::GetMasterWeight |
( |
| ) |
const |
|
inline |
◆ GetMPIsession()
◆ GetRank()
G4int G4MPImanager::GetRank |
( |
| ) |
const |
|
inline |
◆ GetSeedGenerator()
◆ GetSize()
G4int G4MPImanager::GetSize |
( |
| ) |
const |
|
inline |
◆ GetVerbose()
G4int G4MPImanager::GetVerbose |
( |
| ) |
const |
|
inline |
◆ Initialize()
void G4MPImanager::Initialize |
( |
| ) |
|
|
private |
Definition at line 113 of file G4MPImanager.cc.
116 G4Exception(
"G4MPImanager::Initialize()",
"MPI002",
123 size_ = MPI::COMM_WORLD.Get_size();
124 rank_ = MPI::COMM_WORLD.Get_rank();
G4MPImessenger * messenger_
static G4MPImanager * g4mpi_
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4VMPIseedGenerator * seed_generator_
MPI::Intracomm COMM_G4COMMAND_
◆ IsBatchMode()
G4bool G4MPImanager::IsBatchMode |
( |
| ) |
const |
|
inline |
◆ IsInitMacro()
G4bool G4MPImanager::IsInitMacro |
( |
| ) |
const |
|
inline |
◆ IsMaster()
G4bool G4MPImanager::IsMaster |
( |
| ) |
const |
|
inline |
◆ IsSlave()
G4bool G4MPImanager::IsSlave |
( |
| ) |
const |
|
inline |
◆ JoinBeamOnThread()
void G4MPImanager::JoinBeamOnThread |
( |
| ) |
|
◆ ParseArguments()
void G4MPImanager::ParseArguments |
( |
G4int |
argc, |
|
|
char ** |
argv |
|
) |
| |
|
private |
Definition at line 143 of file G4MPImanager.cc.
150 G4int option_index = 0;
151 static struct option long_options[] = {
152 {
"help", no_argument, NULL,
'h'},
153 {
"verbose", no_argument, NULL,
'v'},
154 {
"init", required_argument, NULL,
'i'},
155 {
"ofile", optional_argument, NULL,
'o'},
160 c = getopt_long(argc, argv,
"hvi:o", long_options, &option_index);
182 std::exit(EXIT_FAILURE);
191 std::exit(EXIT_SUCCESS);
198 sprintf(str, prefix.c_str(),
rank_);
G4String macro_file_name_
G4GLOB_DLL std::ostream G4cerr
◆ Print()
void G4MPImanager::Print |
( |
const G4String & |
message | ) |
|
Definition at line 532 of file G4MPImanager.cc.
535 std::cout << message << std::flush;
538 fscout_ << message << std::flush;
540 std::cout <<
rank_ <<
":" << message << std::flush;
◆ SetMasterWeight()
void G4MPImanager::SetMasterWeight |
( |
G4double |
aweight | ) |
|
|
inline |
◆ SetSeed()
void G4MPImanager::SetSeed |
( |
G4int |
inode, |
|
|
G4long |
seed |
|
) |
| |
Definition at line 317 of file G4MPImanager.cc.
319 if(
rank_ == inode ) {
static void setTheSeed(long seed, int lux=3)
◆ SetVerbose()
void G4MPImanager::SetVerbose |
( |
G4int |
iverbose | ) |
|
|
inline |
Definition at line 167 of file G4MPImanager.hh.
170 if( iverbose > 1 ) lv = 1;
171 if( iverbose < 0 ) lv = 0;
◆ ShowHelp()
void G4MPImanager::ShowHelp |
( |
| ) |
const |
Definition at line 546 of file G4MPImanager.cc.
552 G4cout <<
"<app> [options] [macro file]" 554 G4cout <<
" -h, --help show this message." 556 G4cout <<
" -v, --verbose show verbose message" 558 G4cout <<
" -i, --init=FNAME set an init macro file" 560 G4cout <<
" -o, --ofile[=FNAME] set slave output to a flie" G4GLOB_DLL std::ostream G4cout
◆ ShowSeeds()
void G4MPImanager::ShowSeeds |
( |
| ) |
|
Definition at line 294 of file G4MPImanager.cc.
301 <<
" seed= " << G4Random::getTheSeed()
304 for (
G4int islave = 1; islave <
size_; islave++ ) {
306 G4cout <<
"* rank= " << islave
311 buff = G4Random::getTheSeed();
G4GLOB_DLL std::ostream G4cout
MPI::Intracomm COMM_G4COMMAND_
◆ ShowStatus()
void G4MPImanager::ShowStatus |
( |
| ) |
|
Definition at line 238 of file G4MPImanager.cc.
253 for (
G4int islave = 1; islave <
size_; islave++ ) {
261 nevtp +=
status_-> GetNEventToBeProcessed();
262 cputime +=
status_-> GetCPUTime();
272 G4cout <<
"-------------------------------------------------------" 274 <<
"* #ranks= " << size_
275 <<
" event= " << nev <<
"/" << nevtp
276 <<
" state= " << strStatus
277 <<
" time= " << cputime <<
"s"
G4GLOB_DLL std::ostream G4cout
void Print(const G4String &message)
G4bool CheckThreadStatus()
MPI::Intracomm COMM_G4COMMAND_
◆ UpdateStatus()
void G4MPImanager::UpdateStatus |
( |
| ) |
|
|
private |
Definition at line 211 of file G4MPImanager.cc.
214 const G4Run* run = runManager-> GetCurrentRun();
216 G4int runid, eventid, neventTBP;
222 runid = run-> GetRunID();
223 neventTBP = run -> GetNumberOfEventToBeProcessed();
224 eventid = run-> GetNumberOfEvent();
234 status_-> SetStatus(
rank_, runid, neventTBP, eventid, g4state);
static G4StateManager * GetStateManager()
static G4RunManager * GetRunManager()
◆ WaitBeamOn()
void G4MPImanager::WaitBeamOn |
( |
| ) |
|
Definition at line 511 of file G4MPImanager.cc.
517 for (
G4int islave = 1; islave <
size_; islave++) {
520 while(! request.Test()) {
MPI::Intracomm COMM_G4COMMAND_
◆ COMM_G4COMMAND_
MPI::Intracomm G4MPImanager::COMM_G4COMMAND_ |
|
private |
◆ fscout_
std::ofstream G4MPImanager::fscout_ |
|
private |
◆ g4mpi_
◆ init_file_name_
◆ is_master_
G4bool G4MPImanager::is_master_ |
|
private |
◆ is_slave_
G4bool G4MPImanager::is_slave_ |
|
private |
◆ macro_file_name_
◆ master_weight_
◆ messenger_
◆ qbatchmode_
G4bool G4MPImanager::qbatchmode_ |
|
private |
◆ qfcout_
◆ qinitmacro_
G4bool G4MPImanager::qinitmacro_ |
|
private |
◆ rank_
G4int G4MPImanager::rank_ |
|
private |
◆ seed_generator_
◆ session_
◆ size_
G4int G4MPImanager::size_ |
|
private |
◆ status_
◆ thread_id_
pthread_t G4MPImanager::thread_id_ |
|
private |
◆ verbose_
G4int G4MPImanager::verbose_ |
|
private |
The documentation for this class was generated from the following files: