Changeset 1500 for XIOS/dev/branch_openmp/extern/ep_dev/ep_gather.cpp
- Timestamp:
- 05/28/18 09:54:32 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/extern/ep_dev/ep_gather.cpp
r1499 r1500 23 23 ::MPI_Type_get_extent(to_mpi_type(datatype), &lb, &datasize); 24 24 25 int ep_rank_loc = comm .ep_comm_ptr->size_rank_info[1].first;26 int num_ep = comm .ep_comm_ptr->size_rank_info[1].second;25 int ep_rank_loc = comm->ep_comm_ptr->size_rank_info[1].first; 26 int num_ep = comm->ep_comm_ptr->size_rank_info[1].second; 27 27 28 28 #pragma omp critical (_gather) 29 comm .my_buffer->void_buffer[ep_rank_loc] = const_cast< void* >(sendbuf);29 comm->my_buffer->void_buffer[ep_rank_loc] = const_cast< void* >(sendbuf); 30 30 31 31 MPI_Barrier_local(comm); … … 34 34 { 35 35 for(int i=0; i<num_ep; i++) 36 memcpy(recvbuf + datasize * i * count, comm .my_buffer->void_buffer[i], datasize * count);36 memcpy(recvbuf + datasize * i * count, comm->my_buffer->void_buffer[i], datasize * count); 37 37 38 38 //printf("local_recvbuf = %d %d \n", static_cast<int*>(recvbuf)[0], static_cast<int*>(recvbuf)[1] ); … … 44 44 int MPI_Gather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm) 45 45 { 46 if(!comm .is_ep)46 if(!comm->is_ep) 47 47 { 48 48 return ::MPI_Gather(const_cast<void*>(sendbuf), sendcount, to_mpi_type(sendtype), recvbuf, recvcount, to_mpi_type(recvtype), 49 root, to_mpi_comm(comm .mpi_comm));49 root, to_mpi_comm(comm->mpi_comm)); 50 50 } 51 51 52 52 assert(sendcount == recvcount && sendtype == recvtype); 53 53 54 int ep_rank = comm .ep_comm_ptr->size_rank_info[0].first;55 int ep_rank_loc = comm .ep_comm_ptr->size_rank_info[1].first;56 int mpi_rank = comm .ep_comm_ptr->size_rank_info[2].first;57 int ep_size = comm .ep_comm_ptr->size_rank_info[0].second;58 int num_ep = comm .ep_comm_ptr->size_rank_info[1].second;59 int mpi_size = comm .ep_comm_ptr->size_rank_info[2].second;54 int ep_rank = comm->ep_comm_ptr->size_rank_info[0].first; 55 int ep_rank_loc = comm->ep_comm_ptr->size_rank_info[1].first; 56 int mpi_rank = comm->ep_comm_ptr->size_rank_info[2].first; 57 int ep_size = comm->ep_comm_ptr->size_rank_info[0].second; 58 int num_ep = comm->ep_comm_ptr->size_rank_info[1].second; 59 int mpi_size = comm->ep_comm_ptr->size_rank_info[2].second; 60 60 61 int root_mpi_rank = comm .rank_map->at(root).second;62 int root_ep_loc = comm .rank_map->at(root).first;61 int root_mpi_rank = comm->rank_map->at(root).second; 62 int root_ep_loc = comm->rank_map->at(root).first; 63 63 64 64 ::MPI_Aint datasize, lb; … … 90 90 for(int i=0; i<ep_size; i++) 91 91 { 92 recvcounts[comm .rank_map->at(i).second]+=sendcount;92 recvcounts[comm->rank_map->at(i).second]+=sendcount; 93 93 } 94 94 … … 96 96 displs[i] = displs[i-1] + recvcounts[i-1]; 97 97 98 ::MPI_Gatherv(local_recvbuf, sendcount*num_ep, to_mpi_type(sendtype), tmp_recvbuf, recvcounts.data(), displs.data(), to_mpi_type(recvtype), root_mpi_rank, to_mpi_comm(comm .mpi_comm));98 ::MPI_Gatherv(local_recvbuf, sendcount*num_ep, to_mpi_type(sendtype), tmp_recvbuf, recvcounts.data(), displs.data(), to_mpi_type(recvtype), root_mpi_rank, to_mpi_comm(comm->mpi_comm)); 99 99 } 100 100 … … 111 111 for(int i=0; i<ep_size; i++) 112 112 { 113 offset = displs[comm .rank_map->at(i).second] + comm.rank_map->at(i).first * sendcount;113 offset = displs[comm->rank_map->at(i).second] + comm->rank_map->at(i).first * sendcount; 114 114 memcpy(recvbuf + i*sendcount*datasize, tmp_recvbuf+offset*datasize, sendcount*datasize); 115 115
Note: See TracChangeset
for help on using the changeset viewer.