X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/271068c7d949ed959313b055466e13539485bc2c..8be89720f55b4ceeb2877531ae1602cc7ed947d6:/src/smpi/colls/smpi_mpich_selector.cpp diff --git a/src/smpi/colls/smpi_mpich_selector.cpp b/src/smpi/colls/smpi_mpich_selector.cpp index 3c0f27abb9..d01a1a8714 100644 --- a/src/smpi/colls/smpi_mpich_selector.cpp +++ b/src/smpi/colls/smpi_mpich_selector.cpp @@ -1,6 +1,6 @@ /* selector for collective algorithms based on mpich decision logic */ -/* Copyright (c) 2009-2019. The SimGrid Team. +/* Copyright (c) 2009-2023. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -8,6 +8,8 @@ #include "colls_private.hpp" +#include + /* This is the default implementation of allreduce. The algorithm is: Algorithm: MPI_Allreduce @@ -56,8 +58,7 @@ End Algorithm: MPI_Allreduce */ -namespace simgrid{ -namespace smpi{ +namespace simgrid::smpi { int allreduce__mpich(const void *sbuf, void *rbuf, int count, MPI_Datatype dtype, MPI_Op op, MPI_Comm comm) { @@ -69,7 +70,7 @@ int allreduce__mpich(const void *sbuf, void *rbuf, int count, block_dsize = dsize * count; /*MPICH uses SMP algorithms for all commutative ops now*/ - if(!comm->is_smp_comm()){ + if (not comm->is_smp_comm()) { if(comm->get_leaders_comm()==MPI_COMM_NULL){ comm->init_smp(); } @@ -263,7 +264,7 @@ int bcast__mpich(void *buff, int count, //int segsize = 0; size_t message_size, dsize; - if(!comm->is_smp_comm()){ + if (not comm->is_smp_comm()) { if(comm->get_leaders_comm()==MPI_COMM_NULL){ comm->init_smp(); } @@ -359,7 +360,7 @@ int reduce__mpich(const void *sendbuf, void *recvbuf, int communicator_size=0; size_t message_size, dsize; - if(!comm->is_smp_comm()){ + if (not comm->is_smp_comm()) { if(comm->get_leaders_comm()==MPI_COMM_NULL){ comm->init_smp(); } @@ -457,10 +458,10 @@ int reduce_scatter__mpich(const void *sbuf, void *rbuf, if( (op==MPI_OP_NULL || op->is_commutative()) && total_message_size > 524288) { return reduce_scatter__mpich_pair(sbuf, rbuf, rcounts, dtype, op, comm); } else if ((op != MPI_OP_NULL && not op->is_commutative())) { - int is_block_regular = 1; + bool is_block_regular = true; for (i = 0; i < (comm_size - 1); ++i) { if (rcounts[i] != rcounts[i + 1]) { - is_block_regular = 0; + is_block_regular = false; break; } } @@ -695,13 +696,11 @@ int scatter__mpich(const void *sbuf, int scount, { std::unique_ptr tmp_buf; if(comm->rank()!=root){ - tmp_buf.reset(new unsigned char[rcount * rdtype->get_extent()]); + tmp_buf = std::make_unique(rcount * rdtype->get_extent()); sbuf = tmp_buf.get(); scount = rcount; sdtype = rdtype; } return scatter__ompi_binomial(sbuf, scount, sdtype, rbuf, rcount, rdtype, root, comm); } -} -} - +} // namespace simgrid::smpi