Ignore:
Timestamp:
05/28/18 23:25:35 (4 years ago)
Author:
yushan
Message:

MPI_split can deal with discontinuous ranking within a process

File:
1 edited

Legend:

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

    r1503 r1504  
    1616namespace ep_lib 
    1717{ 
     18 
     19  int MPI_Allgather_local(const void *sendbuf, int count, MPI_Datatype datatype, void *recvbuf, MPI_Comm comm) 
     20  { 
     21    assert(valid_type(datatype)); 
     22 
     23    ::MPI_Aint datasize, lb; 
     24    ::MPI_Type_get_extent(to_mpi_type(datatype), &lb, &datasize); 
     25 
     26    int ep_rank_loc = comm->ep_comm_ptr->size_rank_info[1].first; 
     27    int num_ep = comm->ep_comm_ptr->size_rank_info[1].second; 
     28 
     29    #pragma omp critical (write_buffer) 
     30    comm->my_buffer->void_buffer[ep_rank_loc] = const_cast< void* >(sendbuf); 
     31 
     32    MPI_Barrier_local(comm); 
     33 
     34    #pragma omp critical (read_buffer) 
     35    { 
     36      for(int i=0; i<num_ep; i++) 
     37        memcpy(recvbuf + datasize * i * count, comm->my_buffer->void_buffer[i], datasize * count); 
     38    } 
     39  } 
    1840 
    1941  int MPI_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm) 
Note: See TracChangeset for help on using the changeset viewer.