Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4MPIToolsManager Class Reference

#include <G4MPIToolsManager.hh>

Public Member Functions

 G4MPIToolsManager (const G4AnalysisManagerState &state, tools::histo::hmpi *hmpi)
 
virtual ~G4MPIToolsManager ()
 
template<typename T >
G4bool Merge (const std::vector< T * > &htVector, const std::vector< G4HnInformation * > &hnVector)
 

Detailed Description

Definition at line 44 of file G4MPIToolsManager.hh.

Constructor & Destructor Documentation

G4MPIToolsManager::G4MPIToolsManager ( const G4AnalysisManagerState state,
tools::histo::hmpi *  hmpi 
)
inline

Definition at line 47 of file G4MPIToolsManager.hh.

49  : fState(state), fHmpi(hmpi) {}
virtual G4MPIToolsManager::~G4MPIToolsManager ( )
inlinevirtual

Definition at line 50 of file G4MPIToolsManager.hh.

50 {}

Member Function Documentation

template<typename T >
G4bool G4MPIToolsManager::Merge ( const std::vector< T * > &  htVector,
const std::vector< G4HnInformation * > &  hnVector 
)
inline

Definition at line 176 of file G4MPIToolsManager.hh.

178 {
179  if ( ! htVector.size() ) return true;
180 
181  // Get number of objects to be sent
182  G4int nofActiveT = 0;
183  if ( fState.GetIsActivation() ) {
184  // only activated histograms will be treated
185  for ( G4int i=0; i<G4int(htVector.size()); ++i ) {
186  auto activation = hnVector[i]->GetActivation();
187  if ( activation ) ++nofActiveT;
188  }
189  } else {
190  nofActiveT = G4int(htVector.size());
191  }
192 
193  if ( ! nofActiveT ) return true;
194 
195  G4int commRank;
196  if ( ! fHmpi->comm_rank(commRank) ) {
197  G4ExceptionDescription description;
198  description
199  << " Failed to get MPI commander rank." << G4endl
200  << " Merging will not be performed.";
201  G4Exception("G4H1ToolsManager::Merge",
202  "Analysis_W031", JustWarning, description);
203  return false;
204  }
205 
206  G4bool finalResult = true;
207 
208  if ( commRank != fHmpi->rank() ) {
209 
210 #ifdef G4VERBOSE
211  if ( fState.GetVerboseL3() ) {
212  G4ExceptionDescription description;
213  description << "on rank " << commRank
214  << " destination rank: " << fHmpi->rank();
215  fState.GetVerboseL4()->Message("mpi send", "Hn|Pn", description);
216  }
217 #endif
218 
219  auto result = Send(nofActiveT, htVector, hnVector);
220 
221  finalResult = result && finalResult;
222 
223 #ifdef G4VERBOSE
224  if ( fState.GetVerboseL1() ) {
225  G4ExceptionDescription description;
226  description << "on rank " << commRank
227  << " destination rank: " << fHmpi->rank();
228  fState.GetVerboseL1()->Message("send", "Hn|Pn", description);
229  }
230 #endif
231 
232  } else {
233 
234 #ifdef G4VERBOSE
235  if ( fState.GetVerboseL3() ) {
236  G4ExceptionDescription description;
237  description << "on rank " << commRank
238  << " destination rank: " << fHmpi->rank();
239  fState.GetVerboseL4()->Message("mpi wait_histos", "Hn|Pn", description);
240  }
241 #endif
242 
243  auto result = Receive(nofActiveT, htVector, hnVector);
244 
245  finalResult = result && finalResult;
246 
247 #ifdef G4VERBOSE
248  if ( fState.GetVerboseL1() ) {
249  G4ExceptionDescription description;
250  description << "on rank " << commRank
251  << " destination rank: " << fHmpi->rank();
252  fState.GetVerboseL1()->Message("mpi wait_histos", "Hn|Pn", description);
253  }
254 #endif
255  }
256  return finalResult;
257 }
G4double G4ParticleHPJENDLHEData::G4double result
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
int G4int
Definition: G4Types.hh:78
const G4AnalysisVerbose * GetVerboseL3() const
const G4AnalysisVerbose * GetVerboseL4() const
bool G4bool
Definition: G4Types.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
const G4AnalysisVerbose * GetVerboseL1() const

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: