Ignore:
Timestamp:
05/28/18 23:25:35 (6 years ago)
Author:
yushan
Message:

MPI_split can deal with discontinuous ranking within a process

File:
1 edited

Legend:

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

    r1503 r1504  
    687687 
    688688    //int color = rank%2; 
    689     int color, remote_leader; 
    690     if(rank<size-2) {color = 1; remote_leader = size-2;} 
    691     else {color = 0; remote_leader = 0;} 
    692      
    693     printf("rank = %d, color = %d, remote_leader = %d\n", rank, color, remote_leader); 
    694    
    695     MPI_Comm sub_comm; 
    696     MPI_Comm_split(comm, color, rank, &sub_comm); 
    697  
    698  
    699      
    700     int sub_rank; 
    701     MPI_Comm_rank(sub_comm, &sub_rank); 
     689    int tab_color[16]={2,2,2,3,0,1,1,3,2,1,3,0,0,2,0,0}; 
     690    int tab_key[16]={3,11,10,5,6,8,15,7,2,1,9,13,4,14,12,0}; 
     691    int color = tab_color[rank]; 
     692    int key = tab_key[rank]; 
     693   
     694    MPI_Comm split_comm; 
     695    MPI_Comm_split(comm, color, key, &split_comm); 
     696 
     697 
     698     
     699    int split_rank; 
     700    MPI_Comm_rank(split_comm, &split_rank); 
     701     
     702    printf("rank = %d, color = %d, key = %d, split_rank = %d\n", rank, color, key, split_rank); 
    702703 
    703704 
     
    733734*/ 
    734735    MPI_Barrier(comm); 
    735     MPI_Comm_free(&sub_comm); 
     736    MPI_Comm_free(&split_comm); 
    736737 
    737738 
Note: See TracChangeset for help on using the changeset viewer.