source: XIOS/dev/branch_openmp/extern/ep_dev/ep_fetch.cpp @ 2129

Last change on this file since 2129 was 1503, checked in by yushan, 6 years ago

rank_map is passed from vector to map, in order to have more flexibility in comm_split

File size: 901 bytes
RevLine 
[1394]1#include "ep_lib.hpp"
2#include <mpi.h>
3#include "ep_declaration.hpp"
4#include "ep_mpi.hpp"
5
6using namespace std;
7
8namespace ep_lib
9{
10
11        int MPI_Fetch_and_op(const void *origin_addr, void *result_addr, MPI_Datatype datatype, int target_rank, MPI_Aint target_disp, MPI_Op op, MPI_Win win)
12  {
[1503]13    int target_mpi_rank   = win->comm->ep_rank_map->at(target_rank).second;
14    int target_local_rank = win->comm->ep_rank_map->at(target_rank).first;
[1500]15    int num_ep = win->comm->ep_comm_ptr->size_rank_info[1].second;
[1394]16    if(num_ep==1)
[1500]17      return  ::MPI_Fetch_and_op(origin_addr, result_addr, to_mpi_type(datatype), target_mpi_rank, to_mpi_aint(target_disp), to_mpi_op(op), to_mpi_win(win->server_win[target_local_rank]));
[1394]18
19    else
[1500]20        return  ::MPI_Fetch_and_op(origin_addr, result_addr, to_mpi_type(datatype), target_mpi_rank, to_mpi_aint(target_disp), to_mpi_op(op), to_mpi_win(win->client_win));
[1394]21  }
22
[1500]23}
Note: See TracBrowser for help on using the repository browser.