Commit 3ac0b20e authored by Wesley Bland's avatar Wesley Bland
Browse files

Fix collective alias checks to look for zero-sized buffers



If the size of the input buffers is 0, don't bother to check if they are
aliased.

Fixes #2124
Signed-off-by: default avatarAntonio J. Pena <apenya@mcs.anl.gov>
parent b61fc702
...@@ -371,7 +371,7 @@ int MPI_Exscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datat ...@@ -371,7 +371,7 @@ int MPI_Exscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datat
} }
if (mpi_errno != MPI_SUCCESS) goto fn_fail; if (mpi_errno != MPI_SUCCESS) goto fn_fail;
if (sendbuf != MPI_IN_PLACE) if (sendbuf != MPI_IN_PLACE && count != 0)
MPIR_ERRTEST_ALIAS_COLL(sendbuf, recvbuf, mpi_errno); MPIR_ERRTEST_ALIAS_COLL(sendbuf, recvbuf, mpi_errno);
} }
MPID_END_ERROR_CHECKS; MPID_END_ERROR_CHECKS;
......
...@@ -306,7 +306,7 @@ int MPI_Iexscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype data ...@@ -306,7 +306,7 @@ int MPI_Iexscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype data
MPIR_ERRTEST_ARGNULL(request,"request", mpi_errno); MPIR_ERRTEST_ARGNULL(request,"request", mpi_errno);
if (sendbuf != MPI_IN_PLACE) if (sendbuf != MPI_IN_PLACE && count != 0)
MPIR_ERRTEST_ALIAS_COLL(sendbuf, recvbuf, mpi_errno); MPIR_ERRTEST_ALIAS_COLL(sendbuf, recvbuf, mpi_errno);
/* TODO more checks may be appropriate (counts, in_place, etc) */ /* TODO more checks may be appropriate (counts, in_place, etc) */
} }
......
...@@ -1082,6 +1082,7 @@ int MPI_Ireduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts ...@@ -1082,6 +1082,7 @@ int MPI_Ireduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts
int mpi_errno = MPI_SUCCESS; int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL; MPID_Comm *comm_ptr = NULL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_IREDUCE_SCATTER); MPID_MPI_STATE_DECL(MPID_STATE_MPI_IREDUCE_SCATTER);
int i = 0;
MPIU_THREAD_CS_ENTER(ALLFUNC,); MPIU_THREAD_CS_ENTER(ALLFUNC,);
MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IREDUCE_SCATTER); MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IREDUCE_SCATTER);
...@@ -1134,7 +1135,9 @@ int MPI_Ireduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts ...@@ -1134,7 +1135,9 @@ int MPI_Ireduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts
MPIR_ERRTEST_ARGNULL(request,"request", mpi_errno); MPIR_ERRTEST_ARGNULL(request,"request", mpi_errno);
if (comm_ptr->comm_kind == MPID_INTRACOMM && sendbuf != MPI_IN_PLACE) while (i < comm_ptr->remote_size && recvcounts[i] == 0) ++i;
if (comm_ptr->comm_kind == MPID_INTRACOMM && sendbuf != MPI_IN_PLACE && i < comm_ptr->remote_size)
MPIR_ERRTEST_ALIAS_COLL(sendbuf, recvbuf, mpi_errno) MPIR_ERRTEST_ALIAS_COLL(sendbuf, recvbuf, mpi_errno)
/* TODO more checks may be appropriate (counts, in_place, etc) */ /* TODO more checks may be appropriate (counts, in_place, etc) */
} }
......
...@@ -1035,7 +1035,7 @@ int MPI_Ireduce_scatter_block(const void *sendbuf, void *recvbuf, ...@@ -1035,7 +1035,7 @@ int MPI_Ireduce_scatter_block(const void *sendbuf, void *recvbuf,
MPIR_ERRTEST_ARGNULL(request,"request", mpi_errno); MPIR_ERRTEST_ARGNULL(request,"request", mpi_errno);
if (comm_ptr->comm_kind == MPID_INTRACOMM && sendbuf != MPI_IN_PLACE) if (comm_ptr->comm_kind == MPID_INTRACOMM && sendbuf != MPI_IN_PLACE && recvcount != 0)
MPIR_ERRTEST_ALIAS_COLL(sendbuf, recvbuf, mpi_errno) MPIR_ERRTEST_ALIAS_COLL(sendbuf, recvbuf, mpi_errno)
/* TODO more checks may be appropriate (counts, in_place, etc) */ /* TODO more checks may be appropriate (counts, in_place, etc) */
} }
......
...@@ -442,7 +442,7 @@ int MPI_Iscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype dataty ...@@ -442,7 +442,7 @@ int MPI_Iscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype dataty
MPIR_ERRTEST_ARGNULL(request,"request", mpi_errno); MPIR_ERRTEST_ARGNULL(request,"request", mpi_errno);
if (sendbuf != MPI_IN_PLACE) if (sendbuf != MPI_IN_PLACE && count != 0)
MPIR_ERRTEST_ALIAS_COLL(sendbuf, recvbuf, mpi_errno); MPIR_ERRTEST_ALIAS_COLL(sendbuf, recvbuf, mpi_errno);
/* TODO more checks may be appropriate (counts, in_place, etc) */ /* TODO more checks may be appropriate (counts, in_place, etc) */
} }
......
...@@ -1174,7 +1174,7 @@ int MPI_Reduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts[ ...@@ -1174,7 +1174,7 @@ int MPI_Reduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts[
MPIR_ERRTEST_RECVBUF_INPLACE(recvbuf, recvcounts[comm_ptr->rank], mpi_errno); MPIR_ERRTEST_RECVBUF_INPLACE(recvbuf, recvcounts[comm_ptr->rank], mpi_errno);
if (comm_ptr->comm_kind == MPID_INTERCOMM) { if (comm_ptr->comm_kind == MPID_INTERCOMM) {
MPIR_ERRTEST_SENDBUF_INPLACE(sendbuf, sum, mpi_errno); MPIR_ERRTEST_SENDBUF_INPLACE(sendbuf, sum, mpi_errno);
} else if (sendbuf != MPI_IN_PLACE) } else if (sendbuf != MPI_IN_PLACE && sum != 0)
MPIR_ERRTEST_ALIAS_COLL(sendbuf, recvbuf, mpi_errno) MPIR_ERRTEST_ALIAS_COLL(sendbuf, recvbuf, mpi_errno)
MPIR_ERRTEST_USERBUFFER(recvbuf,recvcounts[comm_ptr->rank],datatype,mpi_errno); MPIR_ERRTEST_USERBUFFER(recvbuf,recvcounts[comm_ptr->rank],datatype,mpi_errno);
......
...@@ -1138,7 +1138,7 @@ int MPI_Reduce_scatter_block(const void *sendbuf, void *recvbuf, ...@@ -1138,7 +1138,7 @@ int MPI_Reduce_scatter_block(const void *sendbuf, void *recvbuf,
MPIR_ERRTEST_RECVBUF_INPLACE(recvbuf, recvcount, mpi_errno); MPIR_ERRTEST_RECVBUF_INPLACE(recvbuf, recvcount, mpi_errno);
if (comm_ptr->comm_kind == MPID_INTERCOMM) { if (comm_ptr->comm_kind == MPID_INTERCOMM) {
MPIR_ERRTEST_SENDBUF_INPLACE(sendbuf, recvcount, mpi_errno); MPIR_ERRTEST_SENDBUF_INPLACE(sendbuf, recvcount, mpi_errno);
} else if (sendbuf != MPI_IN_PLACE) } else if (sendbuf != MPI_IN_PLACE && recvcount != 0)
MPIR_ERRTEST_ALIAS_COLL(sendbuf, recvbuf, mpi_errno) MPIR_ERRTEST_ALIAS_COLL(sendbuf, recvbuf, mpi_errno)
MPIR_ERRTEST_USERBUFFER(recvbuf,recvcount,datatype,mpi_errno); MPIR_ERRTEST_USERBUFFER(recvbuf,recvcount,datatype,mpi_errno);
......
...@@ -549,7 +549,7 @@ int MPI_Scan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatyp ...@@ -549,7 +549,7 @@ int MPI_Scan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatyp
} }
if (mpi_errno != MPI_SUCCESS) goto fn_fail; if (mpi_errno != MPI_SUCCESS) goto fn_fail;
if (sendbuf != MPI_IN_PLACE) if (sendbuf != MPI_IN_PLACE && count != 0)
MPIR_ERRTEST_ALIAS_COLL(sendbuf, recvbuf, mpi_errno); MPIR_ERRTEST_ALIAS_COLL(sendbuf, recvbuf, mpi_errno);
} }
MPID_END_ERROR_CHECKS; MPID_END_ERROR_CHECKS;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment