Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
more informative error message when checking params of MPI_Iallgather
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 18 Aug 2019 14:21:56 +0000 (16:21 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 18 Aug 2019 15:21:58 +0000 (17:21 +0200)
src/smpi/bindings/smpi_pmpi_coll.cpp
teshsuite/smpi/coll-allgather/coll-allgather.c
teshsuite/smpi/coll-allgather/coll-allgather.tesh

index 2fb0a1d..0147374 100644 (file)
@@ -213,16 +213,17 @@ int PMPI_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 int PMPI_Iallgather(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
                     MPI_Datatype recvtype, MPI_Comm comm, MPI_Request* request)
 {
 int PMPI_Iallgather(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
                     MPI_Datatype recvtype, MPI_Comm comm, MPI_Request* request)
 {
-  if (comm == MPI_COMM_NULL)
-    return MPI_ERR_COMM;
-  if ((sendbuf == nullptr && sendcount > 0) || (recvbuf == nullptr))
-    return MPI_ERR_BUFFER;
-  if (((sendbuf != MPI_IN_PLACE) && (sendtype == MPI_DATATYPE_NULL)) || (recvtype == MPI_DATATYPE_NULL))
-    return MPI_ERR_TYPE;
-  if (((sendbuf != MPI_IN_PLACE) && (sendcount < 0)) || (recvcount < 0))
-    return MPI_ERR_COUNT;
-  if (request == nullptr)
-    return MPI_ERR_ARG;
+  CHECK_ARGS(comm == MPI_COMM_NULL, MPI_ERR_COMM, "Iallgather: the communicator cannot be MPI_COMM_NULL");
+  CHECK_ARGS(recvbuf == nullptr, MPI_ERR_BUFFER, "Iallgather: param 4 recvbuf cannot be NULL");
+  CHECK_ARGS(sendbuf == nullptr && sendcount > 0, MPI_ERR_BUFFER,
+             "Iallgather: param 1 sendbuf cannot be NULL when sendcound > 0");
+  CHECK_ARGS((sendbuf != MPI_IN_PLACE) && (sendtype == MPI_DATATYPE_NULL), MPI_ERR_TYPE,
+             "Iallgather: param 3 sendtype cannot be MPI_DATATYPE_NULL when sendbuff is not MPI_IN_PLACE");
+  CHECK_ARGS(recvtype == MPI_DATATYPE_NULL, MPI_ERR_TYPE, "Iallgather: param 6 recvtype cannot be MPI_DATATYPE_NULL");
+  CHECK_ARGS(recvcount < 0, MPI_ERR_COUNT, "Iallgather: param 5 recvcount cannot be negative");
+  CHECK_ARGS((sendbuf != MPI_IN_PLACE) && (sendcount < 0), MPI_ERR_COUNT,
+             "Iallgather: param 2 sendcount cannot be negative when sendbuf is not MPI_IN_PLACE");
+  CHECK_ARGS(request == nullptr, MPI_ERR_ARG, "Iallgather: param 8 request cannot be NULL");
 
   smpi_bench_end();
   if (sendbuf == MPI_IN_PLACE) {
 
   smpi_bench_end();
   if (sendbuf == MPI_IN_PLACE) {
index 787a3bb..57dbbdd 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2009-2019. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2009-2019. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
index d18ded9..b3db84e 100644 (file)
@@ -2,7 +2,7 @@
 ! output sort
 
 p Test allgather
 ! output sort
 
 p Test allgather
-$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-allgather --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error --log=smpi_mpi.thres:error
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-allgather --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error --log=smpi_pmpi.thres:error --log=smpi_mpi.thres:error
 > [rank 0] -> Tremblay
 > [rank 1] -> Tremblay
 > [rank 2] -> Tremblay
 > [rank 0] -> Tremblay
 > [rank 1] -> Tremblay
 > [rank 2] -> Tremblay