A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use nullptr for recvbuf when myrank != 0.
[simgrid.git]
/
src
/
smpi
/
mpi
/
smpi_comm.cpp
diff --git
a/src/smpi/mpi/smpi_comm.cpp
b/src/smpi/mpi/smpi_comm.cpp
index
e1cf7e6
..
84b9e95
100644
(file)
--- a/
src/smpi/mpi/smpi_comm.cpp
+++ b/
src/smpi/mpi/smpi_comm.cpp
@@
-242,9
+242,14
@@
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;
/* Gather all colors and keys on rank 0 */
const std::array<int, 2> sendbuf = {{color, key}};
std::vector<int> recvbuf;
- if (myrank == 0)
+ int* recvbuf_ptr;
+ if (myrank == 0) {
recvbuf.resize(2 * size);
recvbuf.resize(2 * size);
- gather__default(sendbuf.data(), 2, MPI_INT, recvbuf.data(), 2, MPI_INT, 0, this);
+ recvbuf_ptr = recvbuf.data();
+ } else {
+ recvbuf_ptr = nullptr;
+ }
+ gather__default(sendbuf.data(), 2, MPI_INT, recvbuf_ptr, 2, MPI_INT, 0, this);
/* Do the actual job */
if (myrank == 0) {
std::vector<MPI_Group> group_snd(size);
/* Do the actual job */
if (myrank == 0) {
std::vector<MPI_Group> group_snd(size);