2004-01-20 09:30:33 +03:00
|
|
|
/*
|
2004-10-15 23:31:47 +04:00
|
|
|
* $HEADER$
|
2004-01-20 09:30:33 +03:00
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "ompi_config.h"
|
2004-01-20 09:30:33 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "mpi.h"
|
2004-03-17 21:45:16 +03:00
|
|
|
#include "mpi/c/bindings.h"
|
2004-05-08 03:44:49 +04:00
|
|
|
#include "mca/coll/coll.h"
|
|
|
|
#include "errhandler/errhandler.h"
|
|
|
|
#include "communicator/communicator.h"
|
2004-01-20 09:30:33 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
|
2004-01-20 09:30:33 +03:00
|
|
|
#pragma weak MPI_Barrier = PMPI_Barrier
|
|
|
|
#endif
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#if OMPI_PROFILING_DEFINES
|
2004-04-20 22:50:43 +04:00
|
|
|
#include "mpi/c/profile/defines.h"
|
|
|
|
#endif
|
|
|
|
|
2004-06-24 20:47:00 +04:00
|
|
|
static const char FUNC_NAME[] = "MPI_Barrier";
|
2004-05-08 03:44:49 +04:00
|
|
|
|
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
int MPI_Barrier(MPI_Comm comm)
|
2004-05-08 03:44:49 +04:00
|
|
|
{
|
2004-06-29 04:02:25 +04:00
|
|
|
int err = MPI_SUCCESS;
|
2004-05-08 03:44:49 +04:00
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
/* Error checking */
|
2004-05-08 03:44:49 +04:00
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
if (MPI_PARAM_CHECK) {
|
|
|
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
|
|
|
if (ompi_comm_invalid(comm)) {
|
2004-09-15 23:55:36 +04:00
|
|
|
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
2004-05-08 03:44:49 +04:00
|
|
|
}
|
2004-06-29 04:02:25 +04:00
|
|
|
}
|
2004-05-08 03:44:49 +04:00
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
/* Intracommunicators: Only invoke the back-end coll module barrier
|
|
|
|
function if there's more than one process in the communicator */
|
2004-05-08 03:44:49 +04:00
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
if (OMPI_COMM_IS_INTRA(comm)) {
|
|
|
|
if (ompi_comm_size(comm) > 1) {
|
|
|
|
err = comm->c_coll.coll_barrier(comm);
|
2004-05-08 03:44:49 +04:00
|
|
|
}
|
2004-06-29 04:02:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Intercommunicators -- always invoke, because, by definition,
|
|
|
|
there's always at least 2 processes in an intercommunicator. */
|
|
|
|
|
|
|
|
else {
|
|
|
|
err = comm->c_coll.coll_barrier(comm);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* All done */
|
2004-05-08 03:44:49 +04:00
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
|
2004-01-20 09:30:33 +03:00
|
|
|
}
|