Line data Source code
1 : namespace ippl {
2 : namespace mpi {
3 :
4 : /*
5 : * Blocking point-to-point communication
6 : */
7 :
8 : template <typename T>
9 0 : void Communicator::send(const T& buf, int count, int dest, int tag) {
10 0 : this->send(&buf, count, dest, tag);
11 0 : }
12 :
13 : template <typename T>
14 0 : void Communicator::send(const T* buf, int count, int dest, int tag) {
15 0 : MPI_Datatype type = get_mpi_datatype<T>(*buf);
16 :
17 0 : MPI_Send(buf, count, type, dest, tag, *comm_m);
18 0 : }
19 :
20 : template <typename T>
21 0 : void Communicator::recv(T& output, int count, int source, int tag, Status& status) {
22 0 : this->recv(&output, count, source, tag, status);
23 0 : }
24 :
25 : template <typename T>
26 0 : void Communicator::recv(T* output, int count, int source, int tag, Status& status) {
27 0 : MPI_Datatype type = get_mpi_datatype<T>(*output);
28 :
29 0 : MPI_Recv(output, count, type, source, tag, *comm_m, status);
30 0 : }
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
|