X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b7ed19dfcc221d7b3eca182abb5c4a3946671172..72d32c4e88a57f4786f62fec48a1bfa454adbff9:/src/smpi/colls/allgatherv/allgatherv-mpich-ring.cpp diff --git a/src/smpi/colls/allgatherv/allgatherv-mpich-ring.cpp b/src/smpi/colls/allgatherv/allgatherv-mpich-ring.cpp index 273bf6246e..a7c6564f27 100644 --- a/src/smpi/colls/allgatherv/allgatherv-mpich-ring.cpp +++ b/src/smpi/colls/allgatherv/allgatherv-mpich-ring.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014. 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 @@ -10,7 +10,7 @@ * See COPYRIGHT in top-level directory. */ -#include "../colls_private.h" +#include "../colls_private.hpp" /***************************************************************************** * Function: allgather_mpich_ring @@ -25,17 +25,15 @@ * comm: communication ****************************************************************************/ -namespace simgrid{ -namespace smpi{ +namespace simgrid::smpi { -int -Coll_allgatherv_mpich_ring::allgatherv(void *sendbuf, int sendcount, - MPI_Datatype send_type, void *recvbuf, - int *recvcounts, int *displs, MPI_Datatype recvtype, - MPI_Comm comm) +int allgatherv__mpich_ring(const void *sendbuf, int sendcount, + MPI_Datatype send_type, void *recvbuf, + const int *recvcounts, const int *displs, MPI_Datatype recvtype, + MPI_Comm comm) { - char * sbuf = NULL, * rbuf = NULL; + char *sbuf = nullptr, *rbuf = nullptr; int soffset, roffset; int torecv=0, tosend=0, min, rank, comm_size; int sendnow, recvnow; @@ -72,7 +70,7 @@ Coll_allgatherv_mpich_ring::allgatherv(void *sendbuf, int sendcount, min = 32768*8 / recvtype_extent; /* Handle the case where the datatype extent is larger than * the pipeline size. */ - if (!min) + if (not min) min = 1; sidx = rank; @@ -86,25 +84,23 @@ Coll_allgatherv_mpich_ring::allgatherv(void *sendbuf, int sendcount, rbuf = (char *)recvbuf + ((displs[ridx] + roffset) * recvtype_extent); /* Protect against wrap-around of indices */ - if (!tosend) + if (not tosend) sendnow = 0; - if (!torecv) + if (not torecv) recvnow = 0; /* Communicate */ - if (!sendnow && !recvnow) { - /* Don't do anything. This case is possible if two - * consecutive processes contribute 0 bytes each. */ - } - else if (!sendnow) { /* If there's no data to send, just do a recv call */ - Request::recv(rbuf, recvnow, recvtype, left, COLL_TAG_ALLGATHERV, comm, &status); + if (not sendnow && not recvnow) { + /* Don't do anything. This case is possible if two + * consecutive processes contribute 0 bytes each. */ + } else if (not sendnow) { /* If there's no data to send, just do a recv call */ + Request::recv(rbuf, recvnow, recvtype, left, COLL_TAG_ALLGATHERV, comm, &status); - torecv -= recvnow; - } - else if (!recvnow) { /* If there's no data to receive, just do a send call */ - Request::send(sbuf, sendnow, recvtype, right, COLL_TAG_ALLGATHERV, comm); + torecv -= recvnow; + } else if (not recvnow) { /* If there's no data to receive, just do a send call */ + Request::send(sbuf, sendnow, recvtype, right, COLL_TAG_ALLGATHERV, comm); - tosend -= sendnow; + tosend -= sendnow; } else { /* There's data to be sent and received */ Request::sendrecv(sbuf, sendnow, recvtype, right, COLL_TAG_ALLGATHERV, @@ -129,5 +125,4 @@ Coll_allgatherv_mpich_ring::allgatherv(void *sendbuf, int sendcount, return MPI_SUCCESS; } -} -} +} // namespace simgrid::smpi