Changeset 1527 for XIOS/dev/branch_openmp/extern/ep_dev/ep_lib.cpp
- Timestamp:
- 06/08/18 15:59:53 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/extern/ep_dev/ep_lib.cpp
r1525 r1527 32 32 33 33 int get_ep_rank(MPI_Comm comm, int ep_rank_loc, int mpi_rank) 34 { 35 /*if(comm->is_intercomm) 36 { 37 for(std::map<int, std::pair< int, std::pair<int, int> > >::iterator it = comm->ep_comm_ptr->intercomm->intercomm_rank_map->begin(); it != comm->ep_comm_ptr->intercomm->intercomm_rank_map->end(); it++) 38 { 39 if( ( it->second.first == ep_rank_loc ) 40 && ( it->second.second.first == mpi_rank ) ) 41 { 42 return it->first; 43 } 44 } 45 printf("rank not find for EP_intercomm\n"); 46 int err; 47 return MPI_Abort(comm, err); 48 }*/ 49 34 { 50 35 for(std::map<int, std::pair<int, int> >::iterator it = comm->ep_rank_map->begin(); it != comm->ep_rank_map->end(); it++) 51 36 { … … 57 42 } 58 43 printf("rank not find for EP_intracomm\n"); 59 int err; 60 return MPI_Abort(comm, err); 44 return MPI_Abort(comm, 0); 61 45 } 62 46 … … 70 54 { 71 55 return ::MPI_Wtime(); 72 56 } 57 58 int MPI_Comm_test_inter(MPI_Comm comm, int *flag) 59 { 60 if(comm->is_ep) return *flag = comm->is_intercomm; 61 else return ::MPI_Comm_test_inter(to_mpi_comm(comm->mpi_comm), flag); 73 62 } 74 63 … … 139 128 } 140 129 141 int test_sendrecv(MPI_Comm comm)142 {143 int myRank;144 MPI_Comm_rank(comm, &myRank);145 bool amClient = false;146 bool amServer = false;147 if(myRank<=3) amClient = true;148 else amServer = true;149 150 if(amServer)151 {152 int send_buf[4];153 MPI_Request send_request[8];154 MPI_Status send_status[8];155 156 157 158 for(int j=0; j<4; j++) // 4 buffers159 {160 for(int i=0; i<2; i++)161 {162 send_buf[j] = (myRank+1)*100 + j;163 MPI_Isend(&send_buf[j], 1, MPI_INT, i*2, 9999, comm, &send_request[i*4+j]);164 }165 }166 167 168 MPI_Waitall(8, send_request, send_status);169 }170 171 172 if(amClient&&myRank%2==0) // Clients leaders173 {174 int recv_buf[8];175 MPI_Request recv_request[8];176 MPI_Status recv_status[8];177 178 for(int i=0; i<2; i++) // 2 servers179 {180 for(int j=0; j<4; j++)181 {182 MPI_Irecv(&recv_buf[i*4+j], 1, MPI_INT, i+4, 9999, comm, &recv_request[i*4+j]);183 }184 }185 186 MPI_Waitall(8, recv_request, recv_status);187 printf("============ client %d, recv_buf = %d, %d, %d, %d, %d, %d, %d, %d ================\n",188 myRank, recv_buf[0], recv_buf[1], recv_buf[2], recv_buf[3], recv_buf[4], recv_buf[5], recv_buf[6], recv_buf[7]);189 }190 191 MPI_Barrier(comm);192 193 }194 130 195 131 bool valid_type(MPI_Datatype datatype)
Note: See TracChangeset
for help on using the changeset viewer.