X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/67d66b0cf79b9fc02c0450f254584693dbf21d3b..cd5185ae774cc99650b6cae2dca17b6062accea3:/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 fa765dfa96..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-2021. 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); @@ -464,7 +465,10 @@ int PMPI_Test(MPI_Request * request, int *flag, MPI_Status * status) } else { aid_t my_proc_id = ((*request)->comm() != MPI_COMM_NULL) ? simgrid::s4u::this_actor::get_pid() : -1; - TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("test")); + TRACE_smpi_comm_in(my_proc_id, __func__, + new simgrid::instr::WaitTIData("test", MPI_COMM_WORLD->group()->rank((*request)->src()), + MPI_COMM_WORLD->group()->rank((*request)->dst()), + (*request)->tag())); retval = simgrid::smpi::Request::test(request,status, flag); TRACE_smpi_comm_out(my_proc_id); @@ -599,7 +603,7 @@ int PMPI_Wait(MPI_Request * request, MPI_Status * status) aid_t my_proc_id = (*request)->comm() != MPI_COMM_NULL ? simgrid::s4u::this_actor::get_pid() : -1; TRACE_smpi_comm_in(my_proc_id, __func__, - new simgrid::instr::WaitTIData(MPI_COMM_WORLD->group()->rank((*request)->src()), + new simgrid::instr::WaitTIData("wait", MPI_COMM_WORLD->group()->rank((*request)->src()), MPI_COMM_WORLD->group()->rank((*request)->dst()), (*request)->tag()));