From b954df99c86d6573276700063c663f676c7cda6e Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Fri, 5 Apr 2019 08:59:35 +0200 Subject: [PATCH 1/1] relax some constraints --- src/smpi/bindings/smpi_pmpi_coll.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/smpi/bindings/smpi_pmpi_coll.cpp b/src/smpi/bindings/smpi_pmpi_coll.cpp index 99eea0e2cd..415f12692c 100644 --- a/src/smpi/bindings/smpi_pmpi_coll.cpp +++ b/src/smpi/bindings/smpi_pmpi_coll.cpp @@ -53,7 +53,7 @@ int PMPI_Ibcast(void *buf, int count, MPI_Datatype datatype, { if (comm == MPI_COMM_NULL) { return MPI_ERR_COMM; - } if (buf == nullptr) { + } if (buf == nullptr && count > 0) { return MPI_ERR_BUFFER; } else if (datatype == MPI_DATATYPE_NULL || not datatype->is_valid()) { return MPI_ERR_TYPE; @@ -97,7 +97,7 @@ int PMPI_Igather(void *sendbuf, int sendcount, MPI_Datatype sendtype,void *recvb return MPI_ERR_COMM; } else if ((sendbuf == nullptr) || ((comm->rank() == root) && recvbuf == nullptr)) { return MPI_ERR_BUFFER; - } else if ((( sendbuf != MPI_IN_PLACE) && (sendtype == MPI_DATATYPE_NULL)) || + } else if (((sendbuf != MPI_IN_PLACE && sendcount > 0) && (sendtype == MPI_DATATYPE_NULL)) || ((comm->rank() == root) && (recvtype == MPI_DATATYPE_NULL))){ return MPI_ERR_TYPE; } else if ((( sendbuf != MPI_IN_PLACE) && (sendcount <0)) || ((comm->rank() == root) && (recvcount <0))){ @@ -144,7 +144,7 @@ int PMPI_Igatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *rec { if (comm == MPI_COMM_NULL) { return MPI_ERR_COMM; - } else if ((sendbuf == nullptr) || ((comm->rank() == root) && recvbuf == nullptr)) { + } else if ((sendbuf == nullptr && sendcount > 0) || ((comm->rank() == root) && recvbuf == nullptr)) { return MPI_ERR_BUFFER; } else if ((( sendbuf != MPI_IN_PLACE) && (sendtype == MPI_DATATYPE_NULL)) || ((comm->rank() == root) && (recvtype == MPI_DATATYPE_NULL))){ @@ -211,7 +211,7 @@ int PMPI_Iallgather(void *sendbuf, int sendcount, MPI_Datatype sendtype, if (comm == MPI_COMM_NULL) { retval = MPI_ERR_COMM; - } else if ((sendbuf == nullptr) || (recvbuf == nullptr)){ + } else if ((sendbuf == nullptr && sendcount > 0) || (recvbuf == nullptr)){ retval = MPI_ERR_BUFFER; } else if ((( sendbuf != MPI_IN_PLACE) && (sendtype == MPI_DATATYPE_NULL)) || (recvtype == MPI_DATATYPE_NULL)){ @@ -254,7 +254,7 @@ int PMPI_Iallgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, { if (comm == MPI_COMM_NULL) { return MPI_ERR_COMM; - } else if ((sendbuf == nullptr) || (recvbuf == nullptr)){ + } else if ((sendbuf == nullptr && sendcount > 0) || (recvbuf == nullptr)){ return MPI_ERR_BUFFER; } else if (((sendbuf != MPI_IN_PLACE) && (sendtype == MPI_DATATYPE_NULL)) || (recvtype == MPI_DATATYPE_NULL)) { return MPI_ERR_TYPE; @@ -316,7 +316,8 @@ int PMPI_Iscatter(void *sendbuf, int sendcount, MPI_Datatype sendtype, ((recvbuf != MPI_IN_PLACE) && (recvcount < 0))) { return MPI_ERR_COUNT; } else if ((sendbuf == recvbuf) || - ((comm->rank()==root) && sendcount>0 && (sendbuf == nullptr)) || (recvbuf == nullptr)){ + ((comm->rank()==root) && sendcount>0 && (sendbuf == nullptr)) || + (recvcount > 0 && recvbuf == nullptr)){ return MPI_ERR_BUFFER; } else if (root < 0 || root >= comm->size()){ return MPI_ERR_ROOT; @@ -416,7 +417,7 @@ int PMPI_Ireduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, { if (comm == MPI_COMM_NULL) { return MPI_ERR_COMM; - } if ((sendbuf == nullptr) || ((comm->rank() == root) && recvbuf == nullptr)) { + } if ((sendbuf == nullptr && count > 0) || ((comm->rank() == root) && recvbuf == nullptr)) { return MPI_ERR_BUFFER; } else if (datatype == MPI_DATATYPE_NULL || not datatype->is_valid()){ return MPI_ERR_TYPE; @@ -474,7 +475,7 @@ int PMPI_Iallreduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype dataty { if (comm == MPI_COMM_NULL) { return MPI_ERR_COMM; - } if ((sendbuf == nullptr) || (recvbuf == nullptr)) { + } if ((sendbuf == nullptr && count > 0) || (recvbuf == nullptr)) { return MPI_ERR_BUFFER; } else if (datatype == MPI_DATATYPE_NULL || not datatype->is_valid()) { return MPI_ERR_TYPE; @@ -740,7 +741,7 @@ int PMPI_Ialltoall(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* re if (comm == MPI_COMM_NULL) { retval = MPI_ERR_COMM; - } else if (sendbuf == nullptr || recvbuf == nullptr) { + } else if ((sendbuf == nullptr && sendcount > 0) || (recvbuf == nullptr && recvcount > 0)) { retval = MPI_ERR_BUFFER; } else if ((sendbuf != MPI_IN_PLACE && sendtype == MPI_DATATYPE_NULL) || recvtype == MPI_DATATYPE_NULL) { retval = MPI_ERR_TYPE; -- 2.20.1