IPPL (Independent Parallel Particle Layer)
IPPL
Loading...
Searching...
No Matches
Communicator.cpp
Go to the documentation of this file.
1
2
#include "
Communicate/Communicator.h
"
3
4
namespace
ippl
{
5
namespace
mpi
{
6
7
Communicator::Communicator
()
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
13
Communicator::Communicator
(MPI_Comm comm) {
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
19
Communicator
&
Communicator::operator=
(MPI_Comm comm) {
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
Communicator.h
ippl
Definition
Archive.h:20
ippl::mpi
Definition
Buffers.cpp:28
ippl::mpi::tag
Definition
Tags.h:10
ippl::mpi::Communicator
Definition
Communicator.h:31
ippl::mpi::Communicator::rank_m
int rank_m
Definition
Communicator.h:213
ippl::mpi::Communicator::Communicator
Communicator()
Definition
Communicator.cpp:7
ippl::mpi::Communicator::operator=
Communicator & operator=(MPI_Comm comm)
Definition
Communicator.cpp:19
ippl::mpi::Communicator::comm_m
std::shared_ptr< MPI_Comm > comm_m
Definition
Communicator.h:211
ippl::mpi::Communicator::iprobe
bool iprobe(int source, int tag, Status &status)
Definition
Communicator.cpp:36
ippl::mpi::Communicator::probe
void probe(int source, int tag, Status &status)
Definition
Communicator.cpp:32
ippl::mpi::Communicator::size_m
int size_m
Definition
Communicator.h:212
ippl::mpi::Status
Definition
Status.h:14