#include "ep_lib.hpp" #include #include "ep_declaration.hpp" #include "ep_mpi.hpp" namespace ep_lib { int MPI_Barrier(MPI_Comm comm) { if(comm->is_ep) { return MPI_Barrier_endpoint(comm); } return MPI_Barrier_mpi(comm); } int MPI_Barrier_endpoint(MPI_Comm comm) { int ep_rank_loc = comm->ep_comm_ptr->size_rank_info[1].first; MPI_Barrier_local(comm); if(ep_rank_loc == 0) { ::MPI_Comm mpi_comm = to_mpi_comm(comm->mpi_comm); ::MPI_Barrier(mpi_comm); } MPI_Barrier_local(comm); } int MPI_Barrier_mpi(MPI_Comm comm) { return ::MPI_Barrier(to_mpi_comm(comm->mpi_comm)); } int MPI_Barrier_local(MPI_Comm comm) { comm->ep_barrier->wait(); } }