Ignore:
Timestamp:
06/12/18 11:54:13 (6 years ago)
Author:
yushan
Message:

update intercomm_merge and remove redundant files

File:
1 edited

Legend:

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

    r1533 r1539  
    99  int MPI_Comm_free(MPI_Comm *comm) 
    1010  { 
    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); 
    2313  } 
    2414 
     
    2818  { 
    2919    Debug("MPI_Comm_free with MPI\n"); 
    30  
    3120    return ::MPI_Comm_free(to_mpi_comm_ptr((*comm)->mpi_comm)); 
    32      
    3321  } 
    3422 
    35   int MPI_Comm_free_intracomm(MPI_Comm *comm) 
     23  int MPI_Comm_free_endpoint(MPI_Comm *comm) 
    3624  { 
    3725    Debug("MPI_Comm_free with EP_intracomm\n"); 
     
    4230    num_ep = (*comm)->ep_comm_ptr->size_rank_info[1].second; 
    4331 
    44     MPI_Barrier(*comm); 
     32    MPI_Barrier_local(*comm); 
    4533 
    4634    if(ep_rank_loc == 0) 
    4735    { 
     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 
    4850 
    4951#ifdef _showinfo 
     
    103105 
    104106 
    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 _showinfo 
    127       printf("delete (*comm)->ep_comm_ptr->intercomm->intercomm_rank_map = %p\n", (*comm)->ep_comm_ptr->intercomm->intercomm_rank_map); 
    128 #endif 
    129       delete (*comm)->ep_comm_ptr->intercomm->intercomm_rank_map; 
    130  
    131       (*comm)->ep_comm_ptr->intercomm->local_rank_map->clear(); 
    132 #ifdef _showinfo 
    133       printf("delete (*comm)->ep_comm_ptr->intercomm->local_rank_map = %p\n", (*comm)->ep_comm_ptr->intercomm->local_rank_map); 
    134 #endif 
    135       delete (*comm)->ep_comm_ptr->intercomm->local_rank_map; 
    136     } 
    137  
    138     if(newcomm_ep_rank_loc == 0) 
    139     { 
    140  
    141 #ifdef _showinfo 
    142       printf("delete (*comm)->my_buffer = %p\n", (*comm)->my_buffer); 
    143 #endif 
    144       delete (*comm)->my_buffer; 
    145  
    146  
    147        
    148 #ifdef _showinfo         
    149       printf("delete (*comm)->ep_barrier = %p\n", (*comm)->ep_barrier); 
    150 #endif 
    151       delete (*comm)->ep_barrier; 
    152        
    153  
    154       (*comm)->ep_rank_map->clear(); 
    155 #ifdef _showinfo 
    156       printf("delete (*comm)->ep_rank_map = %p\n", (*comm)->ep_rank_map); 
    157 #endif 
    158       delete (*comm)->ep_rank_map; 
    159        
    160 #ifdef _showinfo 
    161       printf("delete (*comm)->ep_comm_ptr->intercomm->mpi_inter_comm = %p\n", (*comm)->ep_comm_ptr->intercomm->mpi_inter_comm); 
    162 #endif 
    163       ::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 _showinfo 
    169         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 #endif 
    171         delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->message_queue; 
    172  
    173 #ifdef _showinfo 
    174         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 #endif 
    176         delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->intercomm;         
    177            
    178  
    179 #ifdef _showinfo 
    180         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 #endif 
    182         delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr; 
    183  
    184  
    185 #ifdef _showinfo 
    186         printf("delete (*comm)->ep_comm_ptr->comm_list[%d] = %p\n", i, (*comm)->ep_comm_ptr->comm_list[i]); 
    187 #endif 
    188         delete (*comm)->ep_comm_ptr->comm_list[i]; 
    189  
    190       } 
    191  
    192 #ifdef _showinfo 
    193       printf("delete (*comm)->mpi_comm = %p\n", (*comm)->mpi_comm); 
    194 #endif 
    195       ::MPI_Comm_free(to_mpi_comm_ptr((*comm)->mpi_comm)); 
    196        
    197 #ifdef _showinfo 
    198       printf("delete (*comm)->ep_comm_ptr->comm_list = %p\n", (*comm)->ep_comm_ptr->comm_list); 
    199 #endif 
    200       delete[] (*comm)->ep_comm_ptr->comm_list; 
    201     } 
    202   } 
    203  
    204  
    205107} 
    206108 
Note: See TracChangeset for help on using the changeset viewer.