Error checking for MPI_IN_PLACE
This commit was SVN r7343.
Этот коммит содержится в:
родитель
ee58631c82
Коммит
ad647b105d
@ -44,12 +44,14 @@ int MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
|
||||
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm)) {
|
||||
if (ompi_comm_invalid(comm)) {
|
||||
OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
||||
} else if (MPI_DATATYPE_NULL == recvtype) {
|
||||
} else if (MPI_DATATYPE_NULL == recvtype) {
|
||||
err = MPI_ERR_TYPE;
|
||||
} else if (recvcount < 0) {
|
||||
err = MPI_ERR_COUNT;
|
||||
} else if (MPI_IN_PLACE == recvbuf) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
|
||||
} else {
|
||||
OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcount);
|
||||
}
|
||||
|
@ -44,9 +44,11 @@ int MPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
|
||||
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
if (ompi_comm_invalid(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
FUNC_NAME);
|
||||
} else if (MPI_IN_PLACE == recvbuf) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
|
||||
}
|
||||
|
||||
OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcount);
|
||||
|
@ -51,6 +51,8 @@ int MPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,
|
||||
err = MPI_ERR_TYPE;
|
||||
} else if (recvcount < 0) {
|
||||
err = MPI_ERR_COUNT;
|
||||
} else if (MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
|
||||
err = MPI_ERR_ARG;
|
||||
} else {
|
||||
OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcount);
|
||||
}
|
||||
|
@ -45,12 +45,13 @@ int MPI_Alltoallv(void *sendbuf, int *sendcounts, int *sdispls,
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
FUNC_NAME);
|
||||
}
|
||||
|
||||
if ((NULL == sendcounts) || (NULL == sdispls) ||
|
||||
(NULL == recvcounts) || (NULL == rdispls)) {
|
||||
(NULL == recvcounts) || (NULL == rdispls) ||
|
||||
MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
|
||||
}
|
||||
|
||||
|
@ -45,12 +45,13 @@ int MPI_Alltoallw(void *sendbuf, int *sendcounts, int *sdispls,
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
FUNC_NAME);
|
||||
}
|
||||
|
||||
if ((NULL == sendcounts) || (NULL == sdispls) || (NULL == sendtypes) ||
|
||||
(NULL == recvcounts) || (NULL == rdispls) || (NULL == recvtypes)) {
|
||||
(NULL == recvcounts) || (NULL == rdispls) || (NULL == recvtypes) ||
|
||||
MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ int MPI_Bcast(void *buffer, int count, MPI_Datatype datatype,
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
FUNC_NAME);
|
||||
}
|
||||
|
||||
@ -47,6 +47,9 @@ int MPI_Bcast(void *buffer, int count, MPI_Datatype datatype,
|
||||
|
||||
OMPI_CHECK_DATATYPE_FOR_SEND(err, datatype, count);
|
||||
OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
|
||||
if (MPI_IN_PLACE == buffer) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
|
||||
}
|
||||
|
||||
/* Errors for intracommunicators */
|
||||
|
||||
@ -61,7 +64,7 @@ int MPI_Bcast(void *buffer, int count, MPI_Datatype datatype,
|
||||
else {
|
||||
if (! ((root >= 0 && root < ompi_comm_remote_size(comm)) ||
|
||||
MPI_ROOT == root || MPI_PROC_NULL == root)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ROOT, FUNC_NAME);
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ROOT, FUNC_NAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,9 +40,12 @@ int MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
FUNC_NAME);
|
||||
}
|
||||
} else if ((ompi_comm_rank(comm) != root && MPI_IN_PLACE == sendbuf) ||
|
||||
MPI_IN_PLACE == recvbuf) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
|
||||
}
|
||||
|
||||
/* Errors for intracommunicators */
|
||||
|
||||
|
@ -40,8 +40,11 @@ int MPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
FUNC_NAME);
|
||||
} else if ((ompi_comm_rank(comm) != root && MPI_IN_PLACE == sendbuf) ||
|
||||
MPI_IN_PLACE == recvbuf) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
|
||||
}
|
||||
|
||||
/* Errors for intracommunicators */
|
||||
|
@ -40,9 +40,9 @@ int MPI_Reduce(void *sendbuf, void *recvbuf, int count,
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
FUNC_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
/* Checks for all ranks */
|
||||
|
||||
@ -52,6 +52,9 @@ int MPI_Reduce(void *sendbuf, void *recvbuf, int count,
|
||||
datatype->id < DT_MAX_PREDEFINED &&
|
||||
-1 == ompi_op_ddt_map[datatype->id]) {
|
||||
err = MPI_ERR_OP;
|
||||
} else if ((root != ompi_comm_rank(comm) && MPI_IN_PLACE == sendbuf) ||
|
||||
MPI_IN_PLACE == recvbuf) {
|
||||
err = MPI_ERR_ARG;
|
||||
} else {
|
||||
OMPI_CHECK_DATATYPE_FOR_SEND(err, datatype, count);
|
||||
}
|
||||
|
@ -40,13 +40,13 @@ int MPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
FUNC_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
/* Unrooted operation; same checks for all ranks on both
|
||||
intracommunicators and intercommunicators */
|
||||
|
||||
|
||||
else if (MPI_OP_NULL == op) {
|
||||
err = MPI_ERR_OP;
|
||||
} else if (ompi_op_is_intrinsic(op) &&
|
||||
@ -55,13 +55,15 @@ int MPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
|
||||
err = MPI_ERR_OP;
|
||||
} else if (NULL == recvcounts) {
|
||||
err = MPI_ERR_COUNT;
|
||||
} else if (MPI_IN_PLACE == recvbuf) {
|
||||
err = MPI_ERR_ARG;
|
||||
}
|
||||
OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
|
||||
|
||||
/* We always define the remote group to be the same as the local
|
||||
group in the case of an intracommunicator, so it's safe to
|
||||
get the size of the remote group here for both intra- and
|
||||
intercommunicators */
|
||||
/* We always define the remote group to be the same as the
|
||||
local group in the case of an intracommunicator, so it's
|
||||
safe to get the size of the remote group here for both
|
||||
intra- and intercommunicators */
|
||||
|
||||
size = ompi_comm_size(comm);
|
||||
for (i = 0; i < size; ++i) {
|
||||
|
@ -40,9 +40,9 @@ int MPI_Scan(void *sendbuf, void *recvbuf, int count,
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
FUNC_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
/* No intercommunicators allowed! (MPI does not define
|
||||
MPI_SCAN on intercommunicators) */
|
||||
@ -52,10 +52,12 @@ int MPI_Scan(void *sendbuf, void *recvbuf, int count,
|
||||
}
|
||||
|
||||
/* Unrooted operation; checks for all ranks */
|
||||
|
||||
else if (MPI_OP_NULL == op) {
|
||||
|
||||
else if (MPI_OP_NULL == op) {
|
||||
err = MPI_ERR_OP;
|
||||
} else if (ompi_op_is_intrinsic(op) &&
|
||||
} else if (MPI_IN_PLACE == recvbuf) {
|
||||
err = MPI_ERR_ARG;
|
||||
} else if (ompi_op_is_intrinsic(op) &&
|
||||
datatype->id < DT_MAX_PREDEFINED &&
|
||||
-1 == ompi_op_ddt_map[datatype->id]) {
|
||||
err = MPI_ERR_OP;
|
||||
|
@ -41,9 +41,12 @@ int MPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
FUNC_NAME);
|
||||
}
|
||||
} else if ((ompi_comm_rank(comm) != root && MPI_IN_PLACE == recvbuf) ||
|
||||
MPI_IN_PLACE == sendbuf) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
|
||||
}
|
||||
|
||||
/* Errors for intracommunicators */
|
||||
|
||||
|
@ -40,9 +40,12 @@ int MPI_Scatterv(void *sendbuf, int *sendcounts, int *displs,
|
||||
err = MPI_SUCCESS;
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (ompi_comm_invalid(comm)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
||||
FUNC_NAME);
|
||||
}
|
||||
} else if ((ompi_comm_rank(comm) != root && MPI_IN_PLACE == recvbuf) ||
|
||||
MPI_IN_PLACE == sendbuf) {
|
||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
|
||||
}
|
||||
|
||||
/* Errors for intracommunicators */
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user