X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a2f1b23687f04169144f4ffb4f20dc4fc5c28395..15badc71ce964f6dae6428c9a4c0198fad5d4936:/src/smpi/colls/allreduce-rab-reduce-scatter.c?ds=sidebyside diff --git a/src/smpi/colls/allreduce-rab-reduce-scatter.c b/src/smpi/colls/allreduce-rab-reduce-scatter.c old mode 100755 new mode 100644 index 7a9eb2a96e..5650ef233d --- a/src/smpi/colls/allreduce-rab-reduce-scatter.c +++ b/src/smpi/colls/allreduce-rab-reduce-scatter.c @@ -1,4 +1,4 @@ -#include "colls.h" +#include "colls_private.h" #ifndef REDUCE_STUFF #define REDUCE_STUFF /***************************************************************************** @@ -341,19 +341,15 @@ int smpi_coll_tuned_allreduce_rab_reduce_scatter(void *sbuff, void *rbuff, MPI_Status status; void *tmp_buf = NULL; MPI_User_function *func = get_op_func(op); - MPI_Comm_size(comm, &nprocs); - MPI_Comm_rank(comm, &rank); - - MPI_Type_extent(dtype, &extent); - tmp_buf = (void *) malloc(count * extent); - if (!tmp_buf) { - printf("Could not allocate memory for tmp_buf\n"); - return 1; - } + nprocs = smpi_comm_size(comm); + rank = smpi_comm_rank(comm); + + extent = smpi_datatype_get_extent(dtype); + tmp_buf = (void *) xbt_malloc(count * extent); MPIR_Localcopy(sbuff, count, dtype, rbuff, count, dtype); - MPI_Type_size(dtype, &type_size); + type_size = smpi_datatype_size(dtype); // find nearest power-of-two less than or equal to comm_size pof2 = 1; @@ -409,8 +405,8 @@ int smpi_coll_tuned_allreduce_rab_reduce_scatter(void *sbuff, void *rbuff, // reduce-scatter, calculate the count that each process receives // and the displacement within the buffer - cnts = (int *) malloc(pof2 * sizeof(int)); - disps = (int *) malloc(pof2 * sizeof(int)); + cnts = (int *) xbt_malloc(pof2 * sizeof(int)); + disps = (int *) xbt_malloc(pof2 * sizeof(int)); for (i = 0; i < (pof2 - 1); i++) cnts[i] = count / pof2; @@ -521,5 +517,5 @@ int smpi_coll_tuned_allreduce_rab_reduce_scatter(void *sbuff, void *rbuff, } free(tmp_buf); - return 0; + return MPI_SUCCESS; }