source: XIOS/dev/branch_openmp/extern/src_ep_dev/ep_compare.cpp @ 1521

Last change on this file since 1521 was 1521, checked in by yushan, 3 years ago

save dev. TO DO : test with xios

File size: 926 bytes
Line 
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_Compare_and_swap(const void *origin_addr, const void *compare_addr, void *result_addr, MPI_Datatype datatype, int target_rank, MPI_Aint target_disp, MPI_Win win)
12  {
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;
15    int num_ep = win->comm->ep_comm_ptr->size_rank_info[1].second;
16    if(num_ep==1)
17      return  ::MPI_Compare_and_swap(origin_addr, compare_addr, result_addr, to_mpi_type(datatype), target_mpi_rank, to_mpi_aint(target_disp), to_mpi_win(win->server_win[target_local_rank]));
18
19    else
20        return  ::MPI_Compare_and_swap(origin_addr, compare_addr, result_addr, to_mpi_type(datatype), target_mpi_rank, to_mpi_aint(target_disp), to_mpi_win(win->client_win));
21  }
22
23}
Note: See TracBrowser for help on using the repository browser.