Geant4
10.03
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
G4MPIstatus.cc
Go to the documentation of this file.
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
27
28
#include "
G4ApplicationState.hh
"
29
#include "
G4MPIstatus.hh
"
30
31
// --------------------------------------------------------------------------
32
G4MPIstatus::G4MPIstatus
()
33
: rank_(0), run_id_(0), nevent_to_be_processed_(0), event_id_(0),
34
cputime_(0.), g4state_(
G4State_Quit
)
35
{
36
timer_
=
new
G4Timer
;
37
}
38
39
// --------------------------------------------------------------------------
40
G4MPIstatus::~G4MPIstatus
()
41
{
42
delete
timer_
;
43
}
44
45
// --------------------------------------------------------------------------
46
void
G4MPIstatus::StartTimer
()
47
{
48
timer_
-> Start();
49
}
50
51
// --------------------------------------------------------------------------
52
void
G4MPIstatus::StopTimer
()
53
{
54
timer_
-> Stop();
55
}
56
57
// --------------------------------------------------------------------------
58
void
G4MPIstatus::SetStatus
(
G4int
arank,
G4int
runid,
G4int
noe,
G4int
evtid,
59
G4ApplicationState
state)
60
{
61
rank_
= arank;
62
run_id_
= runid;
63
nevent_to_be_processed_
= noe;
64
event_id_
= evtid;
65
g4state_
= state;
66
if
(
timer_
-> IsValid() )
cputime_
=
timer_
-> GetRealElapsed();
67
else
cputime_
= 0.;
68
}
69
70
// --------------------------------------------------------------------------
71
void
G4MPIstatus::Pack
(
G4int
* data)
const
72
{
73
data[0] =
rank_
;
74
data[1] =
run_id_
;
75
data[2] =
nevent_to_be_processed_
;
76
data[3] =
event_id_
;
77
data[4] =
g4state_
;
78
79
G4double
* ddata = (
G4double
*)(data+5);
80
ddata[0] =
cputime_
;
81
}
82
83
// --------------------------------------------------------------------------
84
void
G4MPIstatus::UnPack
(
G4int
* data)
85
{
86
rank_
= data[0];
87
run_id_
= data[1];
88
nevent_to_be_processed_
= data[2];
89
event_id_
= data[3];
90
g4state_
= (
G4ApplicationState
)data[4];
91
92
G4double
* ddata = (
G4double
*)(data+5);
93
cputime_
= ddata[0];
94
}
95
96
// --------------------------------------------------------------------------
97
void
G4MPIstatus::Print
()
const
98
{
99
// * rank= 001 run= 10002 event= 00001 / 100000 state= Idle"
100
G4cout
<<
"* rank= "
<<
rank_
101
<<
" run= "
<<
run_id_
102
<<
" event= "
<<
event_id_
<<
" / "
<<
nevent_to_be_processed_
103
<<
" state= "
<<
GetStateString
(
g4state_
)
104
<<
" time= "
<<
cputime_
<<
"s"
105
<<
G4endl
;
106
}
107
108
// --------------------------------------------------------------------------
109
G4String
G4MPIstatus::GetStateString
(
G4ApplicationState
astate)
const
110
{
111
G4String
sname;
112
113
switch
(astate) {
114
case
G4State_PreInit
:
115
sname =
"PreInit"
;
116
break
;
117
case
G4State_Init
:
118
sname =
"Init"
;
119
break
;
120
case
G4State_Idle
:
121
sname =
"Idle"
;
122
break
;
123
case
G4State_GeomClosed
:
124
sname =
"GeomClosed"
;
125
break
;
126
case
G4State_EventProc
:
127
sname =
"EventProc"
;
128
break
;
129
case
G4State_Quit
:
130
sname =
"Quit"
;
131
break
;
132
case
G4State_Abort
:
133
sname =
"Abort"
;
134
break
;
135
default
:
136
sname =
"Unknown"
;
137
break
;
138
}
139
140
return
sname;
141
}
G4MPIstatus::StopTimer
void StopTimer()
Definition:
G4MPIstatus.cc:52
G4ApplicationState.hh
G4State_Init
Definition:
G4ApplicationState.hh:85
G4MPIstatus::SetStatus
void SetStatus(G4int arank, G4int runid, G4int noe, G4int evtid, G4ApplicationState state)
Definition:
G4MPIstatus.cc:58
G4MPIstatus::nevent_to_be_processed_
G4int nevent_to_be_processed_
Definition:
G4MPIstatus.hh:69
G4MPIstatus::UnPack
void UnPack(G4int *data)
Definition:
G4MPIstatus.cc:84
G4MPIstatus.hh
status of MPI application
G4State_EventProc
Definition:
G4ApplicationState.hh:86
G4MPIstatus::g4state_
G4ApplicationState g4state_
Definition:
G4MPIstatus.hh:72
G4State_Abort
Definition:
G4ApplicationState.hh:86
G4MPIstatus::GetStateString
G4String GetStateString(G4ApplicationState astate) const
Definition:
G4MPIstatus.cc:109
G4MPIstatus::G4MPIstatus
G4MPIstatus()
Definition:
G4MPIstatus.cc:32
G4int
int G4int
Definition:
G4Types.hh:78
G4MPIstatus::StartTimer
void StartTimer()
Definition:
G4MPIstatus.cc:46
G4MPIstatus::timer_
G4Timer * timer_
Definition:
G4MPIstatus.hh:73
G4MPIstatus::cputime_
G4double cputime_
Definition:
G4MPIstatus.hh:71
G4MPIstatus::run_id_
G4int run_id_
Definition:
G4MPIstatus.hh:68
G4cout
G4GLOB_DLL std::ostream G4cout
G4MPIstatus::~G4MPIstatus
~G4MPIstatus()
Definition:
G4MPIstatus.cc:40
G4MPIstatus::rank_
G4int rank_
Definition:
G4MPIstatus.hh:67
G4Timer
Definition:
G4Timer.hh:110
G4MPIstatus::event_id_
G4int event_id_
Definition:
G4MPIstatus.hh:70
G4State_GeomClosed
Definition:
G4ApplicationState.hh:85
G4State_Idle
Definition:
G4ApplicationState.hh:85
G4State_Quit
Definition:
G4ApplicationState.hh:86
G4MPIstatus::Print
void Print() const
Definition:
G4MPIstatus.cc:97
G4endl
#define G4endl
Definition:
G4ios.hh:61
G4double
double G4double
Definition:
G4Types.hh:76
G4State_PreInit
Definition:
G4ApplicationState.hh:85
G4MPIstatus::Pack
void Pack(G4int *data) const
Definition:
G4MPIstatus.cc:71
G4ApplicationState
G4ApplicationState
Definition:
G4ApplicationState.hh:84
G4String
Definition:
G4String.hh:45
geant4.10.03
examples
extended
parallel
MPI
source
src
G4MPIstatus.cc
Generated on Thu Feb 14 2002 02:27:56 for Geant4 by
1.8.8