Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
relax some constraints
authorAugustin Degomme <adegomme@users.noreply.github.com>
Fri, 5 Apr 2019 06:59:35 +0000 (08:59 +0200)
committerAugustin Degomme <adegomme@users.noreply.github.com>
Fri, 5 Apr 2019 06:59:35 +0000 (08:59 +0200)
src/smpi/bindings/smpi_pmpi_coll.cpp

index 99eea0e..415f126 100644 (file)
@@ -53,7 +53,7 @@ int PMPI_Ibcast(void *buf, int count, MPI_Datatype datatype,
 {
   if (comm == MPI_COMM_NULL) {
     return MPI_ERR_COMM;
 {
   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;
     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;
     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))){
             ((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;
 {
   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))){
     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;
 
   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)){
     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;
 {
   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;
     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) ||
              ((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;
     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 (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;
     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 (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;
     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;
 
   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;
     retval = MPI_ERR_BUFFER;
   } else if ((sendbuf != MPI_IN_PLACE && sendtype == MPI_DATATYPE_NULL) || recvtype == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;