Changeset 1539 for XIOS/dev/branch_openmp/extern/src_ep_dev/ep_free.cpp
- Timestamp:
- 06/12/18 11:54:13 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/extern/src_ep_dev/ep_free.cpp
r1533 r1539 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 … … 28 18 { 29 19 Debug("MPI_Comm_free with MPI\n"); 30 31 20 return ::MPI_Comm_free(to_mpi_comm_ptr((*comm)->mpi_comm)); 32 33 21 } 34 22 35 int MPI_Comm_free_ intracomm(MPI_Comm *comm)23 int MPI_Comm_free_endpoint(MPI_Comm *comm) 36 24 { 37 25 Debug("MPI_Comm_free with EP_intracomm\n"); … … 42 30 num_ep = (*comm)->ep_comm_ptr->size_rank_info[1].second; 43 31 44 MPI_Barrier (*comm);32 MPI_Barrier_local(*comm); 45 33 46 34 if(ep_rank_loc == 0) 47 35 { 36 37 if((*comm)->is_intercomm) 38 { 39 for(int i=0; i<num_ep; i++) 40 { 41 (*comm)->ep_comm_ptr->comm_list[i]->inter_rank_map->clear(); 42 #ifdef _showinfo 43 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); 44 #endif 45 delete (*comm)->ep_comm_ptr->comm_list[i]->inter_rank_map; 46 } 47 } 48 49 48 50 49 51 #ifdef _showinfo … … 103 105 104 106 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 return 0;121 MPI_Barrier(*comm);122 123 if(ep_rank_loc == 0)124 {125 (*comm)->ep_comm_ptr->intercomm->intercomm_rank_map->clear();126 #ifdef _showinfo127 printf("delete (*comm)->ep_comm_ptr->intercomm->intercomm_rank_map = %p\n", (*comm)->ep_comm_ptr->intercomm->intercomm_rank_map);128 #endif129 delete (*comm)->ep_comm_ptr->intercomm->intercomm_rank_map;130 131 (*comm)->ep_comm_ptr->intercomm->local_rank_map->clear();132 #ifdef _showinfo133 printf("delete (*comm)->ep_comm_ptr->intercomm->local_rank_map = %p\n", (*comm)->ep_comm_ptr->intercomm->local_rank_map);134 #endif135 delete (*comm)->ep_comm_ptr->intercomm->local_rank_map;136 }137 138 if(newcomm_ep_rank_loc == 0)139 {140 141 #ifdef _showinfo142 printf("delete (*comm)->my_buffer = %p\n", (*comm)->my_buffer);143 #endif144 delete (*comm)->my_buffer;145 146 147 148 #ifdef _showinfo149 printf("delete (*comm)->ep_barrier = %p\n", (*comm)->ep_barrier);150 #endif151 delete (*comm)->ep_barrier;152 153 154 (*comm)->ep_rank_map->clear();155 #ifdef _showinfo156 printf("delete (*comm)->ep_rank_map = %p\n", (*comm)->ep_rank_map);157 #endif158 delete (*comm)->ep_rank_map;159 160 #ifdef _showinfo161 printf("delete (*comm)->ep_comm_ptr->intercomm->mpi_inter_comm = %p\n", (*comm)->ep_comm_ptr->intercomm->mpi_inter_comm);162 #endif163 ::MPI_Comm_free(to_mpi_comm_ptr((*comm)->ep_comm_ptr->intercomm->mpi_inter_comm));164 165 for(int i=0; i<newcomm_num_ep; i++)166 {167 (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->message_queue->clear();168 #ifdef _showinfo169 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);170 #endif171 delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->message_queue;172 173 #ifdef _showinfo174 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);175 #endif176 delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm;177 178 179 #ifdef _showinfo180 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);181 #endif182 delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr;183 184 185 #ifdef _showinfo186 printf("delete (*comm)->ep_comm_ptr->comm_list[%d] = %p\n", i, (*comm)->ep_comm_ptr->comm_list[i]);187 #endif188 delete (*comm)->ep_comm_ptr->comm_list[i];189 190 }191 192 #ifdef _showinfo193 printf("delete (*comm)->mpi_comm = %p\n", (*comm)->mpi_comm);194 #endif195 ::MPI_Comm_free(to_mpi_comm_ptr((*comm)->mpi_comm));196 197 #ifdef _showinfo198 printf("delete (*comm)->ep_comm_ptr->comm_list = %p\n", (*comm)->ep_comm_ptr->comm_list);199 #endif200 delete[] (*comm)->ep_comm_ptr->comm_list;201 }202 }203 204 205 107 } 206 108
Note: See TracChangeset
for help on using the changeset viewer.