Changeset 1385


Ignore:
Timestamp:
12/19/17 17:50:40 (6 years ago)
Author:
yushan
Message:

dev EP-RMA : MPI_Get_accumulate

Location:
XIOS/dev/branch_openmp/extern/ep_dev
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_accumulate.cpp

    r1384 r1385  
    2424  } 
    2525 
     26  int MPI_Get_accumulate(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype, void *result_addr,  
     27                         int result_count, MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, 
     28                         int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win) 
     29  { 
     30    int target_mpi_rank   = win.comm.rank_map->at(target_rank).second; 
     31    int target_local_rank = win.comm.rank_map->at(target_rank).first; 
     32    int num_ep = win.comm.ep_comm_ptr->size_rank_info[1].second; 
     33    if(num_ep==1) 
     34      return ::MPI_Get_accumulate(origin_addr, origin_count, to_mpi_type(origin_datatype), result_addr, result_count, to_mpi_type(result_datatype), target_mpi_rank, to_mpi_aint(target_disp), target_count, 
     35                                  to_mpi_type(target_datatype), to_mpi_op(op), to_mpi_win(win.server_win[target_local_rank])); 
     36    else 
     37      return ::MPI_Get_accumulate(origin_addr, origin_count, to_mpi_type(origin_datatype), result_addr, result_count, to_mpi_type(result_datatype), target_mpi_rank, to_mpi_aint(target_disp), target_count, 
     38                                  to_mpi_type(target_datatype), to_mpi_op(op), to_mpi_win(win.client_win)); 
     39  } 
     40 
    2641} 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_declaration.cpp

    r1381 r1385  
    3737::MPI_Op MPI_MAX_STD = MPI_MAX; 
    3838::MPI_Op MPI_MIN_STD = MPI_MIN; 
     39::MPI_Op MPI_REPLACE_STD = MPI_REPLACE; 
    3940 
    4041#undef MPI_SUM 
    4142#undef MPI_MAX 
    4243#undef MPI_MIN 
     44#undef MPI_REPLACE 
    4345 
    4446 
     
    5759extern ::MPI_Op MPI_MAX_STD; 
    5860extern ::MPI_Op MPI_MIN_STD; 
     61extern ::MPI_Op MPI_REPLACE_STD; 
    5962 
    6063extern ::MPI_Comm MPI_COMM_WORLD_STD; 
     
    7679ep_lib::MPI_Op MPI_MAX = &MPI_MAX_STD; 
    7780ep_lib::MPI_Op MPI_MIN = &MPI_MIN_STD; 
     81ep_lib::MPI_Op MPI_REPLACE = &MPI_REPLACE_STD; 
    7882 
    7983ep_lib::MPI_Comm MPI_COMM_WORLD(&MPI_COMM_WORLD_STD); 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_declaration.hpp

    r1381 r1385  
    1313#undef MPI_MAX 
    1414#undef MPI_MIN 
     15#undef MPI_REPLACE 
    1516 
    1617#undef MPI_COMM_WORLD 
     
    3233extern ep_lib::MPI_Op MPI_MAX; 
    3334extern ep_lib::MPI_Op MPI_MIN; 
     35extern ep_lib::MPI_Op MPI_REPLACE; 
    3436 
    3537extern ep_lib::MPI_Comm MPI_COMM_WORLD; 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_lib_win.hpp

    r1384 r1385  
    1919  int MPI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype,  
    2020                         int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win); 
     21 
     22  int MPI_Get_accumulate(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype, void *result_addr,  
     23                         int result_count, MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, 
     24                         int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win); 
     25 
    2126} 
    2227 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_type.cpp

    r1381 r1385  
    8383    mpi_aint = new ::MPI_Aint; 
    8484    *(static_cast< ::MPI_Aint*>(mpi_aint)) = aint; 
     85  } 
     86 
     87  MPI_Aint MPI_Aint::operator=(int a) 
     88  { 
     89    mpi_aint = new ::MPI_Aint; 
     90    *(static_cast< int*>(mpi_aint)) = a;  
    8591  } 
    8692   
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_type.hpp

    r1381 r1385  
    257257    MPI_Aint(void* aint); 
    258258    MPI_Aint(int aint); 
     259    MPI_Aint operator=(int a); 
    259260    //MPI_Aint(int a): mpi_aint(a) {} 
    260261  }; 
  • XIOS/dev/branch_openmp/extern/ep_dev/main.cpp

    r1384 r1385  
    682682 
    683683    MPI_Win ep_win; 
    684     MPI_Aint buf_size(1); 
     684    MPI_Aint buf_size=1; 
    685685    int buf = rank; 
    686686    int local_buf = rank; 
     687    int result_buf = -1; 
    687688    MPI_Win_create(&buf, buf_size, sizeof(int), info, comm, &ep_win); 
    688689    MPI_Barrier(comm); 
     
    699700    { 
    700701      local_buf = 99; 
    701       MPI_Aint displs(0); 
     702      MPI_Aint displs=0; 
    702703      MPI_Put(&local_buf, 1, MPI_INT, size-1, displs, 1, MPI_INT, ep_win); 
    703704    } 
     
    711712    MPI_Win_fence(0, ep_win); 
    712713 
    713     if(rank == 0) 
    714     { 
    715       MPI_Aint displs(0); 
    716       MPI_Accumulate(&local_buf, 1, MPI_INT, size-1, displs, 1, MPI_INT, MPI_SUM, ep_win); 
     714    if(rank == 1) 
     715    { 
     716      MPI_Aint displs=0; 
     717      MPI_Accumulate(&local_buf, 1, MPI_INT, size-1, displs, 1, MPI_INT, MPI_REPLACE, ep_win); 
    717718    } 
    718719 
     
    722723    MPI_Win_fence(0, ep_win); 
    723724 
     725    if(rank == 2) 
     726    { 
     727      MPI_Aint displs = 0; 
     728      MPI_Get_accumulate(&local_buf, 1, MPI_INT, &result_buf,  
     729                         1, MPI_INT, size-2, displs, 
     730                         1, MPI_INT, MPI_SUM, ep_win); 
     731    } 
     732 
    724733     
    725734    MPI_Win_free(&ep_win); 
    726     printf("rank = %d, buf = %d, local_buf = %d\n", rank, buf, local_buf); 
     735    printf("rank = %d, buf = %d, local_buf = %d, result_buf = %d\n", rank, buf, local_buf, result_buf); 
    727736     
    728737    MPI_Comm_free(&comm); 
Note: See TracChangeset for help on using the changeset viewer.