Changeset 1525 for XIOS/dev


Ignore:
Timestamp:
06/07/18 19:39:07 (6 years ago)
Author:
yushan
Message:

save dev : intercomm_create via intracomm. To do : modif related intercomm communication routines, barrier, free, rank, size...

Location:
XIOS/dev/branch_openmp/extern/ep_dev
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_barrier.cpp

    r1517 r1525  
    2222 
    2323  int MPI_Barrier_intracomm(MPI_Comm comm) 
     24  { 
     25    int ep_rank_loc = comm->ep_comm_ptr->size_rank_info[1].first; 
     26 
     27    MPI_Barrier_local(comm); 
     28 
     29    if(ep_rank_loc == 0) 
     30    { 
     31      ::MPI_Comm mpi_comm = to_mpi_comm(comm->mpi_comm); 
     32 
     33      ::MPI_Barrier(mpi_comm); 
     34    } 
     35 
     36    MPI_Barrier_local(comm); 
     37 
     38    return 0; 
     39  } 
     40 
     41  int MPI_Barrier2(MPI_Comm comm) 
    2442  { 
    2543    int ep_rank_loc = comm->ep_comm_ptr->size_rank_info[1].first; 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_comm.hpp

    r1517 r1525  
    1010typedef std::vector< std::pair<int, int> > RANK_MAP;  // at(ep_rank) = <ep_rank_local, mpi_rank> 
    1111typedef std::map<int, std::pair<int, int> > EP_RANK_MAP;  // key(ep_rank) = <ep_rank_local, mpi_rank> 
    12 //typedef std::vector<std::pair< std::pair<int, int>, std::pair<int, int> > > INTERCOMM_RANK_MAP; 
    1312typedef std::list<ep_lib::MPI_Message > Message_list; 
     13typedef std::map<int, int > INTER_RANK_MAP; 
    1414 
    1515namespace ep_lib 
     
    5454    EP_RANK_MAP   *ep_rank_map;      // for intercomm : = ep_rank_map of newcomm 
    5555     
    56  
     56    INTER_RANK_MAP *inter_rank_map; 
    5757 
    5858    void* mpi_comm; 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_free.cpp

    r1517 r1525  
    103103 
    104104 
    105  
     105  int MPI_Comm_free2(MPI_Comm *comm) 
     106  { 
     107    Debug("MPI_Comm_free with EP_intracomm\n"); 
     108 
     109    int ep_rank_loc, num_ep; 
     110 
     111    ep_rank_loc = (*comm)->ep_comm_ptr->size_rank_info[1].first; 
     112    num_ep = (*comm)->ep_comm_ptr->size_rank_info[1].second; 
     113 
     114    MPI_Barrier2(*comm); 
     115 
     116    if(ep_rank_loc == 0) 
     117    { 
     118 
     119#ifdef _showinfo 
     120      printf("delete (*comm)->my_buffer = %p\n", (*comm)->my_buffer); 
     121#endif 
     122      delete (*comm)->my_buffer; 
     123 
     124 
     125       
     126#ifdef _showinfo         
     127      printf("delete (*comm)->ep_barrier = %p\n", (*comm)->ep_barrier); 
     128#endif 
     129      delete (*comm)->ep_barrier; 
     130       
     131 
     132 
     133      (*comm)->ep_rank_map->clear(); 
     134#ifdef _showinfo 
     135      printf("delete (*comm)->ep_rank_map = %p\n", (*comm)->ep_rank_map); 
     136#endif 
     137      delete (*comm)->ep_rank_map; 
     138       
     139 
     140      for(int i=0; i<num_ep; i++) 
     141      { 
     142        if((*comm)->is_intercomm) 
     143        { 
     144          (*comm)->ep_comm_ptr->comm_list[i]->inter_rank_map->clear(); 
     145#ifdef _showinfo 
     146          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); 
     147#endif 
     148          delete (*comm)->ep_comm_ptr->comm_list[i]->inter_rank_map; 
     149        } 
     150 
     151        (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->message_queue->clear(); 
     152#ifdef _showinfo 
     153        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); 
     154#endif 
     155        delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr->message_queue; 
     156           
     157 
     158#ifdef _showinfo 
     159        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); 
     160#endif 
     161        delete (*comm)->ep_comm_ptr->comm_list[i]->ep_comm_ptr; 
     162 
     163 
     164#ifdef _showinfo 
     165        printf("delete (*comm)->ep_comm_ptr->comm_list[%d] = %p\n", i, (*comm)->ep_comm_ptr->comm_list[i]); 
     166#endif 
     167        delete (*comm)->ep_comm_ptr->comm_list[i]; 
     168      } 
     169 
     170#ifdef _showinfo 
     171      printf("delete (*comm)->mpi_comm = %p\n", (*comm)->mpi_comm); 
     172#endif 
     173      ::MPI_Comm_free(to_mpi_comm_ptr((*comm)->mpi_comm)); 
     174       
     175#ifdef _showinfo 
     176      printf("delete (*comm)->ep_comm_ptr->comm_list = %p\n", (*comm)->ep_comm_ptr->comm_list); 
     177#endif 
     178      delete[] (*comm)->ep_comm_ptr->comm_list; 
     179    } 
     180  } 
    106181 
    107182 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_init.cpp

    r1517 r1525  
    22#include <mpi.h> 
    33#include "ep_declaration.hpp" 
     4#include "ep_mpi.hpp" 
    45 
     6extern MPI_Group MPI_GROUP_WORLD; 
    57 
    68namespace ep_lib 
     
    1618    { 
    1719      ::MPI_Init_thread(argc, argv, required, provided); 
     20      ::MPI_Comm_group(to_mpi_comm(MPI_COMM_WORLD->mpi_comm), &MPI_GROUP_WORLD); 
    1821    } 
    1922  } 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_intercomm.cpp

    r1515 r1525  
    66using namespace std; 
    77 
     8extern std::map<std::pair<int, int>, MPI_Group* > * tag_group_map; 
     9 
     10extern std::map<int, std::pair<ep_lib::MPI_Comm*, std::pair<int, int> > > * tag_comm_map; 
     11 
     12extern MPI_Group MPI_GROUP_WORLD; 
     13 
    814namespace ep_lib 
    915{ 
    10   int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm *newintercomm) 
     16  int MPI_Intercomm_create2(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm *newintercomm) 
    1117  { 
    1218    assert(local_comm->is_ep); 
     
    2228    mpi_size = local_comm->ep_comm_ptr->size_rank_info[2].second; 
    2329 
     30    int world_rank_and_num_ep[2]; 
     31    MPI_Comm_rank(MPI_COMM_WORLD, &world_rank_and_num_ep[0]); 
     32    world_rank_and_num_ep[1] = num_ep; 
     33 
     34    int remote_mpi_size; 
     35    int remote_ep_size; 
     36 
     37    int *local_world_rank_and_num_ep; 
     38    int *remote_world_rank_and_num_ep; 
     39    int *summed_world_rank_and_num_ep; 
     40 
     41 
     42    bool is_leader = ep_rank==local_leader? true : false; 
     43    bool is_local_leader = is_leader? true: (ep_rank_loc==0 && mpi_rank!=local_comm->ep_rank_map->at(local_leader).second ? true : false); 
     44    bool priority; 
     45 
     46    if(is_leader) 
     47    { 
     48      int leader_mpi_rank_in_peer; 
     49      MPI_Comm_rank(peer_comm, &leader_mpi_rank_in_peer); 
     50      if(leader_mpi_rank_in_peer == remote_leader)  
     51      { 
     52        printf("same leader in peer_comm\n"); 
     53        exit(1); 
     54      } 
     55      priority = leader_mpi_rank_in_peer<remote_leader? true : false; 
     56    } 
     57 
     58 
     59    MPI_Bcast(&priority, 1, MPI_INT, local_leader, local_comm); 
     60 
     61    if(is_local_leader) 
     62    { 
     63      local_world_rank_and_num_ep = new int[2*mpi_size]; 
     64      ::MPI_Allgather(world_rank_and_num_ep, 2, to_mpi_type(MPI_INT), local_world_rank_and_num_ep, 2, to_mpi_type(MPI_INT), to_mpi_comm(local_comm->mpi_comm)); 
     65    } 
     66 
     67     
     68     
     69    if(is_leader) 
     70    { 
     71      MPI_Request request; 
     72      MPI_Status status; 
     73 
     74      if(priority) 
     75      { 
     76        MPI_Isend(&mpi_size, 1, MPI_INT, remote_leader, tag, peer_comm, &request); 
     77        MPI_Wait(&request, &status); 
     78        
     79        MPI_Irecv(&remote_mpi_size, 1, MPI_INT, remote_leader, tag, peer_comm, &request); 
     80        MPI_Wait(&request, &status); 
     81 
     82        MPI_Isend(&ep_size, 1, MPI_INT, remote_leader, tag, peer_comm, &request); 
     83        MPI_Wait(&request, &status); 
     84        
     85        MPI_Irecv(&remote_ep_size, 1, MPI_INT, remote_leader, tag, peer_comm, &request); 
     86        MPI_Wait(&request, &status); 
     87      } 
     88      else 
     89      { 
     90        MPI_Irecv(&remote_mpi_size, 1, MPI_INT, remote_leader, tag, peer_comm, &request); 
     91        MPI_Wait(&request, &status); 
     92           
     93        MPI_Isend(&mpi_size, 1, MPI_INT, remote_leader, tag, peer_comm, &request); 
     94        MPI_Wait(&request, &status); 
     95 
     96        MPI_Irecv(&remote_ep_size, 1, MPI_INT, remote_leader, tag, peer_comm, &request); 
     97        MPI_Wait(&request, &status); 
     98           
     99        MPI_Isend(&ep_size, 1, MPI_INT, remote_leader, tag, peer_comm, &request); 
     100        MPI_Wait(&request, &status); 
     101      } 
     102    } 
     103 
     104    MPI_Bcast(&remote_mpi_size, 1, MPI_INT, local_leader, local_comm); 
     105    MPI_Bcast(&remote_ep_size, 1, MPI_INT, local_leader, local_comm); 
     106 
     107    remote_world_rank_and_num_ep = new int[2*remote_mpi_size]; 
     108 
     109 
     110    if(is_leader) 
     111    { 
     112      MPI_Request request; 
     113      MPI_Status status; 
     114 
     115      if(priority) 
     116      { 
     117        MPI_Isend(local_world_rank_and_num_ep, 2*mpi_size, MPI_INT, remote_leader, tag, peer_comm, &request); 
     118        MPI_Wait(&request, &status); 
     119        
     120        MPI_Irecv(remote_world_rank_and_num_ep, 2*remote_mpi_size, MPI_INT, remote_leader, tag, peer_comm, &request); 
     121        MPI_Wait(&request, &status); 
     122      } 
     123      else 
     124      { 
     125        MPI_Irecv(remote_world_rank_and_num_ep, 2*remote_mpi_size, MPI_INT, remote_leader, tag, peer_comm, &request); 
     126        MPI_Wait(&request, &status); 
     127           
     128        MPI_Isend(local_world_rank_and_num_ep, 2*mpi_size, MPI_INT, remote_leader, tag, peer_comm, &request); 
     129        MPI_Wait(&request, &status); 
     130      } 
     131    } 
     132 
     133     
     134    MPI_Bcast(remote_world_rank_and_num_ep, 2*remote_mpi_size, MPI_INT, local_leader, local_comm); 
     135     
     136 
     137 
     138    bool is_new_leader  = is_local_leader; 
     139 
     140    if(is_local_leader && !priority) 
     141    { 
     142      for(int i=0; i<remote_mpi_size; i++) 
     143      { 
     144        if(world_rank_and_num_ep[0] == remote_world_rank_and_num_ep[2*i]) 
     145        { 
     146          is_new_leader = false; 
     147          break; 
     148        } 
     149      } 
     150    }  
     151     
     152 
     153    ::MPI_Group *empty_group; 
     154    ::MPI_Group *local_group; 
     155    ::MPI_Group union_group; 
     156 
     157    if(is_local_leader) 
     158    { 
     159 
     160      int *ranks = new int[mpi_size]; 
     161      for(int i=0; i<mpi_size; i++) 
     162      { 
     163        ranks[i] = local_world_rank_and_num_ep[2*i]; 
     164      } 
     165 
     166      local_group = new ::MPI_Group; 
     167      ::MPI_Group_incl(MPI_GROUP_WORLD, mpi_size, ranks, local_group); 
     168 
     169      delete[] ranks; 
     170 
     171       
     172      #pragma omp flush 
     173      #pragma omp critical (write_to_tag_group_map) 
     174      { 
     175        if(tag_group_map == 0) tag_group_map = new map< std::pair<int, int>, ::MPI_Group * >; 
     176         
     177        tag_group_map->insert(std::make_pair(std::make_pair(tag, priority? 1 : 2), local_group));        
     178      } 
     179    } 
     180 
     181    MPI_Barrier(local_comm); 
     182 
     183    if(is_leader) 
     184    { 
     185      MPI_Request request; 
     186      MPI_Status status; 
     187 
     188      int send_signal=0; 
     189      int recv_signal; 
     190 
     191      if(priority) 
     192      { 
     193        MPI_Isend(&send_signal, 1, MPI_INT, remote_leader, tag, peer_comm, &request); 
     194        MPI_Wait(&request, &status); 
     195        
     196        MPI_Irecv(&recv_signal, 1, MPI_INT, remote_leader, tag, peer_comm, &request); 
     197        MPI_Wait(&request, &status); 
     198      } 
     199      else 
     200      { 
     201        MPI_Irecv(&recv_signal, 1, MPI_INT, remote_leader, tag, peer_comm, &request); 
     202        MPI_Wait(&request, &status); 
     203           
     204        MPI_Isend(&send_signal, 1, MPI_INT, remote_leader, tag, peer_comm, &request); 
     205        MPI_Wait(&request, &status); 
     206      } 
     207    } 
     208 
     209 
     210    MPI_Barrier(local_comm); 
     211 
     212    if(is_new_leader) 
     213    { 
     214      ::MPI_Group *group1; 
     215      ::MPI_Group *group2; 
     216 
     217      empty_group = new ::MPI_Group; 
     218      *empty_group = MPI_GROUP_EMPTY; 
     219 
     220      #pragma omp flush 
     221      #pragma omp critical (read_from_tag_group_map) 
     222      { 
     223        group1 = tag_group_map->find(make_pair(tag, 1)) != tag_group_map->end()? tag_group_map->at(std::make_pair(tag, 1)) : empty_group; 
     224        group2 = tag_group_map->find(make_pair(tag, 2)) != tag_group_map->end()? tag_group_map->at(std::make_pair(tag, 2)) : empty_group; 
     225      } 
     226 
     227       
     228#ifdef _showinfo 
     229 
     230      int group1_rank, group1_size; 
     231      int group2_rank, group2_size; 
     232      ::MPI_Group_rank(*group1, &group1_rank); 
     233      ::MPI_Group_size(*group1, &group1_size); 
     234      ::MPI_Group_rank(*group2, &group2_rank); 
     235      ::MPI_Group_size(*group2, &group2_size); 
     236 
     237#endif 
     238 
     239      ::MPI_Group_union(*group1, *group2, &union_group); 
     240 
     241 
     242      #pragma omp critical (read_from_tag_group_map) 
     243      { 
     244        tag_group_map->erase(make_pair(tag, 1)); 
     245        tag_group_map->erase(make_pair(tag, 2)); 
     246      } 
     247 
     248#ifdef _showinfo 
     249 
     250      int group_rank, group_size; 
     251      ::MPI_Group_rank(union_group, &group_rank); 
     252      ::MPI_Group_size(union_group, &group_size); 
     253      printf("rank = %d : map = %p, group1_rank/size = %d/%d, group2_rank/size = %d/%d, union_rank/size = %d/%d\n", ep_rank, tag_group_map, group1_rank, group1_size, group2_rank, group2_size, group_rank, group_size); 
     254#endif 
     255 
     256    } 
     257 
     258    int summed_world_rank_and_num_ep_size=mpi_size; 
     259    summed_world_rank_and_num_ep = new int[2*(mpi_size+remote_mpi_size)]; 
     260 
     261 
     262    if(is_leader) 
     263    { 
     264       
     265      for(int i=0; i<mpi_size; i++) 
     266      { 
     267        summed_world_rank_and_num_ep[2*i] = local_world_rank_and_num_ep[2*i]; 
     268        summed_world_rank_and_num_ep[2*i+1] = local_world_rank_and_num_ep[2*i+1];  
     269      } 
     270 
     271      for(int i=0; i<remote_mpi_size; i++) 
     272      { 
     273        bool found=false; 
     274        for(int j=0; j<mpi_size; j++) 
     275        { 
     276          if(remote_world_rank_and_num_ep[2*i] == local_world_rank_and_num_ep[2*j]) 
     277          { 
     278            found=true; 
     279            summed_world_rank_and_num_ep[2*j+1] += remote_world_rank_and_num_ep[2*i+1];  
     280          } 
     281        } 
     282        if(!found) 
     283        { 
     284          summed_world_rank_and_num_ep[2*summed_world_rank_and_num_ep_size] = remote_world_rank_and_num_ep[2*i]; 
     285          summed_world_rank_and_num_ep[2*summed_world_rank_and_num_ep_size+1] = remote_world_rank_and_num_ep[2*i+1]; 
     286          summed_world_rank_and_num_ep_size++; 
     287        } 
     288 
     289      } 
     290    } 
     291 
     292    MPI_Bcast(&summed_world_rank_and_num_ep_size, 1, MPI_INT, local_leader, local_comm); 
     293 
     294    MPI_Bcast(summed_world_rank_and_num_ep, 2*summed_world_rank_and_num_ep_size, MPI_INT, local_leader, local_comm); 
     295     
     296     
     297 
     298    int remote_num_ep; 
     299    for(int i=0; i<remote_mpi_size; i++) 
     300    { 
     301      if(remote_world_rank_and_num_ep[2*i] == world_rank_and_num_ep[0]) 
     302      { 
     303        remote_num_ep = remote_world_rank_and_num_ep[2*i+1]; 
     304        break; 
     305      } 
     306    } 
     307 
     308    int new_ep_rank_loc = priority? ep_rank_loc : ep_rank_loc+remote_num_ep; 
     309 
     310#ifdef _showinfo 
     311    printf("rank = %d, priority = %d, remote_num_ep = %d, new_ep_rank_loc = %d\n", ep_rank, priority, remote_num_ep, new_ep_rank_loc); 
     312#endif 
     313     
     314    if(is_new_leader) 
     315    { 
     316      int new_num_ep; 
     317      for(int i=0; i<summed_world_rank_and_num_ep_size; i++) 
     318      { 
     319        if(summed_world_rank_and_num_ep[2*i] == world_rank_and_num_ep[0]) 
     320        { 
     321          new_num_ep = summed_world_rank_and_num_ep[2*i+1]; 
     322          break; 
     323        } 
     324      } 
     325 
     326      ::MPI_Comm mpi_comm; 
     327      ::MPI_Comm_create_group(to_mpi_comm(MPI_COMM_WORLD->mpi_comm), union_group, tag, &mpi_comm); 
     328 
     329 
     330      MPI_Comm *ep_comm; 
     331      MPI_Info info; 
     332      MPI_Comm_create_endpoints(&mpi_comm, new_num_ep, info, ep_comm); 
     333 
     334      #pragma omp critical (write_to_tag_comm_map) 
     335      { 
     336        if(tag_comm_map == 0) tag_comm_map = new std::map<int, std::pair<ep_lib::MPI_Comm*, std::pair<int, int> > >; 
     337        tag_comm_map->insert(std::make_pair(tag, std::make_pair(ep_comm, std::make_pair(new_num_ep, 0)))); 
     338      } 
     339      #pragma omp flush 
     340    } 
     341 
     342 
     343    bool found=false; 
     344    while(!found) 
     345    { 
     346      #pragma omp flush 
     347      #pragma omp critical (read_from_tag_comm_map) 
     348      { 
     349        if(tag_comm_map!=0) 
     350        { 
     351          if(tag_comm_map->find(tag) != tag_comm_map->end()) 
     352          {               
     353            *newintercomm = tag_comm_map->at(tag).first[new_ep_rank_loc]; 
     354             
     355            tag_comm_map->at(tag).second.second++; 
     356            if(tag_comm_map->at(tag).second.second == tag_comm_map->at(tag).second.first) 
     357            { 
     358              tag_comm_map->erase(tag_comm_map->find(tag)); 
     359            } 
     360 
     361            found=true; 
     362          } 
     363        } 
     364      }   
     365    } 
     366 
     367    (*newintercomm)->is_intercomm = true; 
     368 
     369     
     370 
     371 
     372    (*newintercomm)->inter_rank_map = new INTER_RANK_MAP; 
     373 
     374    int rank_info[2]; 
     375    rank_info[0] = ep_rank; 
     376    rank_info[1] = (*newintercomm)->ep_comm_ptr->size_rank_info[0].first; 
     377 
     378#ifdef _showinfo 
     379    printf("priority = %d, ep_rank = %d, new_ep_rank = %d\n", priority, rank_info[0], rank_info[1]); 
     380#endif 
     381 
     382    int *local_rank_info = new int[2*ep_size]; 
     383    int *remote_rank_info = new int[2*remote_ep_size]; 
     384 
     385    MPI_Allgather(rank_info, 2, MPI_INT, local_rank_info, 2, MPI_INT, local_comm); 
     386 
     387    if(is_leader) 
     388    { 
     389      MPI_Request request; 
     390      MPI_Status status; 
     391 
     392      if(priority) 
     393      { 
     394        MPI_Isend(local_rank_info, 2*ep_size, MPI_INT, remote_leader, tag, peer_comm, &request); 
     395        MPI_Wait(&request, &status); 
     396        
     397        MPI_Irecv(remote_rank_info, 2*remote_ep_size, MPI_INT, remote_leader, tag, peer_comm, &request); 
     398        MPI_Wait(&request, &status); 
     399      } 
     400      else 
     401      { 
     402        MPI_Irecv(remote_rank_info, 2*remote_ep_size, MPI_INT, remote_leader, tag, peer_comm, &request); 
     403        MPI_Wait(&request, &status); 
     404           
     405        MPI_Isend(local_rank_info, 2*ep_size, MPI_INT, remote_leader, tag, peer_comm, &request); 
     406        MPI_Wait(&request, &status); 
     407      } 
     408    } 
     409 
     410    MPI_Bcast(remote_rank_info, 2*remote_ep_size, MPI_INT, local_leader, local_comm); 
     411 
     412    for(int i=0; i<remote_ep_size; i++) 
     413    { 
     414      (*newintercomm)->inter_rank_map->insert(make_pair(remote_rank_info[2*i], remote_rank_info[2*i+1])); 
     415    } 
     416 
     417#ifdef _showinfo 
     418    if(ep_rank==4 && !priority) 
     419    { 
     420      for(std::map<int, int > :: iterator it=(*newintercomm)->inter_rank_map->begin(); it != (*newintercomm)->inter_rank_map->end(); it++) 
     421      { 
     422        printf("inter_rank_map[%d] = %d\n", it->first, it->second); 
     423      } 
     424    } 
     425#endif 
     426 
     427    (*newintercomm)->ep_comm_ptr->size_rank_info[0] = local_comm->ep_comm_ptr->size_rank_info[0]; 
     428 
     429    if(is_local_leader) 
     430    { 
     431      delete[] local_world_rank_and_num_ep;   
     432     
     433      MPI_Group_free(local_group); 
     434      delete local_group; 
     435    } 
     436 
     437    if(is_new_leader) 
     438    { 
     439      MPI_Group_free(&union_group); 
     440      delete empty_group; 
     441    } 
     442 
     443    delete[] remote_world_rank_and_num_ep; 
     444    delete[] summed_world_rank_and_num_ep; 
     445    delete[] local_rank_info; 
     446    delete[] remote_rank_info; 
     447 
     448 
     449  } 
     450 
     451 
     452  int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm *newintercomm) 
     453  { 
     454    assert(local_comm->is_ep); 
     455 
     456    int ep_rank, ep_rank_loc, mpi_rank; 
     457    int ep_size, num_ep, mpi_size; 
     458 
     459    ep_rank = local_comm->ep_comm_ptr->size_rank_info[0].first; 
     460    ep_rank_loc = local_comm->ep_comm_ptr->size_rank_info[1].first; 
     461    mpi_rank = local_comm->ep_comm_ptr->size_rank_info[2].first; 
     462    ep_size = local_comm->ep_comm_ptr->size_rank_info[0].second; 
     463    num_ep = local_comm->ep_comm_ptr->size_rank_info[1].second; 
     464    mpi_size = local_comm->ep_comm_ptr->size_rank_info[2].second; 
     465 
    24466 
    25467    MPI_Barrier(local_comm); 
     
    60502    } 
    61503 
    62  
    63  
    64  
    65  
    66     int leader_ranks[6]; //! 0: rank in world, 1: mpi_size, 2: rank_in_peer. 
    67                          //! 3, 4, 5 : remote 
    68  
    69     bool is_decider = false; 
    70  
    71  
    72     if(ep_rank == local_leader) 
    73     { 
    74       MPI_Comm_rank(MPI_COMM_WORLD, &leader_ranks[0]); 
    75  
    76       leader_ranks[1] = mpi_size; 
    77       MPI_Comm_rank(peer_comm, &leader_ranks[2]); 
    78  
    79       MPI_Request request[2]; 
    80       MPI_Status status[2]; 
    81  
    82       MPI_Isend(&leader_ranks[0], 3, MPI_INT, remote_leader, tag, peer_comm, &request[0]); 
    83       MPI_Irecv(&leader_ranks[3], 3, MPI_INT, remote_leader, tag, peer_comm, &request[1]); 
    84  
    85       MPI_Waitall(2, request, status); 
    86  
    87     } 
    88  
    89  
    90     MPI_Bcast(leader_ranks, 6, MPI_INT, local_leader, local_comm); 
    91  
    92      
    93     MPI_Barrier(local_comm); 
    94      
    95  
    96     if(leader_ranks[0] == leader_ranks[3]) 
    97     { 
    98       if( leader_ranks[1] * leader_ranks[4] == 1) 
    99       { 
    100         if(ep_rank == local_leader) printf("calling MPI_Intercomm_create_unique_leader\n"); 
    101         local_comm->ep_comm_ptr->comm_label = -99; 
    102  
    103         return MPI_Intercomm_create_unique_leader(local_comm, local_leader, peer_comm, remote_leader, tag, newintercomm); 
    104       } 
    105       else // leader_ranks[1] * leader_ranks[4] != 1 
    106       { 
    107         // change leader 
    108         int new_local_leader; 
    109  
    110         if(leader_ranks[2] < leader_ranks[5]) 
    111         { 
    112           if(leader_ranks[1] > 1) //! change leader 
    113           { 
    114             // change leader 
    115             is_decider = true; 
    116             int target = local_comm->ep_rank_map->at(local_leader).second; 
    117             { 
    118               for(int i=0; i<ep_size; i++) 
    119               { 
    120                 if(local_comm->ep_rank_map->at(i).second != target && local_comm->ep_rank_map->at(i).first == 0) 
    121                 { 
    122                   new_local_leader = i; 
    123                   break; 
    124                 } 
    125               } 
    126             } 
    127           } 
    128           else 
    129           { 
    130             new_local_leader = local_leader; 
    131           } 
    132         } 
    133         else 
    134         { 
    135           if(leader_ranks[4] == 1) 
    136           { 
    137             // change leader 
    138             is_decider = true; 
    139             int target = local_comm->ep_rank_map->at(local_leader).second; 
    140             { 
    141               for(int i=0; i<ep_size; i++) 
    142               { 
    143                 if(local_comm->ep_rank_map->at(i).second != target && local_comm->ep_rank_map->at(i).first == 0) 
    144                 { 
    145                   new_local_leader = i; 
    146                   break; 
    147                 } 
    148               } 
    149             } 
    150           } 
    151           else 
    152           { 
    153             new_local_leader = local_leader; 
    154           } 
    155         } 
    156  
    157  
    158         int new_tag_in_world; 
    159  
    160         int leader_in_world[2]; 
    161  
    162  
    163         if(is_decider) 
    164         { 
    165           if(ep_rank == new_local_leader) 
    166           { 
    167             new_tag_in_world = TAG++; 
    168           } 
    169           MPI_Bcast(&new_tag_in_world, 1, MPI_INT, new_local_leader, local_comm); 
    170           if(ep_rank == local_leader) MPI_Send(&new_tag_in_world, 1, MPI_INT, remote_leader, tag, peer_comm); 
    171         } 
    172         else 
    173         { 
    174           if(ep_rank == local_leader) 
    175           { 
    176             MPI_Status status; 
    177             MPI_Recv(&new_tag_in_world, 1, MPI_INT, remote_leader, tag, peer_comm, &status); 
    178           } 
    179           MPI_Bcast(&new_tag_in_world, 1, MPI_INT, new_local_leader, local_comm); 
    180         } 
    181  
    182  
    183         if(ep_rank == new_local_leader) 
    184         { 
    185           ::MPI_Comm_rank(to_mpi_comm(MPI_COMM_WORLD->mpi_comm), &leader_in_world[0]); 
    186         } 
    187  
    188         MPI_Bcast(&leader_in_world[0], 1, MPI_INT, new_local_leader, local_comm); 
    189  
    190  
    191         if(ep_rank == local_leader) 
    192         { 
    193           MPI_Request request[2]; 
    194           MPI_Status status[2]; 
    195  
    196           MPI_Isend(&leader_in_world[0], 1, MPI_INT, remote_leader, tag, peer_comm, &request[0]); 
    197           MPI_Irecv(&leader_in_world[1], 1, MPI_INT, remote_leader, tag, peer_comm, &request[1]); 
    198  
    199           MPI_Waitall(2, request, status); 
    200         } 
    201  
    202         MPI_Bcast(&leader_in_world[1], 1, MPI_INT, local_leader, local_comm); 
    203  
    204         local_comm->ep_comm_ptr->comm_label = tag; 
    205  
    206         if(ep_rank == local_leader) printf("calling MPI_Intercomm_create_from_world\n"); 
    207  
    208         return MPI_Intercomm_create_from_world(local_comm, new_local_leader, MPI_COMM_WORLD->mpi_comm, leader_in_world[1], new_tag_in_world, newintercomm); 
    209          
    210       } 
    211     } 
    212  
    213      
    214  
    215504  } 
    216505 
    217506  int MPI_Comm_test_inter(MPI_Comm comm, int *flag) 
    218507  { 
    219     *flag = false; 
    220508    if(comm->is_ep) 
    221509    { 
    222       *flag = comm->is_intercomm; 
    223       return 0; 
     510      return *flag = comm->is_intercomm; 
    224511    }  
    225     else if(comm->mpi_comm != static_cast< ::MPI_Comm*>(MPI_COMM_NULL->mpi_comm)) 
    226     { 
    227       ::MPI_Comm mpi_comm = to_mpi_comm(comm->mpi_comm); 
    228        
    229       ::MPI_Comm_test_inter(mpi_comm, flag); 
    230       return 0;   
    231     } 
    232     return 0; 
     512    else 
     513    { 
     514      return ::MPI_Comm_test_inter(to_mpi_comm(comm->mpi_comm), flag); 
     515    } 
    233516  } 
    234517 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_intercomm.hpp

    r1518 r1525  
    66typedef std::map<int, std::pair<int, int> > EP_RANK_MAP;  // key(ep_rank) = <ep_rank_local, mpi_rank> 
    77typedef std::map<int, std::pair< int, std::pair<int, int> > > INTERCOMM_RANK_MAP; 
     8typedef std::map<int, int > INTER_RANK_MAP; 
    89 
    910namespace ep_lib 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_lib.cpp

    r1520 r1525  
    1212 
    1313 
     14std::map<std::pair<int, int>, MPI_Group* > * tag_group_map = 0; 
     15 
     16std::map<int, std::pair<ep_lib::MPI_Comm*, std::pair<int, int> > > * tag_comm_map = 0; 
     17 
     18 
     19MPI_Group MPI_GROUP_WORLD; 
    1420 
    1521namespace ep_lib 
     
    2733  int get_ep_rank(MPI_Comm comm, int ep_rank_loc, int mpi_rank) 
    2834  { 
    29     if(comm->is_intercomm) 
     35    /*if(comm->is_intercomm) 
    3036    { 
    3137      for(std::map<int, std::pair< int, std::pair<int, int> > >::iterator it = comm->ep_comm_ptr->intercomm->intercomm_rank_map->begin(); it != comm->ep_comm_ptr->intercomm->intercomm_rank_map->end(); it++) 
     
    4046      int err; 
    4147      return MPI_Abort(comm, err); 
    42     } 
     48    }*/ 
    4349     
    4450    for(std::map<int, std::pair<int, int> >::iterator it = comm->ep_rank_map->begin(); it != comm->ep_rank_map->end(); it++) 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_lib.hpp

    r1522 r1525  
    3030 
    3131  int MPI_Comm_free(MPI_Comm* comm); 
     32  int MPI_Comm_free2(MPI_Comm* comm); 
    3233 
    3334  int MPI_Finalize(); 
     
    4041   
    4142  int MPI_Comm_remote_size(MPI_Comm comm, int *size); 
     43  int MPI_Comm_remote_size2(MPI_Comm comm, int *size); 
     44 
    4245 
    4346  int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm); 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_lib_collective.hpp

    r1517 r1525  
    1010 
    1111  int MPI_Barrier(MPI_Comm comm); 
     12  int MPI_Barrier2(MPI_Comm comm); 
    1213   
    1314 
     
    4647 
    4748  int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm *newintercomm); 
     49  int MPI_Intercomm_create2(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm *newintercomm); 
    4850 
    4951  int MPI_Intercomm_create_kernel(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm *newintercomm); 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_size.cpp

    r1515 r1525  
    3636  } 
    3737 
     38  int MPI_Comm_remote_size2(MPI_Comm comm, int *size) 
     39  { 
     40    if(comm->is_ep) 
     41    { 
     42      if(comm->is_intercomm) 
     43      { 
     44        Debug("MPI_Comm_remote_size with EP_intercomm"); 
     45        return *size = comm->inter_rank_map->size(); 
     46      } 
     47      return *size=0; 
     48    } 
     49    return MPI_Comm_remote_size_mpi(comm, size); 
     50  } 
     51 
    3852 
    3953  int MPI_Comm_size_mpi(MPI_Comm comm, int* size) 
     
    4963  } 
    5064 
    51  
    5265} 
    5366 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_type.hpp

    r1511 r1525  
    8686  static std::map<std::pair<int, int>, MPI_Comm >  fc_comm_map; 
    8787 
     88   
     89 
    8890 
    8991} 
  • XIOS/dev/branch_openmp/extern/ep_dev/main.cpp

    r1522 r1525  
    717717      MPI_Barrier(comm); 
    718718       
    719       if(rank == 0) printf("            \t tMPI_Comm_split \t OK\n"); 
     719      if(rank == 0) printf("            \t MPI_Comm_split \t OK\n"); 
    720720       
    721721      MPI_Barrier(comm); 
     
    746746      MPI_Barrier(split_comm2); 
    747747      MPI_Comm_free(&split_comm2); 
     748 
    748749       
    749750       
     
    825826      MPI_Barrier(comm); 
    826827      MPI_Barrier(comm); 
     828 
    827829 
    828830      if(color==2 && split_rank==0) 
     
    878880 
    879881 
    880       //printf("rank = %d, high = %d, inter_comm_dup_size = %d, inter_comm_dup_remote_size = %d\n", rank, high, inter_comm_dup_size, inter_comm_dup_remote_size); 
     882      printf("rank = %d, high = %d, inter_comm_dup_size = %d, inter_comm_dup_remote_size = %d\n", rank, high, inter_comm_dup_size, inter_comm_dup_remote_size); 
    881883 
    882884      MPI_Comm inter_comm_dup_merged; 
     
    892894      //printf("rank = %d, inter_comm_dup_merged_rank = %d, inter_comm_dup_merged_size = %d\n", rank, inter_comm_dup_merged_rank, inter_comm_dup_merged_size); 
    893895       
    894       // TEST OF TESTALL 
    895        
    896         int merged_size, merged_rank; 
    897         MPI_Comm_rank(inter_comm_dup_merged, &merged_rank); 
    898         MPI_Comm_size(inter_comm_dup_merged, &merged_size); 
    899          
    900         int left = merged_rank>0? merged_rank-1 : merged_size-1; 
    901         int right = (merged_rank+1) % merged_size; 
    902          
    903         //printf("rank = %d, left = %d, right = %d\n", merged_rank, left, right); 
    904          
    905         int N=10000; 
    906         int *left_buf = new int[N]; 
    907         int *right_buf = new int[N]; 
    908                  
    909         for(int i=0; i<N; i++) 
    910         { 
    911           right_buf[i] = merged_rank*100000+i; 
    912         } 
    913          
    914         MPI_Request request[2]; 
    915         MPI_Status status[2]; 
    916          
    917         MPI_Irecv(left_buf, N, MPI_INT, left, 0, inter_comm_dup_merged, &request[0]); 
    918         MPI_Isend(right_buf, N, MPI_INT, right, 0, inter_comm_dup_merged, &request[1]); 
    919          
    920          
    921         int flag; 
    922         MPI_Testall(2, request, &flag, status); 
    923        
    924         printf("rank = %d, flag = %d\n", merged_rank, flag); 
    925          
    926         while(!flag) MPI_Testall(2, request, &flag, status); 
    927         //if(!flag)  MPI_Waitall(2, request, status); 
    928          
    929         int recv_count; 
    930         MPI_Get_count(&status[0], MPI_INT, &recv_count); 
    931          
    932         MPI_Barrier(inter_comm_dup_merged); 
    933          
    934         printf("rank = %d, recv_count = %d, left_buf[5-10] = %d\t%d\t%d\t%d\t%d\t%d\n", merged_rank, recv_count, left_buf[5], left_buf[6], left_buf[7], left_buf[8], left_buf[9], left_buf[10]); 
    935                          
    936         delete[] left_buf; 
    937         delete[] right_buf; 
    938        
    939        
     896       
     897      MPI_Barrier(inter_comm_dup_merged); 
    940898 
    941899      // TEST OF GATHER 
    942900      { 
     901         
     902 
    943903        int gather_root = 99; 
    944904   
     
    976936      } 
    977937 
     938      MPI_Barrier(inter_comm_dup_merged); 
     939 
    978940      // TEST OF ALLREDUCE 
    979941      { 
     
    1009971      } 
    1010972 
     973      MPI_Barrier(inter_comm_dup_merged); 
     974 
    1011975      // TEST OF EXSCAN 
    1012       /*{ 
     976      { 
    1013977  
    1014978        std::vector<int>sendbuf(2, inter_comm_dup_merged_rank); 
     
    1029993          exscan_test = 0;  
    1030994        } 
    1031  
    1032         //printf(" ID=%d : sendbuf = (%d, %d), recvbuf = (%d, %d), exscan_test = %d \n", inter_comm_dup_merged_rank, sendbuf[0], sendbuf[1], recvbuf[0], recvbuf[1], exscan_test);  
    1033995         
    1034996        int exscan_result; 
     
    1037999        if(inter_comm_dup_merged_rank == 0 && exscan_result)  printf("            \t test MPI_Exscan for merged comm \t OK\n"); 
    10381000        if(inter_comm_dup_merged_rank == 0 && !exscan_result) printf("            \t test MPI_Exscan for merged comm \t FAILED %d\n", exscan_result); 
    1039       }*/ 
     1001      } 
     1002 
     1003      MPI_Barrier(inter_comm_dup_merged); 
    10401004 
    10411005      // TEST OF SCATTERV 
     
    10671031        MPI_Scatterv(sendbuf.data(), sendcounts.data(), displs.data(), MPI_INT, recvbuf.data(), 2, MPI_INT, scatterv_root, inter_comm_dup_merged); 
    10681032 
    1069         //printf("ID = %d : %d %d\n", inter_comm_dup_merged_rank, recvbuf[0], recvbuf[1]); 
    1070  
    10711033        int scatterv_test = 1; 
    10721034 
     
    10851047      } 
    10861048 
    1087  
    1088  
     1049      MPI_Barrier(inter_comm_dup_merged); 
     1050 
     1051      // TEST OF TESTALL 
     1052      { 
     1053        int merged_size, merged_rank; 
     1054        MPI_Comm_rank(inter_comm_dup_merged, &merged_rank); 
     1055        MPI_Comm_size(inter_comm_dup_merged, &merged_size); 
     1056         
     1057        int left = merged_rank>0? merged_rank-1 : merged_size-1; 
     1058        int right = (merged_rank+1) % merged_size; 
     1059                 
     1060        int N=10000; 
     1061        int *left_buf = new int[N]; 
     1062        int *right_buf = new int[N]; 
     1063                 
     1064        for(int i=0; i<N; i++) 
     1065        { 
     1066          right_buf[i] = merged_rank*100000+i; 
     1067        } 
     1068         
     1069        MPI_Request request[2]; 
     1070        MPI_Status status[2]; 
     1071         
     1072        MPI_Irecv(left_buf, N, MPI_INT, left, 0, inter_comm_dup_merged, &request[0]); 
     1073        MPI_Isend(right_buf, N, MPI_INT, right, 0, inter_comm_dup_merged, &request[1]); 
     1074         
     1075         
     1076        int flag; 
     1077        MPI_Testall(2, request, &flag, status); 
     1078       
     1079        printf("rank = %d, flag = %d\n", merged_rank, flag); 
     1080         
     1081        while(!flag) MPI_Testall(2, request, &flag, status); 
     1082         
     1083        int recv_count; 
     1084        MPI_Get_count(&status[0], MPI_INT, &recv_count); 
     1085         
     1086        MPI_Barrier(inter_comm_dup_merged); 
     1087         
     1088        printf("rank = %d, recv_count = %d, left_buf[5-10] = %d\t%d\t%d\t%d\t%d\t%d\n", merged_rank, recv_count, left_buf[5], left_buf[6], left_buf[7], left_buf[8], left_buf[9], left_buf[10]); 
     1089                         
     1090        delete[] left_buf; 
     1091        delete[] right_buf; 
     1092      } 
     1093       
     1094      MPI_Barrier(inter_comm_dup_merged); 
     1095 
     1096      // TEST WAITALL 
     1097      { 
     1098        int merged_rank; 
     1099        int merged_size; 
     1100 
     1101        MPI_Comm_rank(inter_comm_dup_merged, &merged_rank); 
     1102        MPI_Comm_size(inter_comm_dup_merged, &merged_size); 
     1103 
     1104        int left = merged_rank>0? merged_rank-1 : merged_size-1; 
     1105        int right = (merged_rank+1)%merged_size; 
     1106 
     1107        printf("merged_rank = %d, left = %d, right = %d\n", merged_rank, left, right); 
     1108 
     1109        int NN=10000; 
     1110 
     1111        double *left_buf = new double[NN]; 
     1112        double *right_buf = new double[NN]; 
     1113 
     1114        for(int i=0; i<NN; i++) 
     1115        { 
     1116          right_buf[i] = merged_rank*1000000 + i; 
     1117        } 
     1118 
     1119        MPI_Request request[2]; 
     1120        MPI_Status  status[2]; 
     1121 
     1122        MPI_Irecv(left_buf,  NN, MPI_DOUBLE, left,  0, inter_comm_dup_merged, &request[0]); 
     1123        MPI_Isend(right_buf, NN, MPI_DOUBLE, right, 0, inter_comm_dup_merged, &request[1]); 
     1124         
     1125 
     1126        MPI_Waitall(2, request, status); 
     1127 
     1128        printf("merged_rank = %d, left_buf[0-4] = %lf\t%lf\t%lf\t%lf\t%lf\n", merged_rank, left_buf[0], left_buf[1], left_buf[2], left_buf[3], left_buf[4]); 
     1129 
     1130 
     1131        delete left_buf; 
     1132        delete right_buf; 
     1133      } 
    10891134 
    10901135      MPI_Barrier(comm); 
     
    11081153      MPI_Comm_free(&inter_comm); 
    11091154       
    1110  
    1111       /* 
    1112       MPI_Barrier(comm); 
    1113       if(rank == 0) printf("\tMPI_Intercomm_create OK\n"); 
    1114       MPI_Barrier(comm); 
    1115  
    1116      
    1117  
    1118       int high=color; 
    1119       MPI_Comm intra_comm; 
    1120       MPI_Intercomm_merge(inter_comm, high, &intra_comm); 
    1121      
    1122       int intra_rank, intra_size; 
    1123       MPI_Comm_rank(intra_comm, &intra_rank); 
    1124       MPI_Comm_size(intra_comm, &intra_size); 
    1125  
    1126       MPI_Barrier(comm); 
    1127       if(rank == 0) printf("\tMPI_Intercomm_merge OK\n"); 
    1128       MPI_Barrier(comm); 
    1129      
    1130      
    1131  
    1132       //check_test_gatherv(comm); 
    1133        
    1134       MPI_Barrier(comm); 
    1135       MPI_Comm_free(&inter_comm); 
    1136       */ 
     1155    } 
     1156 
     1157    // TESE OF INTERCOMM_CREATE 
     1158    { 
     1159      MPI_Barrier(comm); 
     1160       
     1161      int rank, size; 
     1162      MPI_Comm_rank(comm, &rank); 
     1163      MPI_Comm_size(comm, &size); 
     1164 
     1165      int config = 1; 
     1166      if(config=1) 
     1167      { 
     1168        assert(size == 16 && omp_get_num_threads()==4); 
     1169      } 
     1170       
     1171      int tab_color[16] = {2, 2, 2, 1, 2, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1}; // used for config 1 
     1172      int tab_key[16]   = {2, 1, 4, 1, 0, 4, 3, 3, 4, 3, 4, 4, 4, 0, 0, 2}; // used for config 1 
     1173 
     1174      int color = tab_color[rank]; 
     1175      int key = tab_key[rank]; 
     1176       
     1177   
     1178      MPI_Comm split_comm; 
     1179      MPI_Comm_split(comm, color, key, &split_comm); 
     1180 
     1181     
     1182      int split_rank, split_size; 
     1183      MPI_Comm_rank(split_comm, &split_rank); 
     1184      MPI_Comm_size(split_comm, &split_size); 
     1185 
     1186 
     1187       
     1188 
     1189      MPI_Barrier(comm); 
     1190      MPI_Barrier(comm); 
     1191       
     1192      if(rank == 0) printf("            \t MPI_Comm_split \t OK\n"); 
     1193       
     1194      MPI_Barrier(comm); 
     1195      MPI_Barrier(comm); 
     1196       
     1197             
     1198      int local_leader = 5; 
     1199      int remote_leader = color==2? 5: 2; // used for config 1 
     1200 
     1201      MPI_Comm peer_comm = comm; 
     1202 
     1203      MPI_Comm inter_comm; 
     1204      MPI_Intercomm_create2(split_comm, local_leader, peer_comm, remote_leader, 99, &inter_comm); 
     1205 
     1206      int inter_rank; 
     1207      int inter_size; 
     1208      MPI_Comm_rank(inter_comm, &inter_rank); 
     1209      MPI_Comm_size(inter_comm, &inter_size); 
     1210 
     1211      printf("split_rank = %d, inter_rank = %d / %d\n", split_rank, inter_rank, inter_size); 
     1212 
     1213      MPI_Barrier(split_comm); 
     1214      MPI_Comm_free(&split_comm); 
     1215 
     1216      MPI_Barrier2(inter_comm); 
     1217      MPI_Comm_free2(&inter_comm); 
     1218       
    11371219    } 
    11381220   
Note: See TracChangeset for help on using the changeset viewer.