IPPL (Independent Parallel Particle Layer)
IPPL
Loading...
Searching...
No Matches
PointToPoint.hpp
Go to the documentation of this file.
1namespace ippl {
2 namespace mpi {
3
4 /*
5 * Blocking point-to-point communication
6 */
7
8 template <typename T>
9 void Communicator::send(const T& buf, int count, int dest, int tag) {
10 this->send(&buf, count, dest, tag);
11 }
12
13 template <typename T>
14 void Communicator::send(const T* buf, int count, int dest, int tag) {
15 MPI_Datatype type = get_mpi_datatype<T>(*buf);
16
17 MPI_Send(buf, count, type, dest, tag, *comm_m);
18 }
19
20 template <typename T>
21 void Communicator::recv(T& output, int count, int source, int tag, Status& status) {
22 this->recv(&output, count, source, tag, status);
23 }
24
25 template <typename T>
26 void Communicator::recv(T* output, int count, int source, int tag, Status& status) {
27 MPI_Datatype type = get_mpi_datatype<T>(*output);
28
29 MPI_Recv(output, count, type, source, tag, *comm_m, status);
30 }
31
32 /*
33 * Non-blocking point-to-point communication
34 */
35
36 template <typename T>
37 void Communicator::isend(const T& buffer, int count, int dest, int tag, Request& request) {
38 this->isend(&buffer, count, dest, tag, request);
39 }
40
41 template <typename T>
42 void Communicator::isend(const T* buffer, int count, int dest, int tag, Request& request) {
43 MPI_Datatype type = get_mpi_datatype<T>(*buffer);
44
45 MPI_Isend(buffer, count, type, dest, tag, comm_m, request);
46 }
47
48 template <typename T>
49 void Communicator::irecv(T& buffer, int count, int source, int tag, Request& request) {
50 this->irecv(&buffer, count, source, tag, request);
51 }
52
53 template <typename T>
54 void Communicator::irecv(T* buffer, int count, int source, int tag, Request& request) {
55 MPI_Datatype type = get_mpi_datatype<T>(*buffer);
56
57 MPI_Irecv(buffer, count, type, source, tag, *comm_m, request);
58 }
59
60 } // namespace mpi
61} // namespace ippl
Definition Archive.h:20
MPI_Datatype get_mpi_datatype(const T &)
Definition DataTypes.h:65
void send(const T &buffer, int count, int dest, int tag)
void irecv(T &buffer, int count, int source, int tag, Request &request)
void recv(T &output, int count, int source, int tag, Status &status)
std::shared_ptr< MPI_Comm > comm_m
void isend(const T &buffer, int count, int dest, int tag, Request &request)