X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/149c63f36e15b8500b1e826bda5138318ff7ba2b..85b6c08c26f9da9041c315d3e9cbd4f20f8db9ff:/src/smpi/colls/smpi_default_selector.cpp diff --git a/src/smpi/colls/smpi_default_selector.cpp b/src/smpi/colls/smpi_default_selector.cpp index 64fdcf7175..8d449de47c 100644 --- a/src/smpi/colls/smpi_default_selector.cpp +++ b/src/smpi/colls/smpi_default_selector.cpp @@ -1,6 +1,6 @@ /* selector with default/naive Simgrid algorithms. These should not be trusted for performance evaluations */ -/* 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. */ @@ -39,10 +39,20 @@ int reduce_scatter__default(const void *sendbuf, void *recvbuf, const int *recvc int size = comm->size(); int count = 0; int* displs = new int[size]; + int regular=1; for (int i = 0; i < size; i++) { + if(recvcounts[i]!=recvcounts[0]){ + regular=0; + break; + } displs[i] = count; count += recvcounts[i]; } + if(not regular){ + delete[] displs; + return reduce_scatter__mpich(sendbuf, recvbuf, recvcounts, datatype, op, comm); + } + unsigned char* tmpbuf = smpi_get_tmp_sendbuffer(count * datatype->get_extent()); int ret = reduce__default(sendbuf, tmpbuf, count, datatype, op, 0, comm); @@ -67,13 +77,10 @@ int allgatherv__default(const void *sendbuf, int sendcount, MPI_Datatype sendtyp { MPI_Request request; colls::iallgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm, &request, 0); - MPI_Request* requests = request->get_nbc_requests(); - int count = request->get_nbc_requests_size(); - Request::waitall(count, requests, MPI_STATUS_IGNORE); - for (int other = 0; other < count; other++) { - Request::unref(&requests[other]); - } - delete[] requests; + auto requests = request->get_nbc_requests(); + Request::waitall(requests.size(), requests.data(), MPI_STATUS_IGNORE); + for(auto& req: requests) + Request::unref(&req); Request::unref(&request); return MPI_SUCCESS; }