-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-2018. 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. */
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
/* PMPI User level calls */
-extern "C" { // Obviously, the C MPI interface should use the C linkage
int PMPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm)
{
} else if (not datatype->is_valid()) {
retval = MPI_ERR_ARG;
} else {
- int rank = comm->rank();
+ int rank = simgrid::s4u::Actor::self()->getPid();
TRACE_smpi_comm_in(rank, __FUNCTION__,
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 = comm->rank();
+ int rank = simgrid::s4u::Actor::self()->getPid();
TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::NoOpTIData("barrier"));
simgrid::smpi::Colls::barrier(comm);
sendtmptype=recvtype;
}
- int rank = comm->rank();
+ int rank = simgrid::s4u::Actor::self()->getPid();
int dt_size_recv = recvtype->is_replayable() ? 1 : recvtype->size();
std::vector<int>* trace_recvcounts = new std::vector<int>;
sendcount=recvcount;
sendtype=recvtype;
}
- int rank = comm->rank();
+ int rank = simgrid::s4u::Actor::self()->getPid();
TRACE_smpi_comm_in(rank, __FUNCTION__,
new simgrid::instr::CollTIData("allGather", -1, -1.0,
sendcount=recvcounts[comm->rank()];
sendtype=recvtype;
}
- int rank = comm->rank();
+ int rank = simgrid::s4u::Actor::self()->getPid();
int dt_size_recv = recvtype->is_replayable() ? 1 : recvtype->size();
std::vector<int>* trace_recvcounts = new std::vector<int>;
recvtype = sendtype;
recvcount = sendcounts[comm->rank()];
}
- int rank = comm->rank();
+ int rank = simgrid::s4u::Actor::self()->getPid();
int dt_size_send = sendtype->is_replayable() ? 1 : sendtype->size();
std::vector<int>* trace_sendcounts = new std::vector<int>;
} else if (not datatype->is_valid() || op == MPI_OP_NULL) {
retval = MPI_ERR_ARG;
} else {
- int rank = comm->rank();
+ int rank = simgrid::s4u::Actor::self()->getPid();
TRACE_smpi_comm_in(rank, __FUNCTION__,
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 = comm->rank();
+ int rank = simgrid::s4u::Actor::self()->getPid();
TRACE_smpi_comm_in(rank, __FUNCTION__,
new simgrid::instr::CollTIData("allReduce", -1, 0,
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
} else {
- int rank = comm->rank();
+ int rank = simgrid::s4u::Actor::self()->getPid();
TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::Pt2PtTIData(
"scan", -1, datatype->is_replayable() ? count : count * datatype->size(),
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
} else {
- int rank = comm->rank();
+ int rank = simgrid::s4u::Actor::self()->getPid();
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 = comm->rank();
+ int rank = simgrid::s4u::Actor::self()->getPid();
std::vector<int>* trace_recvcounts = new std::vector<int>;
int dt_send_size = datatype->is_replayable() ? 1 : datatype->size();
int totalcount = 0;
} else {
int count = comm->size();
- int rank = comm->rank();
+ int rank = simgrid::s4u::Actor::self()->getPid();
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
} else if ((sendbuf != MPI_IN_PLACE && sendtype == MPI_DATATYPE_NULL) || recvtype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
} else {
- int rank = comm->rank();
+ int rank = simgrid::s4u::Actor::self()->getPid();
void* sendtmpbuf = static_cast<char*>(sendbuf);
int sendtmpcount = sendcount;
MPI_Datatype sendtmptype = sendtype;
recvdisps == nullptr) {
retval = MPI_ERR_ARG;
} else {
- int rank = comm->rank();
+ int rank = simgrid::s4u::Actor::self()->getPid();
int size = comm->size();
int send_size = 0;
int recv_size = 0;
smpi_bench_begin();
return retval;
}
-
-}