-/* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-2019. 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. */
#include "smpi_comm.hpp"
#include "smpi_datatype_derived.hpp"
#include "smpi_op.hpp"
-#include "smpi_process.hpp"
+#include "src/smpi/include/smpi_actor.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
} else if (not datatype->is_valid()) {
retval = MPI_ERR_ARG;
} else {
- int rank = simgrid::s4u::this_actor::getPid();
+ int rank = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(rank, __func__,
new simgrid::instr::CollTIData("bcast", root, -1.0,
datatype->is_replayable() ? count : count * datatype->size(), -1,
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
} else {
- int rank = simgrid::s4u::this_actor::getPid();
+ int rank = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(rank, __func__, new simgrid::instr::NoOpTIData("barrier"));
simgrid::smpi::Colls::barrier(comm);
sendtmpcount=0;
sendtmptype=recvtype;
}
- int rank = simgrid::s4u::this_actor::getPid();
+ int rank = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(
rank, __func__,
retval = MPI_ERR_TYPE;
} else if (( sendbuf != MPI_IN_PLACE) && (sendcount <0)){
retval = MPI_ERR_COUNT;
- } else if (recvcounts == nullptr || displs == nullptr) {
+ } else if ((comm->rank() == root) && (recvcounts == nullptr || displs == nullptr)) {
retval = MPI_ERR_ARG;
} else {
char* sendtmpbuf = static_cast<char*>(sendbuf);
sendtmptype=recvtype;
}
- int rank = simgrid::s4u::this_actor::getPid();
+ int rank = simgrid::s4u::this_actor::get_pid();
int dt_size_recv = recvtype->is_replayable() ? 1 : recvtype->size();
std::vector<int>* trace_recvcounts = new std::vector<int>;
TRACE_smpi_comm_in(rank, __func__,
new simgrid::instr::VarCollTIData(
- "gatherV", root,
+ "gatherv", root,
sendtmptype->is_replayable() ? sendtmpcount : sendtmpcount * sendtmptype->size(), nullptr,
dt_size_recv, trace_recvcounts, simgrid::smpi::Datatype::encode(sendtmptype),
simgrid::smpi::Datatype::encode(recvtype)));
sendcount=recvcount;
sendtype=recvtype;
}
- int rank = simgrid::s4u::this_actor::getPid();
+ int rank = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(rank, __func__,
new simgrid::instr::CollTIData(
- "allGather", -1, -1.0, sendtype->is_replayable() ? sendcount : sendcount * sendtype->size(),
+ "allgather", -1, -1.0, sendtype->is_replayable() ? sendcount : sendcount * sendtype->size(),
recvtype->is_replayable() ? recvcount : recvcount * recvtype->size(),
simgrid::smpi::Datatype::encode(sendtype), simgrid::smpi::Datatype::encode(recvtype)));
sendcount=recvcounts[comm->rank()];
sendtype=recvtype;
}
- int rank = simgrid::s4u::this_actor::getPid();
+ int rank = simgrid::s4u::this_actor::get_pid();
int dt_size_recv = recvtype->is_replayable() ? 1 : recvtype->size();
std::vector<int>* trace_recvcounts = new std::vector<int>;
TRACE_smpi_comm_in(rank, __func__,
new simgrid::instr::VarCollTIData(
- "allGatherV", -1, sendtype->is_replayable() ? sendcount : sendcount * sendtype->size(),
+ "allgatherv", -1, sendtype->is_replayable() ? sendcount : sendcount * sendtype->size(),
nullptr, dt_size_recv, trace_recvcounts, simgrid::smpi::Datatype::encode(sendtype),
simgrid::smpi::Datatype::encode(recvtype)));
recvtype = sendtype;
recvcount = sendcount;
}
- int rank = simgrid::s4u::this_actor::getPid();
+ int rank = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(
rank, __func__,
recvtype = sendtype;
recvcount = sendcounts[comm->rank()];
}
- int rank = simgrid::s4u::this_actor::getPid();
+ int rank = simgrid::s4u::this_actor::get_pid();
int dt_size_send = sendtype->is_replayable() ? 1 : sendtype->size();
std::vector<int>* trace_sendcounts = new std::vector<int>;
TRACE_smpi_comm_in(rank, __func__,
new simgrid::instr::VarCollTIData(
- "scatterV", root, dt_size_send, trace_sendcounts,
+ "scatterv", root, dt_size_send, trace_sendcounts,
recvtype->is_replayable() ? recvcount : recvcount * recvtype->size(), nullptr,
simgrid::smpi::Datatype::encode(sendtype), simgrid::smpi::Datatype::encode(recvtype)));
} else if (not datatype->is_valid() || op == MPI_OP_NULL) {
retval = MPI_ERR_ARG;
} else {
- int rank = simgrid::s4u::this_actor::getPid();
+ int rank = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(rank, __func__,
new simgrid::instr::CollTIData("reduce", root, 0,
sendtmpbuf = static_cast<char*>(xbt_malloc(count*datatype->get_extent()));
simgrid::smpi::Datatype::copy(recvbuf, count, datatype,sendtmpbuf, count, datatype);
}
- int rank = simgrid::s4u::this_actor::getPid();
+ int rank = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(rank, __func__,
- new simgrid::instr::CollTIData("allReduce", -1, 0,
+ new simgrid::instr::CollTIData("allreduce", -1, 0,
datatype->is_replayable() ? count : count * datatype->size(), -1,
simgrid::smpi::Datatype::encode(datatype), ""));
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
} else {
- int rank = simgrid::s4u::this_actor::getPid();
-
+ int rank = simgrid::s4u::this_actor::get_pid();
+ void* sendtmpbuf = sendbuf;
+ if (sendbuf == MPI_IN_PLACE) {
+ sendtmpbuf = static_cast<void*>(xbt_malloc(count * datatype->size()));
+ memcpy(sendtmpbuf, recvbuf, count * datatype->size());
+ }
TRACE_smpi_comm_in(rank, __func__, new simgrid::instr::Pt2PtTIData(
"scan", -1, datatype->is_replayable() ? count : count * datatype->size(),
simgrid::smpi::Datatype::encode(datatype)));
- retval = simgrid::smpi::Colls::scan(sendbuf, recvbuf, count, datatype, op, comm);
+ retval = simgrid::smpi::Colls::scan(sendtmpbuf, recvbuf, count, datatype, op, comm);
TRACE_smpi_comm_out(rank);
+ if (sendbuf == MPI_IN_PLACE)
+ xbt_free(sendtmpbuf);
}
smpi_bench_begin();
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
} else {
- int rank = simgrid::s4u::this_actor::getPid();
+ int rank = simgrid::s4u::this_actor::get_pid();
void* sendtmpbuf = sendbuf;
if (sendbuf == MPI_IN_PLACE) {
sendtmpbuf = static_cast<void*>(xbt_malloc(count * datatype->size()));
} else if (recvcounts == nullptr) {
retval = MPI_ERR_ARG;
} else {
- int rank = simgrid::s4u::this_actor::getPid();
+ int rank = simgrid::s4u::this_actor::get_pid();
std::vector<int>* trace_recvcounts = new std::vector<int>;
int dt_send_size = datatype->is_replayable() ? 1 : datatype->size();
int totalcount = 0;
}
TRACE_smpi_comm_in(rank, __func__, new simgrid::instr::VarCollTIData(
- "reduceScatter", -1, dt_send_size, nullptr, -1, trace_recvcounts,
+ "reducescatter", -1, dt_send_size, nullptr, -1, trace_recvcounts,
simgrid::smpi::Datatype::encode(datatype), ""));
simgrid::smpi::Colls::reduce_scatter(sendtmpbuf, recvbuf, recvcounts, datatype, op, comm);
} else {
int count = comm->size();
- int rank = simgrid::s4u::this_actor::getPid();
+ int rank = simgrid::s4u::this_actor::get_pid();
int dt_send_size = datatype->is_replayable() ? 1 : datatype->size();
std::vector<int>* trace_recvcounts = new std::vector<int>(recvcount * dt_send_size); // copy data to avoid bad free
}
TRACE_smpi_comm_in(rank, __func__,
- new simgrid::instr::VarCollTIData("reduceScatter", -1, 0, nullptr, -1, trace_recvcounts,
+ new simgrid::instr::VarCollTIData("reducescatter", -1, 0, nullptr, -1, trace_recvcounts,
simgrid::smpi::Datatype::encode(datatype), ""));
int* recvcounts = new int[count];
} else if ((sendbuf != MPI_IN_PLACE && sendtype == MPI_DATATYPE_NULL) || recvtype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
} else {
- int rank = simgrid::s4u::this_actor::getPid();
+ int rank = simgrid::s4u::this_actor::get_pid();
void* sendtmpbuf = static_cast<char*>(sendbuf);
int sendtmpcount = sendcount;
MPI_Datatype sendtmptype = sendtype;
TRACE_smpi_comm_in(rank, __func__,
new simgrid::instr::CollTIData(
- "allToAll", -1, -1.0,
+ "alltoall", -1, -1.0,
sendtmptype->is_replayable() ? sendtmpcount : sendtmpcount * sendtmptype->size(),
recvtype->is_replayable() ? recvcount : recvcount * recvtype->size(),
simgrid::smpi::Datatype::encode(sendtmptype), simgrid::smpi::Datatype::encode(recvtype)));
recvdisps == nullptr) {
retval = MPI_ERR_ARG;
} else {
- int rank = simgrid::s4u::this_actor::getPid();
+ int rank = simgrid::s4u::this_actor::get_pid();
int size = comm->size();
int send_size = 0;
int recv_size = 0;
}
TRACE_smpi_comm_in(rank, __func__,
- new simgrid::instr::VarCollTIData("allToAllV", -1, send_size, trace_sendcounts, recv_size,
+ new simgrid::instr::VarCollTIData("alltoallv", -1, send_size, trace_sendcounts, recv_size,
trace_recvcounts, simgrid::smpi::Datatype::encode(sendtype),
simgrid::smpi::Datatype::encode(recvtype)));