Ignore:
Timestamp:
05/29/17 16:15:38 (7 years ago)
Author:
yushan
Message:

bug fixed in MPI_Gather(v)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_yushan_merged/extern/src_ep_dev/ep_gather.cpp

    r1134 r1147  
    352352 
    353353    void *local_gather_recvbuf; 
     354    void *master_recvbuf; 
     355    if(ep_rank_loc == 0 && mpi_rank == root_mpi_rank && root_ep_loc != 0) master_recvbuf = new void*[sizeof(recvbuf)]; 
    354356 
    355357    if(ep_rank_loc==0) 
     
    381383      } 
    382384 
    383  
    384       ::MPI_Gatherv(local_gather_recvbuf, count*num_ep, static_cast< ::MPI_Datatype>(datatype), recvbuf, gatherv_recvcnt, 
     385      if(root_ep_loc != 0) // gather to root_master 
     386      { 
     387        ::MPI_Gatherv(local_gather_recvbuf, count*num_ep, static_cast< ::MPI_Datatype>(datatype), master_recvbuf, gatherv_recvcnt, 
    385388                    gatherv_displs, static_cast< ::MPI_Datatype>(datatype), root_mpi_rank, static_cast< ::MPI_Comm>(comm.mpi_comm)); 
     389      } 
     390      else 
     391      { 
     392        ::MPI_Gatherv(local_gather_recvbuf, count*num_ep, static_cast< ::MPI_Datatype>(datatype), recvbuf, gatherv_recvcnt, 
     393                    gatherv_displs, static_cast< ::MPI_Datatype>(datatype), root_mpi_rank, static_cast< ::MPI_Comm>(comm.mpi_comm)); 
     394      } 
    386395 
    387396      delete[] gatherv_recvcnt; 
     
    392401    if(root_ep_loc != 0 && mpi_rank == root_mpi_rank) // root is not master, master send to root and root receive from master 
    393402    { 
    394       innode_memcpy(0, recvbuf, root_ep_loc, recvbuf, count*ep_size, datatype, comm); 
     403      innode_memcpy(0, master_recvbuf, root_ep_loc, recvbuf, count*ep_size, datatype, comm); 
     404      if(ep_rank_loc == 0 ) delete[] master_recvbuf; 
    395405    } 
    396406 
     
    399409    if(ep_rank_loc==0) 
    400410    { 
     411 
    401412      if(datatype == MPI_INT) 
    402413      { 
Note: See TracChangeset for help on using the changeset viewer.