IPPL (Independent Parallel Particle Layer)
IPPL
Loading...
Searching...
No Matches
Communicator.cpp
Go to the documentation of this file.
1
3
4namespace ippl {
5 namespace mpi {
6
8 : comm_m(new MPI_Comm(MPI_COMM_WORLD)) {
9 MPI_Comm_rank(*comm_m, &rank_m);
10 MPI_Comm_size(*comm_m, &size_m);
11 }
12
14 comm_m = std::make_shared<MPI_Comm>(comm);
15 MPI_Comm_rank(*comm_m, &rank_m);
16 MPI_Comm_size(*comm_m, &size_m);
17 }
18
20 comm_m = std::make_shared<MPI_Comm>(comm);
21 MPI_Comm_rank(*comm_m, &rank_m);
22 MPI_Comm_size(*comm_m, &size_m);
23 return *this;
24 }
25
26 Communicator Communicator::Communicator::split(int color, int key) const {
27 MPI_Comm newcomm;
28 MPI_Comm_split(*comm_m, color, key, &newcomm);
29 return Communicator(newcomm);
30 }
31
32 void Communicator::probe(int source, int tag, Status& status) {
33 MPI_Probe(source, tag, *comm_m, status);
34 }
35
36 bool Communicator::iprobe(int source, int tag, Status& status) {
37 int flag = 0;
38 MPI_Iprobe(source, tag, *comm_m, &flag, status);
39 return (flag != 0);
40 }
41 } // namespace mpi
42} // namespace ippl
Definition Archive.h:20
Communicator & operator=(MPI_Comm comm)
std::shared_ptr< MPI_Comm > comm_m
bool iprobe(int source, int tag, Status &status)
void probe(int source, int tag, Status &status)