Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Revert "Use nullptr for recvbuf when myrank != 0."
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 22 Nov 2020 09:11:20 +0000 (10:11 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 22 Nov 2020 13:42:58 +0000 (14:42 +0100)
This reverts commit cc88d06e4fd1c32dddf17295ff750c60792588e5.

As expected it makes no difference, and it's simpler.

src/smpi/mpi/smpi_comm.cpp

index 84b9e95..e1cf7e6 100644 (file)
@@ -242,14 +242,9 @@ MPI_Comm Comm::split(int color, int key)
   /* Gather all colors and keys on rank 0 */
   const std::array<int, 2> sendbuf = {{color, key}};
   std::vector<int> recvbuf;
-  int* recvbuf_ptr;
-  if (myrank == 0) {
+  if (myrank == 0)
     recvbuf.resize(2 * size);
-    recvbuf_ptr = recvbuf.data();
-  } else {
-    recvbuf_ptr = nullptr;
-  }
-  gather__default(sendbuf.data(), 2, MPI_INT, recvbuf_ptr, 2, MPI_INT, 0, this);
+  gather__default(sendbuf.data(), 2, MPI_INT, recvbuf.data(), 2, MPI_INT, 0, this);
   /* Do the actual job */
   if (myrank == 0) {
     std::vector<MPI_Group> group_snd(size);