124 DMSG(0,
"G4MPIscorerMerger::Merge called");
125 const unsigned int myrank = MPI::COMM_WORLD.Get_rank();
126 commSize = MPI::COMM_WORLD.Get_size();
127 if ( commSize == 1 ) {
128 DMSG(1,
"Comm world size is 1, nothing to do");
131 comm = MPI::COMM_WORLD.Dup();
150 const G4double sttime = MPI::Wtime();
153 typedef std::function<void(unsigned int)> handler_t;
154 using std::placeholders::_1;
157 std::function<void(void)> barrier = std::bind(&MPI::Intracomm::Barrier,&comm);
158 G4mpi::Merge( sender , receiver , barrier , commSize , myrank );
176 const G4double elapsed = MPI::Wtime() - sttime;
178 comm.Reduce(&bytesSent,&total,1,MPI::LONG,MPI::SUM,destinationRank);
179 if ( verbose > 0 && myrank == destinationRank ) {
181 G4cout<<
"G4MPIscorerMerger::Merge() -data transfer performances: "
182 <<double(total)/1000./elapsed<<
" kB/s"
183 <<
" (Total Data Transfer= "<<double(total)/1000.<<
" kB in "
184 <<elapsed<<
" s)."<<
G4endl;
201 DMSG(0,
"G4MPIscorerMerger::Merge done.");
void Merge(std::function< void(unsigned int)> senderF, std::function< void(unsigned int)> receiverF, std::function< void(void)> barrierF, unsigned int commSize, unsigned int myrank)
void Send(const unsigned int destination)
void Receive(const unsigned int source)
G4GLOB_DLL std::ostream G4cout
G4double total(Particle const *const p1, Particle const *const p2)