Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of https://framagit.org/simgrid/simgrid
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Mon, 8 Apr 2019 07:03:16 +0000 (09:03 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Mon, 8 Apr 2019 07:03:16 +0000 (09:03 +0200)
src/smpi/bindings/smpi_pmpi_coll.cpp
src/smpi/include/smpi_actor.hpp
src/smpi/internals/smpi_actor.cpp
teshsuite/smpi/mpich3-test/init/testlist
teshsuite/smpi/privatization/privatization.c
teshsuite/smpi/pt2pt-dsend/pt2pt-dsend.c
teshsuite/smpi/pt2pt-pingpong/pt2pt-pingpong.c

index 415f126..2eb62c2 100644 (file)
@@ -417,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 && count > 0) || ((comm->rank() == root) && recvbuf == nullptr)) {
+  } else 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;
@@ -475,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 && count > 0) || (recvbuf == nullptr)) {
+  } else 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;
@@ -534,6 +534,8 @@ int PMPI_Iscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, M
     retval = MPI_ERR_ARG;
   } else if (count < 0){
     retval = MPI_ERR_COUNT;
+  } else if (sendbuf == nullptr || recvbuf == nullptr){
+    retval = MPI_ERR_BUFFER;
   } else {
     int rank = simgrid::s4u::this_actor::get_pid();
     void* sendtmpbuf = sendbuf;
@@ -580,6 +582,8 @@ int PMPI_Iexscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
     retval = MPI_ERR_ARG;
   } else if (count < 0){
     retval = MPI_ERR_COUNT;
+  } else if (sendbuf == nullptr || recvbuf == nullptr){
+    retval = MPI_ERR_BUFFER;
   } else {
     int rank         = simgrid::s4u::this_actor::get_pid();
     void* sendtmpbuf = sendbuf;
@@ -756,7 +760,9 @@ int PMPI_Ialltoall(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* re
     MPI_Datatype sendtmptype = sendtype;
     if (sendbuf == MPI_IN_PLACE) {
       sendtmpbuf = static_cast<void*>(xbt_malloc(recvcount * comm->size() * recvtype->size()));
-      memcpy(sendtmpbuf, recvbuf, recvcount * comm->size() * recvtype->size());
+      //memcpy(??,nullptr,0) is actually undefined behavor, even if harmless.
+      if(recvbuf != nullptr)
+        memcpy(sendtmpbuf, recvbuf, recvcount * comm->size() * recvtype->size());
       sendtmpcount = recvcount;
       sendtmptype  = recvtype;
     }
index 97d4d2b..0986429 100644 (file)
@@ -31,7 +31,11 @@ class ActorExt {
   smpi_trace_call_location_t trace_call_loc_;
   s4u::ActorPtr actor_                           = nullptr;
   smpi_privatization_region_t privatized_region_ = nullptr;
-  int optind                                     = 1; /*for getopt replacement */
+#ifdef __linux__
+  int optind_                                     = 0; /*for getopt replacement */
+#else
+  int optind_                                     = 1; /*for getopt replacement */
+#endif
   std::string tracing_category_                  = "";
 
 #if HAVE_PAPI
index e657ab9..0a9a96d 100644 (file)
@@ -246,11 +246,11 @@ void ActorExt::init()
 
 int ActorExt::get_optind()
 {
-  return optind;
+  return optind_;
 }
 void ActorExt::set_optind(int new_optind)
 {
-  optind = new_optind;
+  optind_ = new_optind;
 }
 
 } // namespace smpi
index b2e20fb..4e14874 100644 (file)
@@ -6,4 +6,4 @@ version 1
 finalized 1
 #needs PMPI_Comm_free_keyval
 #attrself 1
-library_version 1 mpiversion=3.0
+library_version 1
index 9a9e963..25668c8 100644 (file)
@@ -6,7 +6,8 @@
 
 static int myvalue = 0;
 static void test_opts(int* argc, char **argv[]){
-  int found = 0, ret;
+  int found = 0;
+  int ret;
   static struct option long_options[] = {
   {"long",     no_argument, 0,  0 },
   {0,         0,                 0,  0 }
index b2fbc21..84217e9 100644 (file)
@@ -12,7 +12,8 @@
 XBT_LOG_NEW_DEFAULT_CATEGORY(dsend,"the dsend test");
 
 static void test_opts(int* argc, char **argv[]){
-  int found = 0, ret;
+  int found = 0;
+  int ret;
   int option_index = 0;
   static struct option long_options[] = {
   {"long",     no_argument, 0,  0 },
index 6ddb623..c46ea33 100644 (file)
 #include <mpi.h>
 
 static void test_opts(int* argc, char **argv[]){
-  int found = 0, ret;
+  int found = 0;
+  int ret;
   while ((ret = getopt(*argc, *argv, "s")) >= 0)
   {
-    switch (ret) {
-    case 's':
+    if (ret == 's')
       found = 1;
-      break;
-    }
   }
   if (found!=1){
     printf("(smpi_)getopt failed ! \n");