X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d656f9465e7b1c36319f86eeafdcec58fe9551a4..d5cc61332edae35867a41bb38ad9401faaab2716:/src/smpi/colls/allreduce/allreduce-rab-rdb.cpp diff --git a/src/smpi/colls/allreduce/allreduce-rab-rdb.cpp b/src/smpi/colls/allreduce/allreduce-rab-rdb.cpp index ea216ccb20..90a44d2680 100644 --- a/src/smpi/colls/allreduce/allreduce-rab-rdb.cpp +++ b/src/smpi/colls/allreduce/allreduce-rab-rdb.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2017. The SimGrid Team. +/* Copyright (c) 2013-2019. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -7,14 +7,13 @@ #include "../colls_private.hpp" namespace simgrid{ namespace smpi{ -int Coll_allreduce_rab_rdb::allreduce(void *sbuff, void *rbuff, int count, +int Coll_allreduce_rab_rdb::allreduce(const void *sbuff, void *rbuff, int count, MPI_Datatype dtype, MPI_Op op, MPI_Comm comm) { int tag = COLL_TAG_ALLREDUCE; unsigned int mask, pof2, i, recv_idx, last_idx, send_idx, send_cnt; - int dst, newrank, rem, newdst, - recv_cnt, *cnts, *disps; + int dst, newrank, rem, newdst, recv_cnt; MPI_Aint extent; MPI_Status status; void *tmp_buf = NULL; @@ -81,8 +80,8 @@ int Coll_allreduce_rab_rdb::allreduce(void *sbuff, void *rbuff, int count, // reduce-scatter, calculate the count that each process receives // and the displacement within the buffer - cnts = (int *) xbt_malloc(pof2 * sizeof(int)); - disps = (int *) xbt_malloc(pof2 * sizeof(int)); + int* cnts = new int[pof2]; + int* disps = new int[pof2]; for (i = 0; i < (pof2 - 1); i++) cnts[i] = count / pof2; @@ -177,9 +176,8 @@ int Coll_allreduce_rab_rdb::allreduce(void *sbuff, void *rbuff, int count, mask >>= 1; } - free(cnts); - free(disps); - + delete[] cnts; + delete[] disps; } // In the non-power-of-two case, all odd-numbered processes of // rank < 2 * rem send the result to (rank-1), the ranks who didn't