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_barrier.cpp

    r1354 r1520  
    99  int MPI_Barrier(MPI_Comm comm) 
    1010  { 
    11     if(comm.is_intercomm) return MPI_Barrier_intercomm(comm); 
     11    if(comm->is_intercomm) return MPI_Barrier_intercomm(comm); 
    1212 
    13     if(comm.is_ep) 
     13    if(comm->is_ep)  
    1414    { 
    15       int ep_rank_loc = comm.ep_comm_ptr->size_rank_info[1].first; 
    16  
    17       MPI_Barrier_local(comm); 
    18  
    19       if(ep_rank_loc == 0) 
    20       { 
    21         ::MPI_Comm mpi_comm = to_mpi_comm(comm.mpi_comm); 
    22  
    23         ::MPI_Barrier(mpi_comm); 
    24       } 
    25  
    26       MPI_Barrier_local(comm); 
    27  
    28       return 0; 
    29     } 
    30     else if(comm.mpi_comm != static_cast< ::MPI_Comm*>(MPI_COMM_NULL.mpi_comm)) 
    31     { 
    32       ::MPI_Comm mpi_comm = to_mpi_comm(comm.mpi_comm); 
    33       ::MPI_Barrier(mpi_comm); 
    34       return 0; 
     15      return MPI_Barrier_intracomm(comm); 
    3516    } 
    3617 
    37     else return 0; 
     18     
     19    return MPI_Barrier_mpi(comm); 
     20 
    3821  } 
    3922 
    40  
    41   int MPI_Barrier_intercomm(MPI_Comm comm) 
     23  int MPI_Barrier_intracomm(MPI_Comm comm) 
    4224  { 
    43  
    44     int ep_rank_loc = comm.ep_comm_ptr->size_rank_info[1].first; 
     25    int ep_rank_loc = comm->ep_comm_ptr->size_rank_info[1].first; 
    4526 
    4627    MPI_Barrier_local(comm); 
     
    4829    if(ep_rank_loc == 0) 
    4930    { 
    50       ::MPI_Comm mpi_comm = to_mpi_comm(comm.ep_comm_ptr->intercomm->mpi_inter_comm); 
     31      ::MPI_Comm mpi_comm = to_mpi_comm(comm->mpi_comm); 
     32 
    5133      ::MPI_Barrier(mpi_comm); 
    5234    } 
     
    5537 
    5638    return 0; 
     39  } 
    5740 
     41  int MPI_Barrier_intercomm(MPI_Comm comm) 
     42  { 
     43    MPI_Barrier_local(comm); 
     44 
     45    if(comm->ep_comm_ptr->intercomm->size_rank_info[1].first == 0) 
     46      ::MPI_Barrier(to_mpi_comm(comm->ep_comm_ptr->intercomm->mpi_inter_comm)); 
     47 
     48    MPI_Barrier_local(comm); 
     49  } 
     50 
     51  int MPI_Barrier_mpi(MPI_Comm comm) 
     52  { 
     53    return ::MPI_Barrier(to_mpi_comm(comm->mpi_comm)); 
    5854  } 
    5955 
     
    6157  int MPI_Barrier_local(MPI_Comm comm) 
    6258  { 
    63     //Message_Check(comm); 
    64     comm.ep_barrier->wait(); 
     59    comm->ep_barrier->wait(); 
    6560  } 
    6661 
Note: See TracChangeset for help on using the changeset viewer.