X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/08e7455d67920bbd7a87f440d00f2c1e071314a0..ea74f5d95928a521a588737e81f1de94eef25d19:/src/smpi/colls/reduce_scatter/reduce_scatter-mpich.cpp diff --git a/src/smpi/colls/reduce_scatter/reduce_scatter-mpich.cpp b/src/smpi/colls/reduce_scatter/reduce_scatter-mpich.cpp index c8a101b485..3e3278a780 100644 --- a/src/smpi/colls/reduce_scatter/reduce_scatter-mpich.cpp +++ b/src/smpi/colls/reduce_scatter/reduce_scatter-mpich.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2021. 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 @@ -74,16 +74,16 @@ int reduce_scatter__mpich_pair(const void *sendbuf, void *recvbuf, const int rec if (sendbuf != MPI_IN_PLACE) Request::sendrecv(((char *)sendbuf+disps[dst]*extent), recvcounts[dst], datatype, dst, - COLL_TAG_SCATTER, tmp_recvbuf, + COLL_TAG_REDUCE_SCATTER, tmp_recvbuf, recvcounts[rank], datatype, src, - COLL_TAG_SCATTER, comm, + COLL_TAG_REDUCE_SCATTER, comm, MPI_STATUS_IGNORE); else Request::sendrecv(((char *)recvbuf+disps[dst]*extent), recvcounts[dst], datatype, dst, - COLL_TAG_SCATTER, tmp_recvbuf, + COLL_TAG_REDUCE_SCATTER, tmp_recvbuf, recvcounts[rank], datatype, src, - COLL_TAG_SCATTER, comm, + COLL_TAG_REDUCE_SCATTER, comm, MPI_STATUS_IGNORE); if (is_commutative || (src < rank)) { @@ -108,8 +108,11 @@ int reduce_scatter__mpich_pair(const void *sendbuf, void *recvbuf, const int rec /* copy result back into recvbuf */ mpi_errno = Datatype::copy(tmp_recvbuf, recvcounts[rank], datatype, recvbuf, recvcounts[rank], datatype); - if (mpi_errno) + if (mpi_errno) { + delete[] disps; + smpi_free_tmp_buffer(tmp_recvbuf); return (mpi_errno); + } } else { if (op != MPI_OP_NULL) @@ -117,8 +120,11 @@ int reduce_scatter__mpich_pair(const void *sendbuf, void *recvbuf, const int rec /* copy result back into recvbuf */ mpi_errno = Datatype::copy(tmp_recvbuf, recvcounts[rank], datatype, ((char*)recvbuf + disps[rank] * extent), recvcounts[rank], datatype); - if (mpi_errno) + if (mpi_errno) { + delete[] disps; + smpi_free_tmp_buffer(tmp_recvbuf); return (mpi_errno); + } } } } @@ -131,7 +137,11 @@ int reduce_scatter__mpich_pair(const void *sendbuf, void *recvbuf, const int rec recvcounts[rank], datatype, recvbuf, recvcounts[rank], datatype ); - if (mpi_errno) return(mpi_errno); + if (mpi_errno) { + delete[] disps; + smpi_free_tmp_buffer(tmp_recvbuf); + return (mpi_errno); + } } delete[] disps; @@ -220,9 +230,9 @@ int reduce_scatter__mpich_noncomm(const void *sendbuf, void *recvbuf, const int } Request::sendrecv(outgoing_data + send_offset*true_extent, - size, datatype, peer, COLL_TAG_SCATTER, + size, datatype, peer, COLL_TAG_REDUCE_SCATTER, incoming_data + recv_offset*true_extent, - size, datatype, peer, COLL_TAG_SCATTER, + size, datatype, peer, COLL_TAG_REDUCE_SCATTER, comm, MPI_STATUS_IGNORE); /* always perform the reduction at recv_offset, the data at send_offset is now our peer's responsibility */ @@ -307,8 +317,10 @@ int reduce_scatter__mpich_rdb(const void *sendbuf, void *recvbuf, const int recv else mpi_errno = Datatype::copy(recvbuf, total_count, datatype, tmp_results, total_count, datatype); - if (mpi_errno) + if (mpi_errno) { + delete[] disps; return (mpi_errno); + } mask = 0x1; i = 0; @@ -372,8 +384,8 @@ int reduce_scatter__mpich_rdb(const void *sendbuf, void *recvbuf, const int recv received in tmp_recvbuf and then accumulated into tmp_results. accumulation is done later below. */ - Request::sendrecv(tmp_results, 1, sendtype, dst, COLL_TAG_SCATTER, tmp_recvbuf, 1, recvtype, dst, - COLL_TAG_SCATTER, comm, MPI_STATUS_IGNORE); + Request::sendrecv(tmp_results, 1, sendtype, dst, COLL_TAG_REDUCE_SCATTER, tmp_recvbuf, 1, recvtype, dst, + COLL_TAG_REDUCE_SCATTER, comm, MPI_STATUS_IGNORE); received = 1; } @@ -411,12 +423,12 @@ int reduce_scatter__mpich_rdb(const void *sendbuf, void *recvbuf, const int recv can send if they have the data */ if ((dst > rank) && (rank < tree_root + nprocs_completed) && (dst >= tree_root + nprocs_completed)) { /* send the current result */ - Request::send(tmp_recvbuf, 1, recvtype, dst, COLL_TAG_SCATTER, comm); + Request::send(tmp_recvbuf, 1, recvtype, dst, COLL_TAG_REDUCE_SCATTER, comm); } /* recv only if this proc. doesn't have data and sender has data */ else if ((dst < rank) && (dst < tree_root + nprocs_completed) && (rank >= tree_root + nprocs_completed)) { - Request::recv(tmp_recvbuf, 1, recvtype, dst, COLL_TAG_SCATTER, comm, MPI_STATUS_IGNORE); + Request::recv(tmp_recvbuf, 1, recvtype, dst, COLL_TAG_REDUCE_SCATTER, comm, MPI_STATUS_IGNORE); received = 1; } tmp_mask >>= 1;