mpi: MPI_Neighbor_all* and MPI_Ineighbor_all* do not work with
inter communicators (fail with MPI_ERR_COMM) or non process topologies communicators (fail with MPI_ERR_TOPOLOGY)
Этот коммит содержится в:
родитель
4ea13f10f6
Коммит
a0782e1c7e
@ -18,6 +18,8 @@
|
||||
* Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -68,7 +70,9 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_communicator_t);
|
||||
#define OMPI_COMM_IS_INVALID(comm) ((comm)->c_flags & OMPI_COMM_INVALID)
|
||||
#define OMPI_COMM_IS_PML_ADDED(comm) ((comm)->c_flags & OMPI_COMM_PML_ADDED)
|
||||
#define OMPI_COMM_IS_EXTRA_RETAIN(comm) ((comm)->c_flags & OMPI_COMM_EXTRA_RETAIN)
|
||||
|
||||
#define OMPI_COMM_IS_TOPO(comm) (OMPI_COMM_IS_CART((comm)) || \
|
||||
OMPI_COMM_IS_GRAPH((comm)) || \
|
||||
OMPI_COMM_IS_DIST_GRAPH((comm)))
|
||||
|
||||
#define OMPI_COMM_SET_DYNAMIC(comm) ((comm)->c_flags |= OMPI_COMM_DYNAMIC)
|
||||
#define OMPI_COMM_SET_INVALID(comm) ((comm)->c_flags |= OMPI_COMM_INVALID)
|
||||
|
@ -78,9 +78,10 @@ int MPI_Ineighbor_allgather(const void *sendbuf, int sendcount, MPI_Datatype sen
|
||||
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm) || !(OMPI_COMM_IS_CART(comm) || OMPI_COMM_IS_GRAPH(comm) ||
|
||||
OMPI_COMM_IS_DIST_GRAPH(comm))) {
|
||||
if (ompi_comm_invalid(comm) || OMPI_COMM_IS_INTER(comm)) {
|
||||
OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
||||
} else if (! OMPI_COMM_IS_TOPO(comm)) {
|
||||
OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TOPOLOGY, FUNC_NAME);
|
||||
} else if (MPI_DATATYPE_NULL == recvtype || NULL == recvtype) {
|
||||
err = MPI_ERR_TYPE;
|
||||
} else if (recvcount < 0) {
|
||||
|
@ -84,10 +84,12 @@ int MPI_Ineighbor_allgatherv(const void *sendbuf, int sendcount, MPI_Datatype se
|
||||
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm) || !(OMPI_COMM_IS_CART(comm) || OMPI_COMM_IS_GRAPH(comm) ||
|
||||
OMPI_COMM_IS_DIST_GRAPH(comm))) {
|
||||
if (ompi_comm_invalid(comm) || OMPI_COMM_IS_INTER(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
FUNC_NAME);
|
||||
} else if (! OMPI_COMM_IS_TOPO(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TOPOLOGY,
|
||||
FUNC_NAME);
|
||||
} else if (MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
|
||||
} else if (MPI_DATATYPE_NULL == recvtype) {
|
||||
|
@ -67,10 +67,12 @@ int MPI_Ineighbor_alltoall(const void *sendbuf, int sendcount, MPI_Datatype send
|
||||
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm) || !(OMPI_COMM_IS_CART(comm) || OMPI_COMM_IS_GRAPH(comm) ||
|
||||
OMPI_COMM_IS_DIST_GRAPH(comm))) {
|
||||
if (ompi_comm_invalid(comm) || OMPI_COMM_IS_INTER(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
FUNC_NAME);
|
||||
} else if (! OMPI_COMM_IS_TOPO(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TOPOLOGY,
|
||||
FUNC_NAME);
|
||||
} else if (MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
|
||||
FUNC_NAME);
|
||||
@ -81,12 +83,10 @@ int MPI_Ineighbor_alltoall(const void *sendbuf, int sendcount, MPI_Datatype send
|
||||
OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
|
||||
}
|
||||
|
||||
if (MPI_IN_PLACE != sendbuf && !OMPI_COMM_IS_INTER(comm)) {
|
||||
ompi_datatype_type_size(sendtype, &sendtype_size);
|
||||
ompi_datatype_type_size(recvtype, &recvtype_size);
|
||||
if ((sendtype_size*sendcount) != (recvtype_size*recvcount)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TRUNCATE, FUNC_NAME);
|
||||
}
|
||||
ompi_datatype_type_size(sendtype, &sendtype_size);
|
||||
ompi_datatype_type_size(recvtype, &recvtype_size);
|
||||
if ((sendtype_size*sendcount) != (recvtype_size*recvcount)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TRUNCATE, FUNC_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,13 +90,13 @@ int MPI_Ineighbor_alltoallv(const void *sendbuf, const int sendcounts[], const i
|
||||
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm) || !(OMPI_COMM_IS_CART(comm) || OMPI_COMM_IS_GRAPH(comm) ||
|
||||
OMPI_COMM_IS_DIST_GRAPH(comm))) {
|
||||
if (ompi_comm_invalid(comm) || OMPI_COMM_IS_INTER(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
FUNC_NAME);
|
||||
}
|
||||
|
||||
if ((NULL == sendcounts) || (NULL == sdispls) ||
|
||||
} else if (! OMPI_COMM_IS_TOPO(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TOPOLOGY,
|
||||
FUNC_NAME);
|
||||
} else if ((NULL == sendcounts) || (NULL == sdispls) ||
|
||||
(NULL == recvcounts) || (NULL == rdispls) ||
|
||||
MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
|
||||
|
@ -88,10 +88,12 @@ int MPI_Ineighbor_alltoallw(const void *sendbuf, const int sendcounts[], const M
|
||||
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm) || !(OMPI_COMM_IS_CART(comm) || OMPI_COMM_IS_GRAPH(comm) ||
|
||||
OMPI_COMM_IS_DIST_GRAPH(comm))) {
|
||||
if (ompi_comm_invalid(comm) || OMPI_COMM_IS_INTER(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
FUNC_NAME);
|
||||
} else if (! OMPI_COMM_IS_TOPO(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TOPOLOGY,
|
||||
FUNC_NAME);
|
||||
}
|
||||
|
||||
if ((NULL == sendcounts) || (NULL == sdispls) || (NULL == sendtypes) ||
|
||||
|
@ -78,8 +78,10 @@ int MPI_Neighbor_allgather(const void *sendbuf, int sendcount, MPI_Datatype send
|
||||
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm)) {
|
||||
if (ompi_comm_invalid(comm) || OMPI_COMM_IS_INTER(comm)) {
|
||||
OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
||||
} else if (! OMPI_COMM_IS_TOPO(comm)) {
|
||||
OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TOPOLOGY, FUNC_NAME);
|
||||
} else if (MPI_DATATYPE_NULL == recvtype || NULL == recvtype) {
|
||||
err = MPI_ERR_TYPE;
|
||||
} else if (recvcount < 0) {
|
||||
@ -94,21 +96,9 @@ int MPI_Neighbor_allgather(const void *sendbuf, int sendcount, MPI_Datatype send
|
||||
|
||||
/* Do we need to do anything? Everyone had to give the same send
|
||||
signature, which means that everyone must have given a
|
||||
sendcount > 0 if there's anything to send for the intra-communicator
|
||||
case. */
|
||||
if ( OMPI_COMM_IS_INTRA(comm) ) {
|
||||
if ((0 == sendcount) || (0 == recvcount)) {
|
||||
return MPI_SUCCESS;
|
||||
}
|
||||
} else if ( OMPI_COMM_IS_INTER(comm) ){
|
||||
/* for inter communicators, the communication pattern
|
||||
need not be symmetric. Specifically, one group is
|
||||
allows to have sendcount=0, while the other has
|
||||
a valid sendcount. Thus, the only way not to do
|
||||
anything is if both sendcount and recvcount are zero. */
|
||||
if ( 0 == sendcount && 0 == recvcount ) {
|
||||
return MPI_SUCCESS;
|
||||
}
|
||||
sendcount > 0. */
|
||||
if ((0 == sendcount) || (0 == recvcount)) {
|
||||
return MPI_SUCCESS;
|
||||
}
|
||||
|
||||
OPAL_CR_ENTER_LIBRARY();
|
||||
|
@ -84,10 +84,12 @@ int MPI_Neighbor_allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sen
|
||||
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm) || !(OMPI_COMM_IS_CART(comm) || OMPI_COMM_IS_GRAPH(comm) ||
|
||||
OMPI_COMM_IS_DIST_GRAPH(comm))) {
|
||||
if (ompi_comm_invalid(comm) || OMPI_COMM_IS_INTER(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
FUNC_NAME);
|
||||
} else if (! OMPI_COMM_IS_TOPO(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TOPOLOGY,
|
||||
FUNC_NAME);
|
||||
} else if (MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
|
||||
} else if (MPI_DATATYPE_NULL == recvtype) {
|
||||
|
@ -66,10 +66,12 @@ int MPI_Neighbor_alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendt
|
||||
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm) || !(OMPI_COMM_IS_CART(comm) || OMPI_COMM_IS_GRAPH(comm) ||
|
||||
OMPI_COMM_IS_DIST_GRAPH(comm))) {
|
||||
if (ompi_comm_invalid(comm) || OMPI_COMM_IS_INTER(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
FUNC_NAME);
|
||||
} else if (! OMPI_COMM_IS_TOPO(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TOPOLOGY,
|
||||
FUNC_NAME);
|
||||
} else if (MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
|
||||
FUNC_NAME);
|
||||
@ -80,12 +82,10 @@ int MPI_Neighbor_alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendt
|
||||
OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
|
||||
}
|
||||
|
||||
if (!OMPI_COMM_IS_INTER(comm)) {
|
||||
ompi_datatype_type_size(sendtype, &sendtype_size);
|
||||
ompi_datatype_type_size(recvtype, &recvtype_size);
|
||||
if ((sendtype_size*sendcount) != (recvtype_size*recvcount)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TRUNCATE, FUNC_NAME);
|
||||
}
|
||||
ompi_datatype_type_size(sendtype, &sendtype_size);
|
||||
ompi_datatype_type_size(recvtype, &recvtype_size);
|
||||
if ((sendtype_size*sendcount) != (recvtype_size*recvcount)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TRUNCATE, FUNC_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,13 +90,13 @@ int MPI_Neighbor_alltoallv(const void *sendbuf, const int sendcounts[], const in
|
||||
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm) || !(OMPI_COMM_IS_CART(comm) || OMPI_COMM_IS_GRAPH(comm) ||
|
||||
OMPI_COMM_IS_DIST_GRAPH(comm))) {
|
||||
if (ompi_comm_invalid(comm) || OMPI_COMM_IS_INTER(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
FUNC_NAME);
|
||||
}
|
||||
|
||||
if ((NULL == sendcounts) || (NULL == sdispls) ||
|
||||
} else if (! OMPI_COMM_IS_TOPO(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
FUNC_NAME);
|
||||
} else if ((NULL == sendcounts) || (NULL == sdispls) ||
|
||||
(NULL == recvcounts) || (NULL == rdispls) ||
|
||||
MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
|
||||
|
@ -86,13 +86,13 @@ int MPI_Neighbor_alltoallw(const void *sendbuf, const int sendcounts[], const MP
|
||||
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm) || !(OMPI_COMM_IS_CART(comm) || OMPI_COMM_IS_GRAPH(comm) ||
|
||||
OMPI_COMM_IS_DIST_GRAPH(comm))) {
|
||||
if (ompi_comm_invalid(comm) || OMPI_COMM_IS_INTER(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
FUNC_NAME);
|
||||
}
|
||||
|
||||
if ((NULL == sendcounts) || (NULL == sdispls) || (NULL == sendtypes) ||
|
||||
} else if (! OMPI_COMM_IS_TOPO(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TOPOLOGY,
|
||||
FUNC_NAME);
|
||||
} else if ((NULL == sendcounts) || (NULL == sdispls) || (NULL == sendtypes) ||
|
||||
(NULL == recvcounts) || (NULL == rdispls) || (NULL == recvtypes) ||
|
||||
MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user