X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c7ce8ccc6a8a0c6096ba2cce7763cea1adc15fd1..5dd78326c18ad61561204c0d11470890cd12d091:/src/smpi/bindings/smpi_pmpi_request.cpp diff --git a/src/smpi/bindings/smpi_pmpi_request.cpp b/src/smpi/bindings/smpi_pmpi_request.cpp index 15092682d9..94bb62be2a 100644 --- a/src/smpi/bindings/smpi_pmpi_request.cpp +++ b/src/smpi/bindings/smpi_pmpi_request.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2022. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2023. 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. */ @@ -297,8 +297,7 @@ int PMPI_Bsend(const void* buf, int count, MPI_Datatype datatype, int dst, int t int bsend_buf_size = 0; void* bsend_buf = nullptr; smpi_process()->bsend_buffer(&bsend_buf, &bsend_buf_size); - int size = datatype->get_extent() * count; - if (bsend_buf == nullptr || bsend_buf_size < size + MPI_BSEND_OVERHEAD) + if (bsend_buf == nullptr || bsend_buf_size < datatype->get_extent() * count + MPI_BSEND_OVERHEAD) return MPI_ERR_BUFFER; TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::Pt2PtTIData("bsend", MPI_COMM_WORLD->group()->rank(dst_traced), @@ -322,8 +321,7 @@ int PMPI_Ibsend(const void* buf, int count, MPI_Datatype datatype, int dst, int int bsend_buf_size = 0; void* bsend_buf = nullptr; smpi_process()->bsend_buffer(&bsend_buf, &bsend_buf_size); - int size = datatype->get_extent() * count; - if (bsend_buf == nullptr || bsend_buf_size < size + MPI_BSEND_OVERHEAD) + if (bsend_buf == nullptr || bsend_buf_size < datatype->get_extent() * count + MPI_BSEND_OVERHEAD) return MPI_ERR_BUFFER; TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::Pt2PtTIData("ibsend", MPI_COMM_WORLD->group()->rank(trace_dst), @@ -439,7 +437,10 @@ int PMPI_Sendrecv_replace(void* buf, int count, MPI_Datatype datatype, int dst, CHECK_BUFFER(1, buf, count, datatype) int size = datatype->get_extent() * count; - xbt_assert(size > 0); + if (size == 0) + return MPI_SUCCESS; + else if (size <0) + return MPI_ERR_ARG; std::vector recvbuf(size); retval = MPI_Sendrecv(buf, count, datatype, dst, sendtag, recvbuf.data(), count, datatype, src, recvtag, comm, status);