Changeset 1517
- Timestamp:
- 06/01/18 15:24:53 (6 years ago)
- Location:
- XIOS/dev/branch_openmp/extern/ep_dev
- Files:
-
- 1 added
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/extern/ep_dev/ep_barrier.cpp
r1515 r1517 11 11 if(comm->is_intercomm) return MPI_Barrier_intercomm(comm); 12 12 13 if(comm->is_ep) 13 if(comm->is_ep) 14 14 { 15 int ep_rank_loc = comm->ep_comm_ptr->size_rank_info[1].first; 16 17 MPI_Barrier_local(comm); 18 19 if(ep_rank_loc == 0) 20 { 21 ::MPI_Comm mpi_comm = to_mpi_comm(comm->mpi_comm); 22 23 ::MPI_Barrier(mpi_comm); 24 } 25 26 MPI_Barrier_local(comm); 27 28 return 0; 29 } 30 else if(comm->mpi_comm != static_cast< ::MPI_Comm*>(MPI_COMM_NULL->mpi_comm)) 31 { 32 ::MPI_Comm mpi_comm = to_mpi_comm(comm->mpi_comm); 33 ::MPI_Barrier(mpi_comm); 34 return 0; 15 return MPI_Barrier_intracomm(comm); 35 16 } 36 17 37 else return 0; 18 19 return MPI_Barrier_mpi(comm); 20 38 21 } 39 22 40 41 int MPI_Barrier_intercomm(MPI_Comm comm) 23 int MPI_Barrier_intracomm(MPI_Comm comm) 42 24 { 43 44 int ep_rank; 45 MPI_Comm_rank(comm, &ep_rank); 46 47 int ep_rank_loc = comm->ep_rank_map->at(ep_rank).first; 25 int ep_rank_loc = comm->ep_comm_ptr->size_rank_info[1].first; 48 26 49 27 MPI_Barrier_local(comm); … … 51 29 if(ep_rank_loc == 0) 52 30 { 53 //::MPI_Comm mpi_comm = to_mpi_comm(comm->ep_comm_ptr->intercomm->mpi_inter_comm); 54 ::MPI_Barrier(to_mpi_comm(comm->ep_comm_ptr->intercomm->mpi_inter_comm)); 31 ::MPI_Comm mpi_comm = to_mpi_comm(comm->mpi_comm); 32 33 ::MPI_Barrier(mpi_comm); 55 34 } 56 35 … … 58 37 59 38 return 0; 39 } 60 40 41 int MPI_Barrier_intercomm(MPI_Comm comm) 42 { 43 MPI_Barrier_local(comm); 44 45 if(comm->ep_comm_ptr->intercomm->size_rank_info[1].first == 0) 46 ::MPI_Barrier(to_mpi_comm(comm->ep_comm_ptr->intercomm->mpi_inter_comm)); 47 48 MPI_Barrier_local(comm); 49 } 50 51 int MPI_Barrier_mpi(MPI_Comm comm) 52 { 53 return ::MPI_Barrier(to_mpi_comm(comm->mpi_comm)); 61 54 } 62 55 … … 64 57 int MPI_Barrier_local(MPI_Comm comm) 65 58 { 66 //Message_Check(comm);67 59 comm->ep_barrier->wait(); 68 60 } -
XIOS/dev/branch_openmp/extern/ep_dev/ep_comm.hpp
r1515 r1517 37 37 38 38 ep_intercomm *intercomm; 39 40 ep_communicator();41 bool operator == (ep_communicator right);42 bool operator != (ep_communicator right);43 39 44 40 }; … … 53 49 54 50 BUFFER *my_buffer; 51 55 52 ep_barrier *ep_barrier; 53 56 54 EP_RANK_MAP *ep_rank_map; // for intercomm : = ep_rank_map of newcomm 55 56 57 57 58 void* mpi_comm; 58 59 ep_communicator *ep_comm_ptr; … … 60 61 void* mpi_bridge; 61 62 62 ep_comm() ;63 ep_comm(){}; 63 64 ep_comm(void* comm); 64 65 66 bool operator == (ep_comm right);67 bool operator != (ep_comm right);68 bool is_null();69 65 70 66 }; -
XIOS/dev/branch_openmp/extern/ep_dev/ep_create.cpp
r1511 r1517 41 41 42 42 out_comm_hdls = new MPI_Comm[num_ep]; 43 #ifdef _showinfo 44 printf("new out_comm_hdls = %p\n", out_comm_hdls); 45 #endif 43 46 47 ::MPI_Comm *parent_comm = new ::MPI_Comm; 48 ::MPI_Comm_dup(to_mpi_comm(base_comm_ptr), parent_comm); 49 50 #ifdef _showinfo 51 printf("new out_comm_hdls->mpi_comm = %p\n", parent_comm); 52 #endif 53 44 54 for (int idx = 0; idx < num_ep; ++idx) 45 55 { 56 46 57 out_comm_hdls[idx] = new ep_comm; 58 #ifdef _showinfo 59 printf("new out_comm_hdls[%d] = %p\n", idx, out_comm_hdls[idx]); 60 #endif 61 47 62 out_comm_hdls[idx]->is_ep = true; 48 63 out_comm_hdls[idx]->is_intercomm = false; 64 49 65 out_comm_hdls[idx]->ep_comm_ptr = new ep_communicator; 50 *(static_cast< ::MPI_Comm*>(out_comm_hdls[idx]->mpi_comm)) = *(static_cast< ::MPI_Comm*>(base_comm_ptr)); 66 #ifdef _showinfo 67 printf("new out_comm_hdls[%d]->ep_comm_ptr = %p\n", idx, out_comm_hdls[idx]->ep_comm_ptr); 68 #endif 69 70 71 out_comm_hdls[idx]->mpi_comm = parent_comm; 51 72 out_comm_hdls[idx]->ep_comm_ptr->comm_list = out_comm_hdls; 52 73 out_comm_hdls[idx]->ep_comm_ptr->comm_label = 0; … … 62 83 63 84 out_comm_hdls[0]->ep_barrier = new ep_barrier(num_ep); 85 #ifdef _showinfo 86 printf("new out_comm_hdls[0]->ep_barrier = %p\n", out_comm_hdls[0]->ep_barrier); 87 #endif 88 64 89 out_comm_hdls[0]->my_buffer = new BUFFER; 90 #ifdef _showinfo 91 printf("new out_comm_hdls[0]->my_buffer = %p\n", out_comm_hdls[0]->my_buffer); 92 #endif 65 93 66 94 out_comm_hdls[0]->ep_rank_map = new EP_RANK_MAP; 67 95 #ifdef _showinfo 96 printf("new out_comm_hdls[0]->ep_rank_map = %p\n", out_comm_hdls[0]->ep_rank_map); 97 #endif 68 98 69 99 for (int i = 1; i < num_ep; i++) … … 82 112 83 113 out_comm_hdls[i]->ep_comm_ptr->message_queue = new Message_list; 114 #ifdef _showinfo 115 printf("new out_comm_hdls[%d]->ep_comm_ptr->message_queue = %p\n", i, out_comm_hdls[i]->ep_comm_ptr->message_queue); 116 #endif 117 84 118 } 85 119 … … 91 125 for(int j=0; j<recv_num_ep[i]; j++) 92 126 { 93 //out_comm_hdls[0]->rank_map->at(ind) = make_pair(j, i);94 127 out_comm_hdls[0]->ep_rank_map->insert(std::pair< int, std::pair<int,int> >(ind, j, i)); 95 128 ind++; -
XIOS/dev/branch_openmp/extern/ep_dev/ep_dup.cpp
r1515 r1517 7 7 { 8 8 9 int MPI_Comm_dup_mpi(MPI_Comm comm, MPI_Comm *newcomm) 10 { 11 newcomm = new MPI_Comm; 12 (*newcomm)->is_ep = false; 13 14 ::MPI_Comm *output = new ::MPI_Comm; 15 16 ::MPI_Comm_dup(to_mpi_comm(comm->mpi_comm), output); 17 18 (*newcomm)->mpi_comm = output; 19 } 20 21 int MPI_Comm_dup_intracomm(MPI_Comm comm, MPI_Comm *newcomm) 22 { 23 int ep_rank_loc = comm->ep_comm_ptr->size_rank_info[1].first; 24 int num_ep = comm->ep_comm_ptr->size_rank_info[1].second; 25 26 27 if(0 == ep_rank_loc) 28 { 29 MPI_Info info; 30 MPI_Comm *out_comm; 31 32 MPI_Comm_create_endpoints(comm->mpi_comm, num_ep, info, out_comm); 33 comm->ep_comm_ptr->comm_list[0]->mem_bridge = out_comm; 34 } 35 36 MPI_Barrier_local(comm); 37 38 *newcomm = (comm->ep_comm_ptr->comm_list[0]->mem_bridge[ep_rank_loc]); 39 40 } 41 9 42 int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *newcomm) 10 43 { 44 11 45 if(!comm->is_ep) 12 46 { 13 Debug("Comm_dup MPI\n"); 14 newcomm = new MPI_Comm; 15 (*newcomm)->is_ep = comm->is_ep; 16 17 ::MPI_Comm input = to_mpi_comm(comm->mpi_comm); 18 ::MPI_Comm *output = new ::MPI_Comm; 19 20 21 ::MPI_Comm_dup(input, output); 22 23 (*newcomm)->mpi_comm = output; 24 25 return 0; 47 Debug("MPI_Comm_dup with MPI\n"); 48 return MPI_Comm_dup_mpi(comm, newcomm); 26 49 } 27 50 28 51 if(comm->is_intercomm) return MPI_Comm_dup_intercomm(comm, newcomm); 29 52 30 // for intracomm31 if(comm->mpi_comm == static_cast< ::MPI_Comm* >(MPI_COMM_NULL->mpi_comm)) return 0;53 54 return MPI_Comm_dup_intracomm(comm, newcomm); 32 55 33 34 int my_rank = comm->ep_comm_ptr->size_rank_info[1].first; 35 int num_ep = comm->ep_comm_ptr->size_rank_info[1].second; 36 37 38 if(0 == my_rank) 39 { 40 MPI_Info info; 41 MPI_Comm *out_comm; 42 ::MPI_Comm *mpi_dup = new ::MPI_Comm; 43 44 ::MPI_Comm in_comm = to_mpi_comm(comm->mpi_comm); 45 46 ::MPI_Comm_dup(in_comm, mpi_dup); 47 48 MPI_Comm_create_endpoints(mpi_dup, num_ep, info, out_comm); 49 comm->ep_comm_ptr->comm_list[0]->mem_bridge = out_comm; 50 } 51 52 MPI_Barrier(comm); 53 54 *newcomm = (comm->ep_comm_ptr->comm_list[0]->mem_bridge[my_rank]); 55 56 return MPI_SUCCESS; 56 57 57 } 58 58 … … 60 60 { 61 61 62 if(comm->mpi_comm == static_cast< ::MPI_Comm* >(MPI_COMM_NULL->mpi_comm)) return 0; 63 64 int my_rank = comm->ep_comm_ptr->size_rank_info[1].first; 65 int num_ep = comm->ep_comm_ptr->size_rank_info[1].second; 62 int newcomm_ep_rank =comm->ep_comm_ptr->intercomm->size_rank_info[0].first; 63 int newcomm_ep_rank_loc = comm->ep_comm_ptr->intercomm->size_rank_info[1].first; 64 int newcomm_num_ep = comm->ep_comm_ptr->intercomm->size_rank_info[1].second; 66 65 67 66 68 if(0 == my_rank)67 if(0 == newcomm_ep_rank_loc) 69 68 { 69 //printf("in dup , newcomm_ep_rank_loc = 0 : ep %d\n", comm->ep_comm_ptr->intercomm->size_rank_info[0].first); 70 70 71 MPI_Info info; 71 72 MPI_Comm *out_comm; 72 ::MPI_Comm *mpi_dup = new ::MPI_Comm;73 73 74 ::MPI_Comm in_comm = to_mpi_comm(comm->mpi_comm);74 MPI_Comm_create_endpoints(comm->mpi_comm, newcomm_num_ep, info, out_comm); 75 75 76 ::MPI_Comm_dup(in_comm, mpi_dup); 76 ::MPI_Comm *mpi_inter_comm = new ::MPI_Comm; 77 ::MPI_Comm_dup(to_mpi_comm(comm->ep_comm_ptr->intercomm->mpi_inter_comm), mpi_inter_comm); 77 78 78 MPI_Comm_create_endpoints(mpi_dup, num_ep, info, out_comm); 79 for(int i=0; i<newcomm_num_ep; i++) 80 { 81 out_comm[i]->is_intercomm = true; 82 out_comm[i]->ep_comm_ptr->comm_label = comm->ep_comm_ptr->comm_list[i]->ep_comm_ptr->comm_label; 83 out_comm[i]->ep_comm_ptr->intercomm = new ep_lib::ep_intercomm; 84 #ifdef _showinfo 85 printf("new out_comm[%d]->ep_comm_ptr->intercomm = %p\n", i, out_comm[i]->ep_comm_ptr->intercomm); 86 #endif 87 out_comm[i]->ep_comm_ptr->intercomm->mpi_inter_comm = mpi_inter_comm; 88 } 79 89 80 ::MPI_Comm *mpi_inter = new ::MPI_Comm;81 82 ::MPI_Comm_dup(to_mpi_comm(comm->ep_comm_ptr->intercomm->mpi_inter_comm), mpi_inter);83 84 for(int i=0; i<num_ep; i++)85 {86 out_comm[i]->ep_comm_ptr->comm_label = comm->ep_comm_ptr->comm_list[i]->ep_comm_ptr->comm_label;87 out_comm[i]->ep_comm_ptr->intercomm = new ep_intercomm;88 89 out_comm[i]->ep_comm_ptr->intercomm->mpi_inter_comm = mpi_inter;90 out_comm[i]->is_intercomm = true;91 92 out_comm[i]->ep_comm_ptr->intercomm->inter_rank_map = new RANK_MAP;93 out_comm[i]->ep_comm_ptr->intercomm->loc_rank_map = new RANK_MAP;94 out_comm[i]->ep_comm_ptr->intercomm->remote_rank_map = new RANK_MAP;95 96 int map_size = 0;97 map_size = comm->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm->intercomm_rank_map->size();98 out_comm[i]->ep_comm_ptr->intercomm->inter_rank_map->resize(map_size);99 for(int ii=0; ii<map_size; ii++)100 out_comm[i]->ep_comm_ptr->intercomm->intercomm_rank_map->at(ii) = comm->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm->intercomm_rank_map->at(ii);101 102 map_size = comm->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm->local_rank_map->size();103 out_comm[i]->ep_comm_ptr->intercomm->loc_rank_map->resize(map_size);104 for(int ii=0; ii<map_size; ii++)105 out_comm[i]->ep_comm_ptr->intercomm->local_rank_map->at(ii) = comm->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm->local_rank_map->at(ii);106 107 map_size = comm->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm->remote_rank_map->size();108 out_comm[i]->ep_comm_ptr->intercomm->remote_rank_map->resize(map_size);109 for(int ii=0; ii<map_size; ii++)110 out_comm[i]->ep_comm_ptr->intercomm->remote_rank_map->at(ii) = comm->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm->remote_rank_map->at(ii);111 112 113 //out_comm[i]->ep_comm_ptr->intercomm->intercomm_rank_map = comm->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm->intercomm_rank_map;114 //out_comm[i]->ep_comm_ptr->intercomm->local_rank_map = comm->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm->local_rank_map;115 //out_comm[i]->ep_comm_ptr->intercomm->remote_rank_map = comm->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm->remote_rank_map;116 117 //out_comm[i]->ep_comm_ptr->intercomm->local_comm = comm->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm->local_comm;118 out_comm[i]->ep_comm_ptr->intercomm->intercomm_tag = comm->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm->intercomm_tag;119 120 for(int j =0; j<3; j++)121 {122 out_comm[i]->ep_comm_ptr->intercomm->size_rank_info[j] = comm->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm->size_rank_info[j];123 }124 125 }126 90 127 91 comm->ep_comm_ptr->comm_list[0]->mem_bridge = out_comm; 128 92 } 129 93 130 MPI_Barrier (comm);94 MPI_Barrier_local(comm); 131 95 132 *newcomm = comm->ep_comm_ptr->comm_list[0]->mem_bridge[my_rank]; 96 *newcomm = (comm->ep_comm_ptr->comm_list[0]->mem_bridge[newcomm_ep_rank_loc]); 97 98 (*newcomm)->ep_comm_ptr->size_rank_info[0] = comm->ep_comm_ptr->size_rank_info[0]; 99 (*newcomm)->ep_comm_ptr->size_rank_info[1] = comm->ep_comm_ptr->size_rank_info[1]; 100 (*newcomm)->ep_comm_ptr->size_rank_info[2] = comm->ep_comm_ptr->size_rank_info[2]; 101 102 (*newcomm)->ep_comm_ptr->intercomm->size_rank_info[0] = comm->ep_comm_ptr->intercomm->size_rank_info[0]; 103 (*newcomm)->ep_comm_ptr->intercomm->size_rank_info[1] = comm->ep_comm_ptr->intercomm->size_rank_info[1]; 104 (*newcomm)->ep_comm_ptr->intercomm->size_rank_info[2] = comm->ep_comm_ptr->intercomm->size_rank_info[2]; 105 106 107 int ep_rank_loc = (*newcomm)->ep_comm_ptr->size_rank_info[1].first; 108 109 if(ep_rank_loc == 0) 110 { 111 //printf("in dup , ep_rank_loc = 0 : ep %d\n", (*newcomm)->ep_comm_ptr->size_rank_info[0].first); 112 (*newcomm)->ep_comm_ptr->intercomm->intercomm_rank_map = new INTERCOMM_RANK_MAP; 113 (*newcomm)->ep_comm_ptr->intercomm->local_rank_map = new EP_RANK_MAP; 114 115 *(*newcomm)->ep_comm_ptr->intercomm->intercomm_rank_map = *comm->ep_comm_ptr->intercomm->intercomm_rank_map; 116 *(*newcomm)->ep_comm_ptr->intercomm->local_rank_map = *comm->ep_comm_ptr->intercomm->local_rank_map; 117 } 118 119 MPI_Barrier_local(comm); 120 121 if(ep_rank_loc !=0 ) 122 { 123 (*newcomm)->ep_comm_ptr->intercomm->intercomm_rank_map = (*newcomm)->ep_comm_ptr->comm_list[0]->ep_comm_ptr->intercomm->intercomm_rank_map; 124 (*newcomm)->ep_comm_ptr->intercomm->local_rank_map = (*newcomm)->ep_comm_ptr->comm_list[0]->ep_comm_ptr->intercomm->local_rank_map; 125 } 126 133 127 134 128 135 return MPI_SUCCESS; 129 130 131 136 132 } 137 133 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_finalize.cpp
r1500 r1517 22 22 int MPI_Abort(MPI_Comm comm, int errorcode) 23 23 { 24 int id = omp_get_thread_num(); 24 if(!comm->is_ep) 25 return MPI_Abort_mpi(comm, errorcode); 25 26 26 if(id == 0)27 else 27 28 { 28 ::MPI_Comm mpi_comm = to_mpi_comm(comm->mpi_comm); 29 ::MPI_Abort(mpi_comm, errorcode); 29 if(comm->ep_comm_ptr->size_rank_info[1].first == 0) 30 { 31 ::MPI_Abort(to_mpi_comm(comm->mpi_comm), errorcode); 32 } 30 33 } 31 return 0; 34 } 35 36 int MPI_Abort_mpi(MPI_Comm comm, int errorcode) 37 { 38 return ::MPI_Abort(to_mpi_comm(comm->mpi_comm), errorcode); 32 39 } 33 40 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_free.cpp
r1515 r1517 11 11 if(! (*comm)->is_ep) 12 12 { 13 if((*comm)->mpi_comm != static_cast< ::MPI_Comm*>(MPI_COMM_NULL->mpi_comm)) 14 { 15 ::MPI_Comm mpi_comm = to_mpi_comm((*comm)->mpi_comm); 16 17 ::MPI_Comm_free(&mpi_comm); 18 Debug("comm is MPI, freed\n"); 19 } 20 return 0; 21 } 22 23 else if((*comm)->is_intercomm) 24 { 25 return MPI_Comm_free_intercomm(comm); 26 } 27 28 else 29 { 30 int ep_rank_loc, num_ep; 31 32 ep_rank_loc = (*comm)->ep_comm_ptr->size_rank_info[1].first; 33 num_ep = (*comm)->ep_comm_ptr->size_rank_info[1].second; 34 35 MPI_Barrier(*comm); 36 37 if(ep_rank_loc == 0) 38 { 39 Debug("comm is EP, mpi_comm_ptr != NULL\n"); 40 41 delete (*comm)->my_buffer; 42 43 44 if((*comm)->ep_barrier != NULL) 45 { 46 (*comm)->ep_barrier->~ep_barrier(); 47 Debug("ep_barrier freed\n"); 48 } 49 50 51 if( ! (*comm)->ep_rank_map->empty() ) 52 { 53 (*comm)->ep_rank_map->clear(); 54 delete (*comm)->ep_rank_map; 55 Debug("ep_rank_map emptied and freed\n"); 56 } 57 58 for(int i=0; i<num_ep; i++) 59 { 60 (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->message_queue->clear(); 61 delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->message_queue; 62 Debug("message queue freed\n"); 63 64 65 if((*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr != NULL) 66 { 67 delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr; 68 Debug("ep_comm_ptr freed\n"); 69 } 70 } 71 72 if( to_mpi_comm((*comm)->mpi_comm) != *static_cast< ::MPI_Comm*>(MPI_COMM_NULL->mpi_comm) 73 && to_mpi_comm((*comm)->mpi_comm) != *static_cast< ::MPI_Comm*>(MPI_COMM_WORLD->mpi_comm)) 74 { 75 ::MPI_Comm mpi_comm = to_mpi_comm((*comm)->mpi_comm); 76 ::MPI_Comm_free(&mpi_comm); 77 Debug("mpi_comm freed\n"); 78 } 79 80 //if(comm != NULL) {delete[] comm->ep_comm_ptr->comm_list; Debug("comm freed\n");} 81 82 } 83 84 return 0; 85 } 86 87 88 89 } 90 91 int MPI_Comm_free_intercomm(MPI_Comm *comm) 92 { 13 return MPI_Comm_free_mpi(comm); 14 } 15 16 else 17 { 18 if((*comm)->is_intercomm) 19 return MPI_Comm_free_intercomm(comm); 20 else 21 return MPI_Comm_free_intracomm(comm); 22 } 23 } 24 25 26 27 int MPI_Comm_free_mpi(MPI_Comm *comm) 28 { 29 Debug("MPI_Comm_free with MPI\n"); 30 31 return ::MPI_Comm_free(to_mpi_comm_ptr((*comm)->mpi_comm)); 32 33 } 34 35 int MPI_Comm_free_intracomm(MPI_Comm *comm) 36 { 37 Debug("MPI_Comm_free with EP_intracomm\n"); 38 93 39 int ep_rank_loc, num_ep; 94 //MPI_Barrier(*comm);95 96 return 0;97 40 98 41 ep_rank_loc = (*comm)->ep_comm_ptr->size_rank_info[1].first; 99 42 num_ep = (*comm)->ep_comm_ptr->size_rank_info[1].second; 100 43 101 102 103 //MPI_Barrier(*comm); 44 MPI_Barrier(*comm); 104 45 105 46 if(ep_rank_loc == 0) 106 47 { 107 Debug("comm is EP, mpi_comm_ptr != NULL\n"); 108 109 110 if((*comm)->ep_barrier != NULL) 111 { 112 (*comm)->ep_barrier->~ep_barrier(); 113 Debug("ep_barrier freed\n"); 114 } 115 116 117 if( ! (*comm)->ep_rank_map->empty() ) 118 { 119 (*comm)->ep_rank_map->clear(); 120 delete (*comm)->ep_rank_map; 121 Debug("ep_rank_map emptied and freed\n"); 122 } 48 49 #ifdef _showinfo 50 printf("delete (*comm)->my_buffer = %p\n", (*comm)->my_buffer); 51 #endif 52 delete (*comm)->my_buffer; 53 54 55 56 #ifdef _showinfo 57 printf("delete (*comm)->ep_barrier = %p\n", (*comm)->ep_barrier); 58 #endif 59 delete (*comm)->ep_barrier; 60 61 62 63 (*comm)->ep_rank_map->clear(); 64 #ifdef _showinfo 65 printf("delete (*comm)->ep_rank_map = %p\n", (*comm)->ep_rank_map); 66 #endif 67 delete (*comm)->ep_rank_map; 68 123 69 124 70 for(int i=0; i<num_ep; i++) 125 71 { 126 72 (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->message_queue->clear(); 127 Debug("message queue freed\n"); 128 129 #pragma omp critical (memory_free) 130 if((*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm != NULL)131 {132 (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm->local_rank_map->clear(); 133 (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm->remote_rank_map->clear(); 134 (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm->intercomm_rank_map->clear();135 Debug("intercomm local/remote/intercomm_rank_map emptied\n"); 136 }137 138 if((*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr != NULL) 139 { 140 delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr;141 Debug("ep_comm_ptr freed\n"); 142 }73 #ifdef _showinfo 74 printf("delete (*comm)->ep_comm_ptr->comm_list[%d]->ep_comm_ptr->message_queue = %p\n", i, (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->message_queue); 75 #endif 76 delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->message_queue; 77 78 79 #ifdef _showinfo 80 printf("delete (*comm)->ep_comm_ptr->comm_list[%d]->ep_comm_ptr = %p\n", i, (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr); 81 #endif 82 delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr; 83 84 85 #ifdef _showinfo 86 printf("delete (*comm)->ep_comm_ptr->comm_list[%d] = %p\n", i, (*comm)->ep_comm_ptr->comm_list[i]); 87 #endif 88 delete (*comm)->ep_comm_ptr->comm_list[i]; 143 89 } 144 90 145 if((*comm)->mpi_comm != static_cast< ::MPI_Comm*>(MPI_COMM_NULL->mpi_comm)) 91 #ifdef _showinfo 92 printf("delete (*comm)->mpi_comm = %p\n", (*comm)->mpi_comm); 93 #endif 94 ::MPI_Comm_free(to_mpi_comm_ptr((*comm)->mpi_comm)); 95 96 #ifdef _showinfo 97 printf("delete (*comm)->ep_comm_ptr->comm_list = %p\n", (*comm)->ep_comm_ptr->comm_list); 98 #endif 99 delete[] (*comm)->ep_comm_ptr->comm_list; 100 } 101 } 102 103 104 105 106 107 108 109 int MPI_Comm_free_intercomm(MPI_Comm *comm) 110 { 111 int ep_rank; 112 MPI_Comm_rank(*comm, &ep_rank); 113 int ep_rank_loc = (*comm)->ep_comm_ptr->size_rank_info[1].first; 114 int num_ep = (*comm)->ep_comm_ptr->size_rank_info[1].second; 115 116 int newcomm_ep_rank =(*comm)->ep_comm_ptr->intercomm->size_rank_info[0].first; 117 int newcomm_ep_rank_loc = (*comm)->ep_comm_ptr->intercomm->size_rank_info[1].first; 118 int newcomm_num_ep = (*comm)->ep_comm_ptr->intercomm->size_rank_info[1].second; 119 120 MPI_Barrier(*comm); 121 122 if(ep_rank_loc == 0) 123 { 124 (*comm)->ep_comm_ptr->intercomm->intercomm_rank_map->clear(); 125 #ifdef _showinfo 126 printf("delete (*comm)->ep_comm_ptr->intercomm->intercomm_rank_map = %p\n", (*comm)->ep_comm_ptr->intercomm->intercomm_rank_map); 127 #endif 128 delete (*comm)->ep_comm_ptr->intercomm->intercomm_rank_map; 129 130 (*comm)->ep_comm_ptr->intercomm->local_rank_map->clear(); 131 #ifdef _showinfo 132 printf("delete (*comm)->ep_comm_ptr->intercomm->local_rank_map = %p\n", (*comm)->ep_comm_ptr->intercomm->local_rank_map); 133 #endif 134 delete (*comm)->ep_comm_ptr->intercomm->local_rank_map; 135 } 136 137 if(newcomm_ep_rank_loc == 0) 138 { 139 140 #ifdef _showinfo 141 printf("delete (*comm)->my_buffer = %p\n", (*comm)->my_buffer); 142 #endif 143 delete (*comm)->my_buffer; 144 145 146 147 #ifdef _showinfo 148 printf("delete (*comm)->ep_barrier = %p\n", (*comm)->ep_barrier); 149 #endif 150 delete (*comm)->ep_barrier; 151 152 153 (*comm)->ep_rank_map->clear(); 154 #ifdef _showinfo 155 printf("delete (*comm)->ep_rank_map = %p\n", (*comm)->ep_rank_map); 156 #endif 157 delete (*comm)->ep_rank_map; 158 159 #ifdef _showinfo 160 printf("delete (*comm)->ep_comm_ptr->intercomm->mpi_inter_comm = %p\n", (*comm)->ep_comm_ptr->intercomm->mpi_inter_comm); 161 #endif 162 ::MPI_Comm_free(to_mpi_comm_ptr((*comm)->ep_comm_ptr->intercomm->mpi_inter_comm)); 163 164 for(int i=0; i<newcomm_num_ep; i++) 146 165 { 147 ::MPI_Comm mpi_comm = to_mpi_comm((*comm)->mpi_comm); 148 ::MPI_Comm_free(&mpi_comm); 149 Debug("mpi_comm freed\n"); 166 (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->message_queue->clear(); 167 #ifdef _showinfo 168 printf("delete (*comm)->ep_comm_ptr->comm_list[%d]->ep_comm_ptr->message_queue = %p\n", i, (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->message_queue); 169 #endif 170 delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->message_queue; 171 172 #ifdef _showinfo 173 printf("delete (*comm)->ep_comm_ptr->comm_list[%d]->ep_comm_ptr->intercomm = %p\n", i, (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm); 174 #endif 175 delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm; 176 177 178 #ifdef _showinfo 179 printf("delete (*comm)->ep_comm_ptr->comm_list[%d]->ep_comm_ptr = %p\n", i, (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr); 180 #endif 181 delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr; 182 183 184 #ifdef _showinfo 185 printf("delete (*comm)->ep_comm_ptr->comm_list[%d] = %p\n", i, (*comm)->ep_comm_ptr->comm_list[i]); 186 #endif 187 delete (*comm)->ep_comm_ptr->comm_list[i]; 188 150 189 } 151 190 152 if((*comm)->ep_comm_ptr->intercomm->mpi_inter_comm != static_cast< ::MPI_Comm*>(MPI_COMM_NULL->mpi_comm)) 153 { 154 ::MPI_Comm mpi_comm = to_mpi_comm((*comm)->ep_comm_ptr->comm_list[0]->ep_comm_ptr->intercomm->mpi_inter_comm); 155 ::MPI_Comm_free(&mpi_comm); 156 Debug("mpi_intercomm freed\n"); 157 } 158 159 if(comm != NULL) {delete[] (*comm)->ep_comm_ptr->comm_list; Debug("comm freed\n");} 160 161 } 162 163 164 165 return 0; 166 } 167 191 #ifdef _showinfo 192 printf("delete (*comm)->mpi_comm = %p\n", (*comm)->mpi_comm); 193 #endif 194 ::MPI_Comm_free(to_mpi_comm_ptr((*comm)->mpi_comm)); 195 196 #ifdef _showinfo 197 printf("delete (*comm)->ep_comm_ptr->comm_list = %p\n", (*comm)->ep_comm_ptr->comm_list); 198 #endif 199 delete[] (*comm)->ep_comm_ptr->comm_list; 200 } 201 } 168 202 169 203 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_info.hpp
r1502 r1517 12 12 void* mpi_info; 13 13 14 ep_info() ;14 ep_info(){}; 15 15 ep_info(void* info); 16 16 }; -
XIOS/dev/branch_openmp/extern/ep_dev/ep_init.cpp
r1499 r1517 11 11 int MPI_Init_thread(int *argc, char*** argv, int required, int*provided) 12 12 { 13 //printf("MPI_Init_thread\n");13 Debug("MPI_Init_thread with EP/MPI\n"); 14 14 15 int id = omp_get_thread_num(); 16 17 if(id == 0) 15 if(omp_get_thread_num() == 0) 18 16 { 19 17 ::MPI_Init_thread(argc, argv, required, provided); 20 18 } 21 return 0;22 19 } 23 20 24 21 int MPI_Init(int *argc, char ***argv) 25 22 { 26 //printf("MPI_init called\n"); 27 int id = omp_get_thread_num(); 23 Debug("MPI_Init with EP/MPI\n"); 28 24 29 if( id== 0)25 if(omp_get_thread_num() == 0) 30 26 { 31 27 ::MPI_Init(argc, argv); 32 28 } 33 return 0;34 29 } 35 30 36 31 int MPI_Initialized(int *flag) 37 32 { 38 //printf("MPI_initialized called\n");33 Debug("MPI_Initialized with EP/MPI\n"); 39 34 40 ::MPI_Initialized(flag); 41 42 return 0; 35 return ::MPI_Initialized(flag); 43 36 } 44 37 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_intercomm.hpp
r1515 r1517 24 24 25 25 26 RANK_MAP *inter_rank_map; 26 RANK_MAP *inter_rank_map; 27 27 RANK_MAP *loc_rank_map; 28 28 RANK_MAP *remote_rank_map; 29 29 30 30 31 SIZE_RANK_INFO size_rank_info[3]; 31 SIZE_RANK_INFO size_rank_info[3]; // size_rank_info of newcomm 32 32 33 33 34 //ep_comm *local_comm;35 34 int intercomm_tag; 36 37 ep_intercomm();38 //~ep_intercomm(){delete mpi_inter_comm;}39 bool operator == (ep_intercomm right);40 bool operator != (ep_intercomm right);41 35 42 36 }; -
XIOS/dev/branch_openmp/extern/ep_dev/ep_intercomm_kernel.cpp
r1515 r1517 353 353 MPI_Info info; 354 354 MPI_Comm_create_endpoints(extracted_comm, num_ep_count, info, ep_comm); 355 356 #ifdef _showinfo 357 printf("new ep_comm->ep_comm_ptr->intercomm->mpi_inter_comm = %p\n", mpi_inter_comm); 358 #endif 355 359 356 360 for(int i=0; i<num_ep_count; i++) … … 359 363 ep_comm[i]->ep_comm_ptr->comm_label = ranks_in_world_local[local_leader]; 360 364 ep_comm[i]->ep_comm_ptr->intercomm = new ep_lib::ep_intercomm; 365 #ifdef _showinfo 366 printf("new ep_comm[%d]->ep_comm_ptr->intercomm = %p\n", i, ep_comm[i]->ep_comm_ptr->intercomm); 367 #endif 361 368 ep_comm[i]->ep_comm_ptr->intercomm->mpi_inter_comm = mpi_inter_comm; 369 362 370 } 363 371 … … 496 504 ::MPI_Bcast(remote_quadruple_list, 4*remote_ep_size, to_mpi_type(MPI_INT), local_comm->ep_rank_map->at(local_leader).second, to_mpi_comm(local_comm->mpi_comm)); 497 505 (*newintercomm)->ep_comm_ptr->intercomm->intercomm_rank_map = new INTERCOMM_RANK_MAP; 506 #ifdef _showinfo 507 printf("new intercomm_rank_map = %p\n", (*newintercomm)->ep_comm_ptr->intercomm->intercomm_rank_map); 508 #endif 498 509 for(int i=0; i<remote_ep_size; i++) 499 510 { … … 522 533 if(is_involved) 523 534 { 524 (*newintercomm)->ep_comm_ptr->intercomm->local_rank_map = new EP_RANK_MAP[ep_size]; 525 *((*newintercomm)->ep_comm_ptr->intercomm->local_rank_map) = *(local_comm->ep_rank_map); 535 536 (*newintercomm)->ep_comm_ptr->intercomm->local_rank_map = new EP_RANK_MAP; 537 printf("new local_rank_map = %p\n", (*newintercomm)->ep_comm_ptr->intercomm->local_rank_map); 538 539 for(std::map<int, std::pair<int, int> >::iterator it = local_comm->ep_rank_map->begin(); it != local_comm->ep_rank_map->end(); it++) 540 { 541 (*newintercomm)->ep_comm_ptr->intercomm->local_rank_map->insert(std::pair<int, std::pair< int, int > >(it->first, it->second.first, it->second.second)); 542 } 526 543 } 527 544 … … 541 558 } 542 559 (*newintercomm)->ep_comm_ptr->intercomm->intercomm_rank_map = (*newintercomm)->ep_comm_ptr->comm_list[target]->ep_comm_ptr->intercomm->intercomm_rank_map; 543 (*newintercomm)->ep_comm_ptr->intercomm->local_rank_map = (*newintercomm)->ep_comm_ptr->comm_list[target]->ep_comm_ptr->intercomm->local_rank_map; 544 } 545 546 (*newintercomm)->ep_comm_ptr->size_rank_info[0]=local_comm->ep_comm_ptr->size_rank_info[0]; 547 (*newintercomm)->ep_comm_ptr->size_rank_info[1]=local_comm->ep_comm_ptr->size_rank_info[1]; 548 (*newintercomm)->ep_comm_ptr->size_rank_info[2]=local_comm->ep_comm_ptr->size_rank_info[2]; 549 560 (*newintercomm)->ep_comm_ptr->intercomm->local_rank_map = (*newintercomm)->ep_comm_ptr->comm_list[target]->ep_comm_ptr->intercomm->local_rank_map; 561 } 562 563 (*newintercomm)->ep_comm_ptr->intercomm->size_rank_info[0] = (*newintercomm)->ep_comm_ptr->size_rank_info[0]; 564 (*newintercomm)->ep_comm_ptr->intercomm->size_rank_info[1] = (*newintercomm)->ep_comm_ptr->size_rank_info[1]; 565 (*newintercomm)->ep_comm_ptr->intercomm->size_rank_info[2] = (*newintercomm)->ep_comm_ptr->size_rank_info[2]; 566 567 568 (*newintercomm)->ep_comm_ptr->size_rank_info[0] = local_comm->ep_comm_ptr->size_rank_info[0]; 569 (*newintercomm)->ep_comm_ptr->size_rank_info[1] = local_comm->ep_comm_ptr->size_rank_info[1]; 570 (*newintercomm)->ep_comm_ptr->size_rank_info[2] = local_comm->ep_comm_ptr->size_rank_info[2]; 571 572 573 #ifdef _showinfo 574 MPI_Barrier(peer_comm); 575 MPI_Barrier(peer_comm); 576 577 printf("peer_rank = %d, size_rank_info = %d %d %d %d %d %d\n", peer_comm->ep_comm_ptr->size_rank_info[0].first, 578 (*newintercomm)->ep_comm_ptr->size_rank_info[0].first, (*newintercomm)->ep_comm_ptr->size_rank_info[0].second, 579 (*newintercomm)->ep_comm_ptr->size_rank_info[1].first, (*newintercomm)->ep_comm_ptr->size_rank_info[1].second, 580 (*newintercomm)->ep_comm_ptr->size_rank_info[2].first, (*newintercomm)->ep_comm_ptr->size_rank_info[2].second); 581 582 MPI_Barrier(peer_comm); 583 MPI_Barrier(peer_comm); 584 585 #endif 586 550 587 /* 551 588 if(peer_comm->ep_comm_ptr->size_rank_info[0].first == 5) -
XIOS/dev/branch_openmp/extern/ep_dev/ep_lib.cpp
r1515 r1517 4 4 #include <iostream> 5 5 #include <fstream> 6 #include "ep_mpi.hpp" 6 7 7 8 using namespace std; … … 14 15 namespace ep_lib 15 16 { 16 bool ep_comm::is_null()17 {18 if(!this->is_intercomm)19 return this->mpi_comm == MPI_COMM_NULL->mpi_comm;20 else21 return this->ep_comm_ptr->intercomm->mpi_inter_comm == MPI_COMM_NULL->mpi_comm;22 }23 17 24 18 int tag_combine(int real_tag, int src, int dest) … … 47 41 int MPI_Get_count(const MPI_Status *status, MPI_Datatype datatype, int *count) 48 42 { 49 50 ::MPI_Status *mpi_status = static_cast< ::MPI_Status* >(status->mpi_status); 51 ::MPI_Datatype *mpi_datatype = static_cast< ::MPI_Datatype*>(datatype); 52 53 ::MPI_Get_count(mpi_status, *mpi_datatype, count); 43 return ::MPI_Get_count(to_mpi_status_ptr(*status), to_mpi_type(datatype), count); 54 44 } 55 45 … … 227 217 { 228 218 return *(static_cast< MPI_Comm* >(comm)); 219 } 220 221 MPI_Comm* to_mpi_comm_ptr(void* comm) 222 { 223 return static_cast< MPI_Comm* >(comm); 229 224 } 230 225 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_lib.hpp
r1515 r1517 4 4 #include "ep_type.hpp" 5 5 #include "ep_lib_intercomm.hpp" 6 #include "ep_lib_intracomm.hpp" 6 7 #include "ep_lib_local.hpp" 7 8 #include "ep_lib_collective.hpp" … … 10 11 #include "ep_lib_win.hpp" 11 12 #include "ep_lib_mpi.hpp" 13 //#include "ep_mpi.hpp" 12 14 13 15 … … 28 30 29 31 int MPI_Comm_free(MPI_Comm* comm); 30 int MPI_Comm_free_intracomm(MPI_Comm* comm);31 32 32 33 int MPI_Finalize(); … … 37 38 38 39 int MPI_Get_count(const MPI_Status *status, MPI_Datatype datatype, int *count); 39 40 // #ifdef _openmpi41 // int MPI_Comm_create_endpoints(void* mpi_comm, int num_ep, MPI_Info info, MPI_Comm *& out_comm_hdls); // from MPI to create endpoints42 // #elif _intelmpi43 // int MPI_Comm_create_endpoints(int mpi_comm, int num_ep, MPI_Info info, MPI_Comm *& out_comm_hdls); // from MPI to create endpoints44 // #endif45 40 46 int MPI_Comm_ create_endpoints(void* base_comm_ptr, int num_ep, MPI_Info info, MPI_Comm *& out_comm_hdls); // from EP to create endpoints41 int MPI_Comm_remote_size(MPI_Comm comm, int *size); 47 42 48 43 int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm); … … 51 46 int MPI_Issend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request); 52 47 53 int tag_combine(int real_tag, int src, int dest);54 int get_ep_rank(MPI_Comm comm, int ep_rank_loc, int mpi_rank);55 56 int Message_Check(MPI_Comm comm);57 int Message_Check_intracomm(MPI_Comm comm);58 int Request_Check();59 48 60 49 int MPI_Recv (void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status *status); … … 78 67 int MPI_Alloc_mem(unsigned long size, MPI_Info info, void *baseptr); 79 68 69 int MPI_Comm_test_inter(MPI_Comm comm, int *flag); 70 80 71 81 72 void check_sum_send(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, int type); … … 85 76 bool valid_op(MPI_Op op); 86 77 78 int tag_combine(int real_tag, int src, int dest); 79 int get_ep_rank(MPI_Comm comm, int ep_rank_loc, int mpi_rank); 80 81 int Message_Check(MPI_Comm comm); 82 83 int Request_Check(); 84 85 int test_sendrecv(MPI_Comm comm); 86 87 87 88 } 88 89 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_lib_collective.hpp
r1499 r1517 10 10 11 11 int MPI_Barrier(MPI_Comm comm); 12 12 13 13 14 int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *newcomm); … … 26 27 27 28 int MPI_Gather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm); 29 28 30 int MPI_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm); 29 31 … … 41 43 int MPI_Alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm); 42 44 45 int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *newcomm); 46 47 int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm *newintercomm); 48 49 int MPI_Intercomm_create_kernel(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm *newintercomm); 50 51 52 int MPI_Intercomm_create_from_world(MPI_Comm local_comm, int local_leader, void* peer_comm_ptr, int mpi_remote_leader, int tag, MPI_Comm *newintercomm); 53 54 int MPI_Intercomm_create_unique_leader(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm *newintercomm); 55 56 int MPI_Comm_create_endpoints(void* base_comm_ptr, int num_ep, MPI_Info info, MPI_Comm *& out_comm_hdls); // from EP to create endpoints 57 58 59 60 int MPI_Intercomm_merge(MPI_Comm intercomm, bool high, MPI_Comm *newintracomm); 61 62 int MPI_Intercomm_merge_unique_leader(MPI_Comm intercomm, bool high, MPI_Comm *newintracomm); 63 43 64 } 44 65 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_lib_intercomm.hpp
r1499 r1517 8 8 typedef void* MPI_Op; 9 9 10 10 int MPI_Send_intercomm(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm); 11 int MPI_Ssend_intercomm(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm); 12 int MPI_Isend_intercomm(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request); 13 14 int MPI_Issend_intercomm(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request); 15 16 11 17 int MPI_Comm_dup_intercomm(MPI_Comm comm, MPI_Comm *newcomm); 12 18 … … 22 28 23 29 int MPI_Iprobe_intercomm(int source, int tag, MPI_Comm comm, int *flag, MPI_Status *status); 24 int MPI_Iprobe_any_source(int tag, MPI_Comm comm, int *flag, MPI_Status *status);25 30 int MPI_Improbe_intercomm(int source, int tag, MPI_Comm comm, int *flag, MPI_Message *message, MPI_Status *status); 26 int MPI_Improbe_any_source(int tag, MPI_Comm comm, int *flag, MPI_Message *message, MPI_Status *status);27 31 28 int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *newcomm);29 32 30 int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm *newintercomm);31 33 32 int MPI_Intercomm_create_kernel(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm *newintercomm);33 34 // #ifdef _intelmpi35 // int MPI_Intercomm_create_from_world(MPI_Comm local_comm, int local_leader, int peer_comm_ptr, int mpi_remote_leader, int tag, MPI_Comm *newintercomm);36 // #elif _openmpi37 // int MPI_Intercomm_create_from_world(MPI_Comm local_comm, int local_leader, void* peer_comm_ptr, int mpi_remote_leader, int tag, MPI_Comm *newintercomm);38 // #endif39 40 int MPI_Intercomm_create_from_world(MPI_Comm local_comm, int local_leader, void* peer_comm_ptr, int mpi_remote_leader, int tag, MPI_Comm *newintercomm);41 42 int MPI_Intercomm_create_unique_leader(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm *newintercomm);43 44 int MPI_Intercomm_merge(MPI_Comm intercomm, bool high, MPI_Comm *newintracomm);45 46 int MPI_Intercomm_merge_unique_leader(MPI_Comm intercomm, bool high, MPI_Comm *newintracomm);47 48 int MPI_Comm_remote_size(MPI_Comm comm, int *size);49 50 int MPI_Comm_test_inter(MPI_Comm comm, int *flag);51 52 int test_sendrecv(MPI_Comm comm);53 34 54 35 } -
XIOS/dev/branch_openmp/extern/ep_dev/ep_lib_mpi.hpp
r1515 r1517 10 10 11 11 int MPI_Send_mpi (void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm); 12 int MPI_Send_intercomm(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm);13 14 12 int MPI_Ssend_mpi (void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm); 15 int MPI_Ssend_intercomm(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm);16 17 13 int MPI_Isend_mpi (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request); 18 int MPI_Isend_intercomm(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request);19 20 14 int MPI_Issend_mpi (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request); 21 int MPI_Issend_intercomm(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request);22 15 23 16 24 17 int MPI_Recv_mpi (void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status *status); 25 26 18 int MPI_Irecv_mpi (void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request *request); 19 27 20 28 21 int MPI_Comm_rank_mpi(MPI_Comm comm, int* rank); … … 30 23 int MPI_Comm_remote_size_mpi(MPI_Comm comm, int* size); 31 24 25 int MPI_Comm_dup_mpi(MPI_Comm comm, MPI_Comm *newcomm); 26 int MPI_Comm_free_mpi(MPI_Comm *comm); 27 28 int MPI_Barrier_mpi(MPI_Comm comm); 29 30 int MPI_Abort_mpi(MPI_Comm comm, int errorcode); 32 31 } 33 32 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_message.cpp
r1515 r1517 61 61 if(probed) 62 62 { 63 ::MPI_Get_count(to_mpi_status_ptr(status), to_mpi_type((*(*it))->ep_datatype), &recv_count);63 MPI_Get_count(&status, (*(*it))->ep_datatype, &recv_count); 64 64 65 65 MPI_Imrecv((*(*it))->buf, recv_count, (*(*it))->ep_datatype, message, *it); -
XIOS/dev/branch_openmp/extern/ep_dev/ep_message.hpp
r1502 r1517 15 15 void* mpi_status; 16 16 17 ep_message() {}18 ep_message(void* message);19 17 }; 20 18 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_mpi.hpp
r1500 r1517 7 7 MPI_Op to_mpi_op(ep_lib::MPI_Op op); 8 8 MPI_Comm to_mpi_comm(void* comm); 9 MPI_Comm* to_mpi_comm_ptr(void* comm); 9 10 MPI_Message to_mpi_message(void* message); 10 11 MPI_Info to_mpi_info(ep_lib::MPI_Info info); -
XIOS/dev/branch_openmp/extern/ep_dev/ep_request.hpp
r1503 r1517 34 34 ep_request() {} 35 35 ep_request(void* request); 36 bool operator == (ep_request right);37 36 }; 38 37 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_type.cpp
r1503 r1517 11 11 namespace ep_lib 12 12 { 13 14 ep_intercomm::ep_intercomm() 13 ep_comm::ep_comm(void* comm) 15 14 { 16 intercomm_rank_map = NULL; 17 local_rank_map = NULL; 18 remote_rank_map = NULL; 19 mpi_inter_comm = new ::MPI_Comm; 20 } 21 22 bool ep_intercomm::operator == (ep_intercomm right) 23 { 24 bool a = intercomm_rank_map == right.intercomm_rank_map; 25 bool b = local_rank_map == right.local_rank_map; 26 bool c = remote_rank_map == right.remote_rank_map; 27 bool d = *(static_cast< ::MPI_Comm*>(mpi_inter_comm)) == *(static_cast< ::MPI_Comm*>(right.mpi_inter_comm)); 28 bool e = size_rank_info == right.size_rank_info; 29 bool f = intercomm_tag == right.intercomm_tag; 30 return a&&b&&c&&d&&e&&f; 31 } 32 33 bool ep_intercomm::operator != (ep_intercomm right) 34 { 35 bool a = intercomm_rank_map != right.intercomm_rank_map; 36 bool b = local_rank_map != right.local_rank_map; 37 bool c = remote_rank_map != right.remote_rank_map; 38 bool d = *(static_cast< ::MPI_Comm*>(mpi_inter_comm)) != *(static_cast< ::MPI_Comm*>(right.mpi_inter_comm)); 39 bool e = size_rank_info != right.size_rank_info; 40 bool f = intercomm_tag != right.intercomm_tag; 41 return a||b||c||d||e||f; 42 } 43 44 ep_communicator::ep_communicator() 45 { 46 comm_list = NULL; 47 message_queue = NULL; 48 intercomm = NULL; 49 } 50 51 ep_message::ep_message(void* message) 52 { 53 mpi_message = new ::MPI_Message; 54 *(static_cast< ::MPI_Message*>(mpi_message)) = *(static_cast< ::MPI_Message*>(message)); 15 is_ep = false; 16 is_intercomm = false; 17 mpi_comm = static_cast< ::MPI_Comm*>(comm); 55 18 } 56 19 57 20 ep_info::ep_info(void* info) 58 21 { 59 mpi_info = new ::MPI_Info; 60 *(static_cast< ::MPI_Info*>(mpi_info)) = *(static_cast< ::MPI_Info*>(info)); 22 mpi_info = static_cast< ::MPI_Info*>(info); 61 23 } 62 63 ep_info::ep_info() 64 { 65 mpi_info = new ::MPI_Info; 66 *(static_cast< ::MPI_Info*>(mpi_info)) = *(static_cast< ::MPI_Info*>(MPI_INFO_NULL->mpi_info)); 67 } 68 24 69 25 ep_request::ep_request(void* request) 70 26 { 71 mpi_request = new ::MPI_Request; 72 *(static_cast< ::MPI_Request*>(mpi_request)) = *static_cast< ::MPI_Request*>(request); 27 mpi_request = static_cast< ::MPI_Request*>(request); 73 28 } 74 29 75 30 ep_status::ep_status(void* status) 76 31 { 77 mpi_status = new ::MPI_Status; 78 *(static_cast< ::MPI_Status*>(mpi_status)) = *static_cast< ::MPI_Status*>(status); 32 mpi_status = static_cast< ::MPI_Status*>(status); 79 33 } 34 35 /* 80 36 81 37 MPI_Aint::MPI_Aint(void* aint) … … 103 59 } 104 60 105 bool ep_communicator::operator == (ep_communicator right)106 {107 bool a = size_rank_info == right.size_rank_info;108 bool b = comm_label == right.comm_label;109 bool c = intercomm == right.intercomm;110 return a&&b&&c;111 }112 113 bool ep_communicator::operator != (ep_communicator right)114 {115 bool a = size_rank_info != right.size_rank_info;116 bool b = comm_label != right.comm_label;117 bool c = intercomm != right.intercomm;118 return a||b||c;119 }120 121 ep_comm::ep_comm()122 {123 is_ep = true;124 is_intercomm = false;125 my_buffer = NULL;126 ep_barrier = NULL;127 ep_rank_map = NULL;128 ep_comm_ptr = NULL;129 mem_bridge = NULL;130 mpi_bridge = NULL;131 mpi_comm = new ::MPI_Comm;132 }133 134 61 135 136 ep_comm::ep_comm(void* comm) 137 { 138 is_ep = false; 139 is_intercomm = false; 140 my_buffer = NULL; 141 ep_barrier = NULL; 142 ep_rank_map = NULL; 143 ep_comm_ptr = NULL; 144 mem_bridge = NULL; 145 mpi_bridge = NULL; 146 mpi_comm = new ::MPI_Comm; 147 *(static_cast< ::MPI_Comm*>(mpi_comm)) = *(static_cast< ::MPI_Comm*>(comm)); 148 } 149 62 */ 150 63 151 152 bool ep_comm::operator == (ep_comm right)153 {154 bool a = is_ep == right.is_ep;155 bool b = is_intercomm == right.is_intercomm;156 bool c = *(static_cast< ::MPI_Comm*>(mpi_comm)) == *(static_cast< ::MPI_Comm*>(right.mpi_comm));157 bool d = is_ep ? ep_comm_ptr == right.ep_comm_ptr : true;158 return a&&b&&c&&d;159 }160 161 bool ep_comm::operator != (ep_comm right)162 {163 bool a = is_ep != right.is_ep;164 bool b = is_intercomm != right.is_intercomm;165 bool c = *(static_cast< ::MPI_Comm*>(mpi_comm)) != *(static_cast< ::MPI_Comm*>(right.mpi_comm));166 bool d = is_ep ? ep_comm_ptr != right.ep_comm_ptr : true;167 return a||b||c||d;168 }169 170 bool ep_request::operator == (ep_request right)171 {172 bool b = type == right.type;173 bool c = buf == right.buf;174 bool d = ep_src == right.ep_src;175 bool e = ep_tag == right.ep_tag;176 bool f = ep_datatype == right.ep_datatype;177 return b&&c&&d&&e&&f;178 }179 64 180 65 -
XIOS/dev/branch_openmp/extern/ep_dev/main.cpp
r1515 r1517 19 19 srand (time(NULL)); 20 20 21 printf("Testing ep_lib\n");21 //printf("Testing ep_lib\n"); 22 22 int required=3, provided; 23 23 … … 32 32 MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); 33 33 34 35 34 36 #pragma omp parallel default(shared) 35 37 { … … 858 860 MPI_Comm_free(&split_comm); 859 861 860 MPI_Barrier(comm); 861 MPI_Barrier(comm); 862 862 863 MPI_Barrier(comm); 864 MPI_Barrier(comm); 865 866 MPI_Comm inter_comm_dup; 867 MPI_Comm_dup(inter_comm, &inter_comm_dup); 868 869 MPI_Barrier(comm); 870 MPI_Barrier(comm); 871 872 873 MPI_Comm_free(&inter_comm_dup); 874 875 876 MPI_Barrier(comm); 877 MPI_Barrier(comm); 878 879 MPI_Barrier(inter_comm); 863 880 MPI_Comm_free(&inter_comm); 864 881
Note: See TracChangeset
for help on using the changeset viewer.