X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/befbbbe1fbb31663a8f91e24ce12df271cf4ae79..72d32c4e88a57f4786f62fec48a1bfa454adbff9:/src/smpi/colls/allgatherv/allgatherv-ompi-bruck.cpp diff --git a/src/smpi/colls/allgatherv/allgatherv-ompi-bruck.cpp b/src/smpi/colls/allgatherv/allgatherv-ompi-bruck.cpp index 3874163fcc..8b089894f2 100644 --- a/src/smpi/colls/allgatherv/allgatherv-ompi-bruck.cpp +++ b/src/smpi/colls/allgatherv/allgatherv-ompi-bruck.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2017. The SimGrid Team. +/* Copyright (c) 2013-2022. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -20,7 +20,7 @@ * Additional copyrights may follow */ -#include "../colls_private.h" +#include "../colls_private.hpp" /* * ompi_coll_tuned_allgatherv_intra_bruck * @@ -77,29 +77,25 @@ * [6] [6] [6] [6] [6] [6] [6] */ -namespace simgrid{ -namespace smpi{ +namespace simgrid::smpi { -int Coll_allgatherv_ompi_bruck::allgatherv(void *sbuf, int scount, - MPI_Datatype sdtype, - void *rbuf, int *rcounts, - int *rdispls, - MPI_Datatype rdtype, - MPI_Comm comm) +int allgatherv__ompi_bruck(const void *sbuf, int scount, + MPI_Datatype sdtype, + void *rbuf, const int *rcounts, + const int *rdispls, + MPI_Datatype rdtype, + MPI_Comm comm) { int sendto, recvfrom, blockcount, i; unsigned int distance; - int *new_rcounts = NULL, *new_rdispls = NULL; - int *new_scounts = NULL, *new_sdispls = NULL; ptrdiff_t slb, rlb, sext, rext; - char *tmpsend = NULL, *tmprecv = NULL; + char *tmpsend = nullptr, *tmprecv = nullptr; MPI_Datatype new_rdtype = MPI_DATATYPE_NULL, new_sdtype = MPI_DATATYPE_NULL; unsigned int size = comm->size(); unsigned int rank = comm->rank(); - XBT_DEBUG( - "coll:tuned:allgather_ompi_bruck rank %d", rank); + XBT_DEBUG("coll:tuned:allgather_ompi_bruck rank %u", rank); sdtype->extent(&slb, &sext); @@ -127,10 +123,10 @@ int Coll_allgatherv_ompi_bruck::allgatherv(void *sbuf, int scount, - blockcount doubles until the last step when only the remaining data is exchanged. */ - new_rcounts = (int*) calloc(4*size, sizeof(int)); - new_rdispls = new_rcounts + size; - new_scounts = new_rdispls + size; - new_sdispls = new_scounts + size; + int* new_rcounts = new int[4 * size]; + int* new_rdispls = new_rcounts + size; + int* new_scounts = new_rdispls + size; + int* new_sdispls = new_scounts + size; for (distance = 1; distance < size; distance<<=1) { @@ -171,12 +167,10 @@ int Coll_allgatherv_ompi_bruck::allgatherv(void *sbuf, int scount, } - free(new_rcounts); + delete[] new_rcounts; return MPI_SUCCESS; } - -} -} +} // namespace simgrid::smpi