Changeset 1500 for XIOS/dev/branch_openmp/extern/ep_dev/ep_free.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_free.cpp
r1499 r1500 9 9 int MPI_Comm_free(MPI_Comm *comm) 10 10 { 11 if(! comm->is_ep)11 if(! (*comm)->is_ep) 12 12 { 13 if( comm->mpi_comm != static_cast< ::MPI_Comm*>(MPI_COMM_NULL.mpi_comm))13 if((*comm)->mpi_comm != static_cast< ::MPI_Comm*>(MPI_COMM_NULL->mpi_comm)) 14 14 { 15 ::MPI_Comm mpi_comm = to_mpi_comm( comm->mpi_comm);15 ::MPI_Comm mpi_comm = to_mpi_comm((*comm)->mpi_comm); 16 16 17 17 ::MPI_Comm_free(&mpi_comm); … … 21 21 } 22 22 23 else if( comm->is_intercomm)23 else if((*comm)->is_intercomm) 24 24 { 25 25 return MPI_Comm_free_intercomm(comm); … … 30 30 int ep_rank_loc, num_ep; 31 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;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 34 35 35 MPI_Barrier(*comm); … … 39 39 Debug("comm is EP, mpi_comm_ptr != NULL\n"); 40 40 41 delete comm->my_buffer;41 delete (*comm)->my_buffer; 42 42 43 43 44 if( comm->ep_barrier != NULL)44 if((*comm)->ep_barrier != NULL) 45 45 { 46 comm->ep_barrier->~OMPbarrier();46 (*comm)->ep_barrier->~ep_barrier(); 47 47 Debug("ep_barrier freed\n"); 48 48 } 49 49 50 50 51 if( ! comm->rank_map->empty() )51 if( ! (*comm)->rank_map->empty() ) 52 52 { 53 comm->rank_map->clear();54 delete comm->rank_map;53 (*comm)->rank_map->clear(); 54 delete (*comm)->rank_map; 55 55 Debug("rank_map emptied\n"); 56 56 } … … 58 58 for(int i=0; i<num_ep; i++) 59 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;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 62 Debug("message queue freed\n"); 63 63 64 64 65 if( comm->ep_comm_ptr->comm_list[i].ep_comm_ptr != NULL)65 if((*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr != NULL) 66 66 { 67 delete comm->ep_comm_ptr->comm_list[i].ep_comm_ptr;67 delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr; 68 68 Debug("ep_comm_ptr freed\n"); 69 69 } 70 70 } 71 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))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 74 { 75 ::MPI_Comm mpi_comm = to_mpi_comm( comm->mpi_comm);75 ::MPI_Comm mpi_comm = to_mpi_comm((*comm)->mpi_comm); 76 76 ::MPI_Comm_free(&mpi_comm); 77 77 Debug("mpi_comm freed\n"); 78 78 } 79 79 80 if(comm != NULL) {delete[] comm->ep_comm_ptr->comm_list; Debug("comm freed\n");}80 //if(comm != NULL) {delete[] comm->ep_comm_ptr->comm_list; Debug("comm freed\n");} 81 81 82 82 } … … 93 93 int ep_rank_loc, num_ep; 94 94 95 ep_rank_loc = comm->ep_comm_ptr->size_rank_info[1].first;96 num_ep = comm->ep_comm_ptr->size_rank_info[1].second;95 ep_rank_loc = (*comm)->ep_comm_ptr->size_rank_info[1].first; 96 num_ep = (*comm)->ep_comm_ptr->size_rank_info[1].second; 97 97 98 98 //MPI_Barrier(*comm); … … 103 103 104 104 105 if( comm->ep_barrier != NULL)105 if((*comm)->ep_barrier != NULL) 106 106 { 107 comm->ep_barrier->~OMPbarrier();107 (*comm)->ep_barrier->~ep_barrier(); 108 108 Debug("ep_barrier freed\n"); 109 109 } 110 110 111 111 112 if( ! comm->rank_map->empty() )112 if( ! (*comm)->rank_map->empty() ) 113 113 { 114 comm->rank_map->clear();114 (*comm)->rank_map->clear(); 115 115 Debug("rank_map emptied\n"); 116 116 } … … 118 118 for(int i=0; i<num_ep; i++) 119 119 { 120 comm->ep_comm_ptr->comm_list[i].ep_comm_ptr->message_queue->clear();120 (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->message_queue->clear(); 121 121 Debug("message queue freed\n"); 122 122 123 123 #pragma omp critical (memory_free) 124 if( comm->ep_comm_ptr->comm_list[i].ep_comm_ptr->intercomm != NULL)124 if((*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm != NULL) 125 125 { 126 comm->ep_comm_ptr->comm_list[i].ep_comm_ptr->intercomm->local_rank_map->clear();127 comm->ep_comm_ptr->comm_list[i].ep_comm_ptr->intercomm->remote_rank_map->clear();128 comm->ep_comm_ptr->comm_list[i].ep_comm_ptr->intercomm->intercomm_rank_map->clear();126 (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm->local_rank_map->clear(); 127 (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm->remote_rank_map->clear(); 128 (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm->intercomm_rank_map->clear(); 129 129 Debug("intercomm local/remote/intercomm_rank_map emptied\n"); 130 130 } 131 131 132 if( comm->ep_comm_ptr->comm_list[i].ep_comm_ptr != NULL)132 if((*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr != NULL) 133 133 { 134 delete comm->ep_comm_ptr->comm_list[i].ep_comm_ptr;134 delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr; 135 135 Debug("ep_comm_ptr freed\n"); 136 136 } 137 137 } 138 138 139 if( comm->mpi_comm != static_cast< ::MPI_Comm*>(MPI_COMM_NULL.mpi_comm))139 if((*comm)->mpi_comm != static_cast< ::MPI_Comm*>(MPI_COMM_NULL->mpi_comm)) 140 140 { 141 ::MPI_Comm mpi_comm = to_mpi_comm( comm->mpi_comm);141 ::MPI_Comm mpi_comm = to_mpi_comm((*comm)->mpi_comm); 142 142 ::MPI_Comm_free(&mpi_comm); 143 143 Debug("mpi_comm freed\n"); 144 144 } 145 145 146 if( comm->ep_comm_ptr->intercomm->mpi_inter_comm != static_cast< ::MPI_Comm*>(MPI_COMM_NULL.mpi_comm))146 if((*comm)->ep_comm_ptr->intercomm->mpi_inter_comm != static_cast< ::MPI_Comm*>(MPI_COMM_NULL->mpi_comm)) 147 147 { 148 ::MPI_Comm mpi_comm = to_mpi_comm( comm->ep_comm_ptr->comm_list->ep_comm_ptr->intercomm->mpi_inter_comm);148 ::MPI_Comm mpi_comm = to_mpi_comm((*comm)->ep_comm_ptr->comm_list[0]->ep_comm_ptr->intercomm->mpi_inter_comm); 149 149 ::MPI_Comm_free(&mpi_comm); 150 150 Debug("mpi_intercomm freed\n"); 151 151 } 152 152 153 if(comm != NULL) {delete[] comm->ep_comm_ptr->comm_list; Debug("comm freed\n");}153 if(comm != NULL) {delete[] (*comm)->ep_comm_ptr->comm_list; Debug("comm freed\n");} 154 154 155 155 }
Note: See TracChangeset
for help on using the changeset viewer.