Changeset 1527 for XIOS/dev/branch_openmp/extern/ep_dev/ep_free.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_free.cpp
r1525 r1527 9 9 int MPI_Comm_free(MPI_Comm *comm) 10 10 { 11 if(! (*comm)->is_ep) 12 { 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 } 11 if(! (*comm)->is_ep) return MPI_Comm_free_mpi(comm); 12 else return MPI_Comm_free_endpoint(comm); 23 13 } 24 14 … … 33 23 } 34 24 35 int MPI_Comm_free_ intracomm(MPI_Comm *comm)25 int MPI_Comm_free_endpoint(MPI_Comm *comm) 36 26 { 37 27 Debug("MPI_Comm_free with EP_intracomm\n"); … … 40 30 41 31 ep_rank_loc = (*comm)->ep_comm_ptr->size_rank_info[1].first; 32 int ep_rank = (*comm)->ep_comm_ptr->size_rank_info[0].first; 42 33 num_ep = (*comm)->ep_comm_ptr->size_rank_info[1].second; 43 34 … … 46 37 if(ep_rank_loc == 0) 47 38 { 39 40 if((*comm)->is_intercomm) 41 { 42 for(int i=0; i<num_ep; i++) 43 { 44 (*comm)->ep_comm_ptr->comm_list[i]->inter_rank_map->clear(); 45 #ifdef _showinfo 46 printf("delete (*comm)->ep_comm_ptr->comm_list[%d]->inter_rank_map = %p\n", i, (*comm)->ep_comm_ptr->comm_list[i]->inter_rank_map); 47 #endif 48 delete (*comm)->ep_comm_ptr->comm_list[i]->inter_rank_map; 49 } 50 } 51 52 48 53 49 54 #ifdef _showinfo … … 103 108 104 109 105 int MPI_Comm_free2(MPI_Comm *comm)106 {107 Debug("MPI_Comm_free with EP_intracomm\n");108 109 int ep_rank_loc, num_ep;110 111 ep_rank_loc = (*comm)->ep_comm_ptr->size_rank_info[1].first;112 num_ep = (*comm)->ep_comm_ptr->size_rank_info[1].second;113 114 MPI_Barrier2(*comm);115 116 if(ep_rank_loc == 0)117 {118 119 #ifdef _showinfo120 printf("delete (*comm)->my_buffer = %p\n", (*comm)->my_buffer);121 #endif122 delete (*comm)->my_buffer;123 124 125 126 #ifdef _showinfo127 printf("delete (*comm)->ep_barrier = %p\n", (*comm)->ep_barrier);128 #endif129 delete (*comm)->ep_barrier;130 131 132 133 (*comm)->ep_rank_map->clear();134 #ifdef _showinfo135 printf("delete (*comm)->ep_rank_map = %p\n", (*comm)->ep_rank_map);136 #endif137 delete (*comm)->ep_rank_map;138 139 140 for(int i=0; i<num_ep; i++)141 {142 if((*comm)->is_intercomm)143 {144 (*comm)->ep_comm_ptr->comm_list[i]->inter_rank_map->clear();145 #ifdef _showinfo146 printf("delete (*comm)->ep_comm_ptr->comm_list[%d]->inter_rank_map = %p\n", i, (*comm)->ep_comm_ptr->comm_list[i]->inter_rank_map);147 #endif148 delete (*comm)->ep_comm_ptr->comm_list[i]->inter_rank_map;149 }150 151 (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->message_queue->clear();152 #ifdef _showinfo153 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);154 #endif155 delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->message_queue;156 157 158 #ifdef _showinfo159 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);160 #endif161 delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr;162 163 164 #ifdef _showinfo165 printf("delete (*comm)->ep_comm_ptr->comm_list[%d] = %p\n", i, (*comm)->ep_comm_ptr->comm_list[i]);166 #endif167 delete (*comm)->ep_comm_ptr->comm_list[i];168 }169 170 #ifdef _showinfo171 printf("delete (*comm)->mpi_comm = %p\n", (*comm)->mpi_comm);172 #endif173 ::MPI_Comm_free(to_mpi_comm_ptr((*comm)->mpi_comm));174 175 #ifdef _showinfo176 printf("delete (*comm)->ep_comm_ptr->comm_list = %p\n", (*comm)->ep_comm_ptr->comm_list);177 #endif178 delete[] (*comm)->ep_comm_ptr->comm_list;179 }180 }181 182 183 184 int MPI_Comm_free_intercomm(MPI_Comm *comm)185 {186 int ep_rank;187 MPI_Comm_rank(*comm, &ep_rank);188 int ep_rank_loc = (*comm)->ep_comm_ptr->size_rank_info[1].first;189 int num_ep = (*comm)->ep_comm_ptr->size_rank_info[1].second;190 191 int newcomm_ep_rank =(*comm)->ep_comm_ptr->intercomm->size_rank_info[0].first;192 int newcomm_ep_rank_loc = (*comm)->ep_comm_ptr->intercomm->size_rank_info[1].first;193 int newcomm_num_ep = (*comm)->ep_comm_ptr->intercomm->size_rank_info[1].second;194 195 MPI_Barrier(*comm);196 197 if(ep_rank_loc == 0)198 {199 (*comm)->ep_comm_ptr->intercomm->intercomm_rank_map->clear();200 #ifdef _showinfo201 printf("delete (*comm)->ep_comm_ptr->intercomm->intercomm_rank_map = %p\n", (*comm)->ep_comm_ptr->intercomm->intercomm_rank_map);202 #endif203 delete (*comm)->ep_comm_ptr->intercomm->intercomm_rank_map;204 205 (*comm)->ep_comm_ptr->intercomm->local_rank_map->clear();206 #ifdef _showinfo207 printf("delete (*comm)->ep_comm_ptr->intercomm->local_rank_map = %p\n", (*comm)->ep_comm_ptr->intercomm->local_rank_map);208 #endif209 delete (*comm)->ep_comm_ptr->intercomm->local_rank_map;210 }211 212 if(newcomm_ep_rank_loc == 0)213 {214 215 #ifdef _showinfo216 printf("delete (*comm)->my_buffer = %p\n", (*comm)->my_buffer);217 #endif218 delete (*comm)->my_buffer;219 220 221 222 #ifdef _showinfo223 printf("delete (*comm)->ep_barrier = %p\n", (*comm)->ep_barrier);224 #endif225 delete (*comm)->ep_barrier;226 227 228 (*comm)->ep_rank_map->clear();229 #ifdef _showinfo230 printf("delete (*comm)->ep_rank_map = %p\n", (*comm)->ep_rank_map);231 #endif232 delete (*comm)->ep_rank_map;233 234 #ifdef _showinfo235 printf("delete (*comm)->ep_comm_ptr->intercomm->mpi_inter_comm = %p\n", (*comm)->ep_comm_ptr->intercomm->mpi_inter_comm);236 #endif237 ::MPI_Comm_free(to_mpi_comm_ptr((*comm)->ep_comm_ptr->intercomm->mpi_inter_comm));238 239 for(int i=0; i<newcomm_num_ep; i++)240 {241 (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->message_queue->clear();242 #ifdef _showinfo243 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);244 #endif245 delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->message_queue;246 247 #ifdef _showinfo248 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);249 #endif250 delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm;251 252 253 #ifdef _showinfo254 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);255 #endif256 delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr;257 258 259 #ifdef _showinfo260 printf("delete (*comm)->ep_comm_ptr->comm_list[%d] = %p\n", i, (*comm)->ep_comm_ptr->comm_list[i]);261 #endif262 delete (*comm)->ep_comm_ptr->comm_list[i];263 264 }265 266 #ifdef _showinfo267 printf("delete (*comm)->mpi_comm = %p\n", (*comm)->mpi_comm);268 #endif269 ::MPI_Comm_free(to_mpi_comm_ptr((*comm)->mpi_comm));270 271 #ifdef _showinfo272 printf("delete (*comm)->ep_comm_ptr->comm_list = %p\n", (*comm)->ep_comm_ptr->comm_list);273 #endif274 delete[] (*comm)->ep_comm_ptr->comm_list;275 }276 }277 278 279 110 } 280 111
Note: See TracChangeset
for help on using the changeset viewer.