Ignore:
Timestamp:
06/04/18 19:25:08 (6 years ago)
Author:
yushan
Message:

save dev. TO DO : test with xios

File:
1 edited

Legend:

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

    r1354 r1520  
    77{ 
    88 
    9  
    10  
    11  
    129  int MPI_Comm_size(MPI_Comm comm, int* size) 
    1310  { 
    14      
    15     if(comm.is_ep) 
     11    if(comm->is_ep) 
    1612    { 
    17       if(!comm.is_intercomm) 
    18       { 
    19         *size = comm.ep_comm_ptr->size_rank_info[0].second; 
    20  
    21         return 0; 
    22       } 
    23       else 
    24       { 
    25         *size = comm.ep_comm_ptr->intercomm->size_rank_info[0].second; 
    26  
    27         return 0; 
    28       } 
    29  
     13      Debug("MPI_Comm_size with EP"); 
     14      return *size = comm->ep_comm_ptr->size_rank_info[0].second; 
    3015    } 
    3116 
    32     Debug("Calling EP_Comm_size\n"); 
    33  
    34     if(comm.mpi_comm != static_cast< ::MPI_Comm*>(MPI_COMM_NULL.mpi_comm)) 
    35     { 
    36       ::MPI_Comm mpi_comm = to_mpi_comm(comm.mpi_comm);  
    37       int mpi_size; 
    38  
    39       ::MPI_Comm_size(mpi_comm, &mpi_size); 
    40       printf("============ ep comm size called for non ep comm, %d\n", mpi_size); 
    41       *size = mpi_size; 
    42       return 0; 
    43     } 
    44  
    45     else 
    46     { 
    47       *size = MPI_UNDEFINED; 
    48       printf("============ ep comm size called for non ep comm not defined\n"); 
    49       return 0; 
    50     } 
     17    return MPI_Comm_size_mpi(comm, size); 
    5118  } 
    5219 
    5320  int MPI_Comm_remote_size(MPI_Comm comm, int *size) 
    5421  { 
    55     if(!comm.is_ep) 
     22    if(comm->is_ep) 
    5623    { 
    57       if(comm.mpi_comm != static_cast< ::MPI_Comm*>(MPI_COMM_NULL.mpi_comm)) 
     24      if(comm->is_intercomm) 
    5825      { 
    59         ::MPI_Comm mpi_comm = to_mpi_comm(comm.mpi_comm);  
    60         ::MPI_Comm_remote_size(mpi_comm, size); 
    61         return 0; 
     26        Debug("MPI_Comm_remote_size with EP_intercomm"); 
     27        return *size = comm->ep_comm_ptr->intercomm->intercomm_rank_map->size(); 
    6228      } 
    63  
    6429      else 
    6530      { 
    66         *size = MPI_UNDEFINED; 
    67         return 0; 
     31        Debug("MPI_Comm_remote_size with EP_intracomm"); 
     32        return *size=0; 
    6833      } 
    6934    } 
    70      
    71     if(comm.is_intercomm) 
    72     { 
    73       *size = comm.ep_comm_ptr->intercomm->remote_rank_map->size(); 
    74       return 0; 
    75     } 
    76     *size = MPI_UNDEFINED; 
    77     return 0;  
     35    return MPI_Comm_remote_size_mpi(comm, size); 
    7836  } 
     37 
     38 
     39  int MPI_Comm_size_mpi(MPI_Comm comm, int* size) 
     40  { 
     41    Debug("MPI_Comm_size with MPI"); 
     42    return ::MPI_Comm_size(to_mpi_comm(comm->mpi_comm), size); 
     43  } 
     44 
     45  int MPI_Comm_remote_size_mpi(MPI_Comm comm, int *size) 
     46  { 
     47    Debug("MPI_Comm_remote_size with MPI"); 
     48    return ::MPI_Comm_remote_size(to_mpi_comm(comm->mpi_comm), size); 
     49  } 
     50 
     51 
    7952} 
    8053 
Note: See TracChangeset for help on using the changeset viewer.