Ignore:
Timestamp:
02/17/17 17:55:37 (7 years ago)
Author:
yushan
Message:

ep_lib namespace specified when netcdf involved

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_free.cpp

    r1037 r1053  
    1010  int MPI_Comm_free(MPI_Comm *comm) 
    1111  { 
    12     //return 0; 
    13      
    14     if(comm == NULL) return 0; 
     12    //if(comm == NULL) return 0; 
    1513 
    1614    MPI_Barrier(*comm); 
     
    1917    if(! comm->is_ep) 
    2018    { 
    21       if(comm->mpi_comm) 
     19      if(comm->mpi_comm != MPI_COMM_NULL_STD) 
    2220      { 
    2321        ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm>(comm->mpi_comm); 
     
    3129    else 
    3230    { 
    33       if(! comm->mpi_comm) return 0; 
     31      if(comm->mpi_comm == MPI_COMM_NULL_STD ) return 0; 
    3432 
    3533      int ep_rank, ep_rank_loc, mpi_rank; 
     
    4745 
    4846      #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) 
    5048      { 
    5149        if(comm->ep_comm_ptr->intercomm->local_rank_map) comm->ep_comm_ptr->intercomm->local_rank_map->clear(); 
     
    6260 
    6361/* 
    64         if(comm->my_buffer) 
     62        if(comm->my_buffer != NULL) 
    6563        { 
    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"); 
    7270        } 
    7371*/ 
    74         if(comm->ep_barrier) 
     72        if(comm->ep_barrier != NULL) 
    7573        { 
    7674          comm->ep_barrier->~OMPbarrier(); 
     
    7977 
    8078 
    81         if(comm->rank_map) 
     79        if(comm->rank_map != NULL) 
    8280        { 
    8381          comm->rank_map->clear(); 
     
    8684 
    8785 
    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) 
    8987        { 
    9088          ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm>(comm->ep_comm_ptr->intercomm->mpi_inter_comm); 
    9189 
    9290          ::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; 
    9492          Debug("mpi_intercomm freed\n"); 
    9593        } 
     
    9997        for(int i=0; i<num_ep; i++) 
    10098        { 
    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) 
    102100          { 
    103101            comm->ep_comm_ptr->comm_list[i].ep_comm_ptr->message_queue->clear(); 
     
    105103          } 
    106104 
    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) 
    108106          { 
    109107            delete comm->ep_comm_ptr->comm_list[i].ep_comm_ptr; 
     
    112110        } 
    113111 
    114         if(comm->mpi_comm) 
     112        if(comm->mpi_comm != MPI_COMM_NULL_STD) 
    115113        { 
    116114          ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm>(comm->mpi_comm); 
    117           #ifdef _serialized 
    118           #pragma omp critical (_mpi_call) 
    119           #endif // _serialized 
    120115          ::MPI_Comm_free(&mpi_comm); 
    121           comm->mpi_comm = NULL; 
     116          //comm->mpi_comm = NULL; 
    122117//          printf("label = %d, mpi_comm freed\n", comm->ep_comm_ptr->comm_label); 
    123118        } 
    124119 
    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");} 
    126121 
    127122      } 
Note: See TracChangeset for help on using the changeset viewer.