[1651] | 1 | #ifdef _usingEP |
---|
| 2 | #include "ep_lib.hpp" |
---|
| 3 | #include <mpi.h> |
---|
| 4 | #include "ep_declaration.hpp" |
---|
| 5 | #include "ep_mpi.hpp" |
---|
| 6 | |
---|
| 7 | using namespace std; |
---|
| 8 | |
---|
| 9 | namespace ep_lib |
---|
| 10 | { |
---|
| 11 | |
---|
| 12 | int MPI_Put(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype, |
---|
| 13 | int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win) |
---|
| 14 | { |
---|
| 15 | int target_mpi_rank = win->comm->ep_rank_map->at(target_rank).second; |
---|
| 16 | int target_local_rank = win->comm->ep_rank_map->at(target_rank).first; |
---|
| 17 | int num_ep = win->comm->ep_comm_ptr->size_rank_info[1].second; |
---|
| 18 | if(num_ep==1) |
---|
| 19 | return ::MPI_Put(origin_addr, origin_count, to_mpi_type(origin_datatype), target_mpi_rank, to_mpi_aint(target_disp), target_count, to_mpi_type(target_datatype), |
---|
| 20 | to_mpi_win(win->server_win[target_local_rank])); |
---|
| 21 | |
---|
| 22 | else |
---|
| 23 | return ::MPI_Put(origin_addr, origin_count, to_mpi_type(origin_datatype), target_mpi_rank, to_mpi_aint(target_disp), target_count, to_mpi_type(target_datatype), |
---|
| 24 | to_mpi_win(win->client_win)); |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | int MPI_Rput(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype, |
---|
| 28 | int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win, MPI_Request *request) |
---|
| 29 | { |
---|
| 30 | int target_mpi_rank = win->comm->ep_rank_map->at(target_rank).second; |
---|
| 31 | int target_local_rank = win->comm->ep_rank_map->at(target_rank).first; |
---|
| 32 | int num_ep = win->comm->ep_comm_ptr->size_rank_info[1].second; |
---|
| 33 | |
---|
| 34 | ::MPI_Request mpi_request; |
---|
| 35 | |
---|
| 36 | if(num_ep==1) |
---|
| 37 | { |
---|
| 38 | int return_value = ::MPI_Rput(origin_addr, origin_count, to_mpi_type(origin_datatype), target_mpi_rank, to_mpi_aint(target_disp), target_count, to_mpi_type(target_datatype), |
---|
| 39 | to_mpi_win(win->server_win[target_local_rank]), &mpi_request); |
---|
| 40 | |
---|
| 41 | (*request)->mpi_request = new ::MPI_Request(mpi_request); |
---|
| 42 | |
---|
| 43 | (*request)->ep_datatype = origin_datatype; |
---|
| 44 | (*request)->type = 1; |
---|
| 45 | return return_value; |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | else |
---|
| 49 | { |
---|
| 50 | int return_value = ::MPI_Rput(origin_addr, origin_count, to_mpi_type(origin_datatype), target_mpi_rank, to_mpi_aint(target_disp), target_count, to_mpi_type(target_datatype), |
---|
| 51 | to_mpi_win(win->client_win), &mpi_request); |
---|
| 52 | |
---|
| 53 | (*request)->mpi_request = new ::MPI_Request(mpi_request); |
---|
| 54 | |
---|
| 55 | (*request)->ep_datatype = origin_datatype; |
---|
| 56 | (*request)->type = 1; |
---|
| 57 | return return_value; |
---|
| 58 | } |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | } |
---|
| 62 | #endif |
---|