X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6de03ecc4e630732984a0673512a5d15fd75e270..cd9affe6152d6bbec19a72ea6fe26ab9407b51b7:/src/smpi/colls/reduce-scatter-gather.c diff --git a/src/smpi/colls/reduce-scatter-gather.c b/src/smpi/colls/reduce-scatter-gather.c index 92249bd66c..30d5e6e9b4 100644 --- a/src/smpi/colls/reduce-scatter-gather.c +++ b/src/smpi/colls/reduce-scatter-gather.c @@ -33,9 +33,15 @@ int smpi_coll_tuned_reduce_scatter_gather(void *sendbuf, void *recvbuf, return 0; rank = smpi_comm_rank(comm); comm_size = smpi_comm_size(comm); + - extent = smpi_datatype_get_extent(datatype); + extent = smpi_datatype_get_extent(datatype); + /* If I'm not the root, then my recvbuf may not be valid, therefore + I have to allocate a temporary one */ + if (rank != root && !recvbuf) { + recvbuf = (void *)xbt_malloc(count * extent); + } /* find nearest power-of-two less than or equal to comm_size */ pof2 = 1; while (pof2 <= comm_size)