-/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-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. */
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Startall"));
if (not TRACE_smpi_view_internals())
for (int i = 0; i < count; i++) {
- MPI_Request req = requests[i];
+ const simgrid::smpi::Request* req = requests[i];
if (req->flags() & MPI_REQ_SEND)
TRACE_smpi_send(my_proc_id, my_proc_id, getPid(req->comm(), req->dst()), req->tag(), req->size());
}
if (not TRACE_smpi_view_internals())
for (int i = 0; i < count; i++) {
- MPI_Request req = requests[i];
+ const simgrid::smpi::Request* req = requests[i];
if (req->flags() & MPI_REQ_RECV)
TRACE_smpi_recv(getPid(req->comm(), req->src()), my_proc_id, req->tag());
}
int src_traced = getPid(comm, src);
// FIXME: Hack the way to trace this one
- std::vector<int>* dst_hack = new std::vector<int>();
- std::vector<int>* src_hack = new std::vector<int>();
+ auto* dst_hack = new std::vector<int>();
+ auto* src_hack = new std::vector<int>();
dst_hack->push_back(dst_traced);
src_hack->push_back(src_traced);
TRACE_smpi_comm_in(my_proc_id, __func__,
int size = datatype->get_extent() * count;
xbt_assert(size > 0);
- void* recvbuf = xbt_new0(char, size);
- retval = MPI_Sendrecv(buf, count, datatype, dst, sendtag, recvbuf, count, datatype, src, recvtag, comm, status);
+ std::vector<char> recvbuf(size);
+ retval =
+ MPI_Sendrecv(buf, count, datatype, dst, sendtag, recvbuf.data(), count, datatype, src, recvtag, comm, status);
if(retval==MPI_SUCCESS){
- simgrid::smpi::Datatype::copy(recvbuf, count, datatype, buf, count, datatype);
+ simgrid::smpi::Datatype::copy(recvbuf.data(), count, datatype, buf, count, datatype);
}
- xbt_free(recvbuf);
return retval;
}
}
// TODO: cheinrich: Move declaration to other file? Rename this function - it's used for PMPI_Wait*?
-static void trace_smpi_recv_helper(MPI_Request* request, MPI_Status* status);
static void trace_smpi_recv_helper(MPI_Request* request, MPI_Status* status)
{
- MPI_Request req = *request;
+ const simgrid::smpi::Request* req = *request;
if (req != MPI_REQUEST_NULL) { // Received requests become null
int src_traced = req->src();
// the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE)
MPI_Request savedreq = *request;
if (savedreq != MPI_REQUEST_NULL && not(savedreq->flags() & MPI_REQ_FINISHED)
&& not(savedreq->flags() & MPI_REQ_GENERALIZED))
- savedreq->ref();//don't erase te handle in Request::wait, we'll need it later
+ savedreq->ref();//don't erase the handle in Request::wait, we'll need it later
else
savedreq = MPI_REQUEST_NULL;
*flag=1;
simgrid::smpi::Status::empty(status);
return MPI_SUCCESS;
- } else if (flag==NULL || status ==NULL){
+ } else if (flag == nullptr || status == nullptr) {
return MPI_ERR_ARG;
}
return simgrid::smpi::Request::get_status(request,flag,status);
MPI_Request PMPI_Request_f2c(MPI_Fint request){
if(request==-1)
return MPI_REQUEST_NULL;
- return static_cast<MPI_Request>(simgrid::smpi::Request::f2c(request));
+ return simgrid::smpi::Request::f2c(request);
}
MPI_Fint PMPI_Request_c2f(MPI_Request request) {