X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/149c63f36e15b8500b1e826bda5138318ff7ba2b..39c935d6d5ee86d153f6f7e6a10d723ae7c57f6f:/src/smpi/colls/smpi_coll.cpp diff --git a/src/smpi/colls/smpi_coll.cpp b/src/smpi/colls/smpi_coll.cpp index 65ea83831a..5d75930996 100644 --- a/src/smpi/colls/smpi_coll.cpp +++ b/src/smpi/colls/smpi_coll.cpp @@ -1,6 +1,6 @@ /* smpi_coll.c -- various optimized routing for collectives */ -/* Copyright (c) 2009-2020. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2009-2021. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -20,7 +20,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_coll, smpi, "Logging specific to SMPI colle namespace simgrid { namespace smpi { -std::map> smpi_coll_descriptions( +std::map, std::less<>> smpi_coll_descriptions( {{std::string("gather"), {{"default", "gather default collective", (void*)gather__default}, {"ompi", "gather ompi collective", (void*)gather__ompi}, @@ -248,12 +248,11 @@ static s_mpi_coll_description_t* find_coll_description(const std::string& collec if (table->empty()) xbt_die("No registered algorithm for collective '%s'! This is a bug.", collective.c_str()); - for (unsigned long i = 0; i < table->size(); i++) { - auto desc = &table->at(i); - if (algo == desc->name) { - if (desc->name != "default") - XBT_INFO("Switch to algorithm %s for collective %s", desc->name.c_str(), collective.c_str()); - return desc; + for (auto& desc : *table) { + if (algo == desc.name) { + if (desc.name != "default") + XBT_INFO("Switch to algorithm %s for collective %s", desc.name.c_str(), collective.c_str()); + return &desc; } } @@ -361,8 +360,8 @@ int colls::scan(const void* sendbuf, void* recvbuf, int count, MPI_Datatype data Datatype::copy(sendbuf, count, datatype, recvbuf, count, datatype); // Send/Recv buffers to/from others - MPI_Request* requests = new MPI_Request[size - 1]; - unsigned char** tmpbufs = new unsigned char*[rank]; + auto* requests = new MPI_Request[size - 1]; + auto** tmpbufs = new unsigned char*[rank]; int index = 0; for (int other = 0; other < rank; other++) { tmpbufs[index] = smpi_get_tmp_sendbuffer(count * dataext); @@ -383,7 +382,7 @@ int colls::scan(const void* sendbuf, void* recvbuf, int count, MPI_Datatype data break; } if(index < rank) { - // #Request is below rank: it's a irecv + // #Request is below rank: it's an irecv op->apply( tmpbufs[index], recvbuf, &count, datatype); } } @@ -419,8 +418,8 @@ int colls::exscan(const void* sendbuf, void* recvbuf, int count, MPI_Datatype da datatype->extent(&lb, &dataext); // Send/Recv buffers to/from others - MPI_Request* requests = new MPI_Request[size - 1]; - unsigned char** tmpbufs = new unsigned char*[rank]; + auto* requests = new MPI_Request[size - 1]; + auto** tmpbufs = new unsigned char*[rank]; int index = 0; for (int other = 0; other < rank; other++) { tmpbufs[index] = smpi_get_tmp_sendbuffer(count * dataext); @@ -445,7 +444,7 @@ int colls::exscan(const void* sendbuf, void* recvbuf, int count, MPI_Datatype da Datatype::copy(tmpbufs[index], count, datatype, recvbuf, count, datatype); recvbuf_is_empty=0; } else - // #Request is below rank: it's a irecv + // #Request is below rank: it's an irecv op->apply( tmpbufs[index], recvbuf, &count, datatype); } }