Changeset 1053 for XIOS/dev/branch_yushan/extern/src_ep_dev/ep_free.cpp
- Timestamp:
- 02/17/17 17:55:37 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_yushan/extern/src_ep_dev/ep_free.cpp
r1037 r1053 10 10 int MPI_Comm_free(MPI_Comm *comm) 11 11 { 12 //return 0; 13 14 if(comm == NULL) return 0; 12 //if(comm == NULL) return 0; 15 13 16 14 MPI_Barrier(*comm); … … 19 17 if(! comm->is_ep) 20 18 { 21 if(comm->mpi_comm )19 if(comm->mpi_comm != MPI_COMM_NULL_STD) 22 20 { 23 21 ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm>(comm->mpi_comm); … … 31 29 else 32 30 { 33 if( ! comm->mpi_comm) return 0;31 if(comm->mpi_comm == MPI_COMM_NULL_STD ) return 0; 34 32 35 33 int ep_rank, ep_rank_loc, mpi_rank; … … 47 45 48 46 #pragma omp critical (memory_free) 49 if(comm->is_intercomm && comm->ep_comm_ptr->intercomm )47 if(comm->is_intercomm && comm->ep_comm_ptr->intercomm != NULL) 50 48 { 51 49 if(comm->ep_comm_ptr->intercomm->local_rank_map) comm->ep_comm_ptr->intercomm->local_rank_map->clear(); … … 62 60 63 61 /* 64 if(comm->my_buffer )62 if(comm->my_buffer != NULL) 65 63 { 66 if(comm->my_buffer->buf_int ) delete[] comm->my_buffer->buf_int; Debug("buf_int freed\n");67 if(comm->my_buffer->buf_float ) delete[] comm->my_buffer->buf_float; Debug("buf_float freed\n");68 if(comm->my_buffer->buf_double ) delete[] comm->my_buffer->buf_double; Debug("buf_double freed\n");69 if(comm->my_buffer->buf_long ) delete[] comm->my_buffer->buf_long; Debug("buf_long freed\n");70 if(comm->my_buffer->buf_ulong ) delete[] comm->my_buffer->buf_ulong; Debug("buf_ulong freed\n");71 if(comm->my_buffer->buf_char ) delete[] comm->my_buffer->buf_char; Debug("buf_char freed\n");64 if(comm->my_buffer->buf_int != NULL) delete[] comm->my_buffer->buf_int; Debug("buf_int freed\n"); 65 if(comm->my_buffer->buf_float != NULL) delete[] comm->my_buffer->buf_float; Debug("buf_float freed\n"); 66 if(comm->my_buffer->buf_double != NULL) delete[] comm->my_buffer->buf_double; Debug("buf_double freed\n"); 67 if(comm->my_buffer->buf_long != NULL) delete[] comm->my_buffer->buf_long; Debug("buf_long freed\n"); 68 if(comm->my_buffer->buf_ulong != NULL) delete[] comm->my_buffer->buf_ulong; Debug("buf_ulong freed\n"); 69 if(comm->my_buffer->buf_char != NULL) delete[] comm->my_buffer->buf_char; Debug("buf_char freed\n"); 72 70 } 73 71 */ 74 if(comm->ep_barrier )72 if(comm->ep_barrier != NULL) 75 73 { 76 74 comm->ep_barrier->~OMPbarrier(); … … 79 77 80 78 81 if(comm->rank_map )79 if(comm->rank_map != NULL) 82 80 { 83 81 comm->rank_map->clear(); … … 86 84 87 85 88 if(comm->is_intercomm && comm->ep_comm_ptr->intercomm->mpi_inter_comm )86 if(comm->is_intercomm && comm->ep_comm_ptr->intercomm->mpi_inter_comm != MPI_COMM_NULL_STD) 89 87 { 90 88 ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm>(comm->ep_comm_ptr->intercomm->mpi_inter_comm); 91 89 92 90 ::MPI_Comm_free(&mpi_comm); 93 comm->ep_comm_ptr->intercomm->mpi_inter_comm = NULL;91 //comm->ep_comm_ptr->intercomm->mpi_inter_comm = NULL; 94 92 Debug("mpi_intercomm freed\n"); 95 93 } … … 99 97 for(int i=0; i<num_ep; i++) 100 98 { 101 if(comm->ep_comm_ptr->comm_list[i].ep_comm_ptr->message_queue )99 if(comm->ep_comm_ptr->comm_list[i].ep_comm_ptr->message_queue != NULL) 102 100 { 103 101 comm->ep_comm_ptr->comm_list[i].ep_comm_ptr->message_queue->clear(); … … 105 103 } 106 104 107 if(comm->ep_comm_ptr->comm_list[i].ep_comm_ptr )105 if(comm->ep_comm_ptr->comm_list[i].ep_comm_ptr != NULL) 108 106 { 109 107 delete comm->ep_comm_ptr->comm_list[i].ep_comm_ptr; … … 112 110 } 113 111 114 if(comm->mpi_comm )112 if(comm->mpi_comm != MPI_COMM_NULL_STD) 115 113 { 116 114 ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm>(comm->mpi_comm); 117 #ifdef _serialized118 #pragma omp critical (_mpi_call)119 #endif // _serialized120 115 ::MPI_Comm_free(&mpi_comm); 121 comm->mpi_comm = NULL;116 //comm->mpi_comm = NULL; 122 117 // printf("label = %d, mpi_comm freed\n", comm->ep_comm_ptr->comm_label); 123 118 } 124 119 125 if(comm ) {delete[] comm->ep_comm_ptr->comm_list; Debug("comm freed\n");}120 if(comm != NULL) {delete[] comm->ep_comm_ptr->comm_list; Debug("comm freed\n");} 126 121 127 122 }
Note: See TracChangeset
for help on using the changeset viewer.