Loading...
Searching...
No Matches
G4MPIhistoMerger.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// ********************************************************************
25//
26// Merge G4analysis histogram objects via MPI
27//
28// History:
29// Jun 27, 2015 : Ivana Hrivnacova - new implementation using g4analysis
30
31#include "G4MPIhistoMerger.hh"
32#include "G4MPImanager.hh"
33#include "G4ios.hh"
34#include "toolx/mpi/hmpi"
35#include <mpi.h>
36#include "G4VAnalysisManager.hh"
37
39manager(0),destination(G4MPImanager::kRANK_MASTER),
40verboseLevel(0) {}
41
43 G4int dest, G4int v) : manager(m), destination(dest),verboseLevel(v) {}
44
46{
47 if ( verboseLevel > 0 ) {
48 G4cout << "Starting merging of histograms" << G4endl;
49 }
50
51 const MPI::Intracomm* parentComm = G4MPImanager::GetManager()->GetComm();
52 MPI::Intracomm comm = parentComm->Dup();
53
54 G4bool verbose = ( verboseLevel > 1 );
55 G4int tag = G4MPImanager::kTAG_HISTO;
56 //const MPI::Intracomm* comm = &COMM_G4COMMAND_;
57 toolx::mpi::hmpi* hmpi
58 = new toolx::mpi::hmpi(G4cout, destination, tag, comm, verbose);
59 if ( ! manager->Merge(hmpi) ) {
60 G4cout<<" Merge FAILED"<<G4endl;
61 }
62
63 delete hmpi;
64
65 if ( verboseLevel > 0 ) {
66 G4cout << "End merging of histograms" << G4endl;
67 }
68 comm.Free();
69}
MPI manager class.
G4VAnalysisManager * manager
static G4MPImanager * GetManager()
const MPI::Intracomm * GetComm() const

Applications | User Support | Publications | Collaboration