void TRACE_smpi_set_category(const char *category)
{
//need to end bench otherwise categories for execution tasks are wrong
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
+
if (category != nullptr) {
// declare category
TRACE_category(category);
smpi_process()->set_tracing_category(category);
}
- //begin bench after changing process's category
- smpi_bench_begin();
}
/* PMPI User level calls */
CHECK_COMM(1)
CHECK_REQUEST(2)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t pid = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(pid, request == MPI_REQUEST_IGNORED ? "PMPI_Barrier" : "PMPI_Ibarrier",
new simgrid::instr::NoOpTIData(request == MPI_REQUEST_IGNORED ? "barrier" : "ibarrier"));
simgrid::smpi::colls::ibarrier(comm, request);
TRACE_smpi_comm_out(pid);
- smpi_bench_begin();
return MPI_SUCCESS;
}
CHECK_ROOT(4)
CHECK_REQUEST(6)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t pid = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(pid, request == MPI_REQUEST_IGNORED ? "PMPI_Bcast" : "PMPI_Ibcast",
new simgrid::instr::CollTIData(request == MPI_REQUEST_IGNORED ? "bcast" : "ibcast", root, -1.0,
}
TRACE_smpi_comm_out(pid);
- smpi_bench_begin();
return MPI_SUCCESS;
}
}
}
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t pid = simgrid::s4u::this_actor::get_pid();
request);
TRACE_smpi_comm_out(pid);
- smpi_bench_begin();
return MPI_SUCCESS;
}
}
}
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
const void* real_sendbuf = sendbuf;
int real_sendcount = sendcount;
MPI_Datatype real_sendtype = sendtype;
root, comm, request);
TRACE_smpi_comm_out(pid);
- smpi_bench_begin();
return MPI_SUCCESS;
}
return MPI_ERR_TRUNCATE;
}
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t pid = simgrid::s4u::this_actor::get_pid();
simgrid::smpi::colls::iallgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm, request);
TRACE_smpi_comm_out(pid);
- smpi_bench_begin();
return MPI_SUCCESS;
}
CHECK_BUFFER(4, recvbuf, recvcounts[i], recvtype)
}
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
if (sendbuf == MPI_IN_PLACE) {
sendbuf = static_cast<char*>(recvbuf) + recvtype->get_extent() * displs[comm->rank()];
sendcount = recvcounts[comm->rank()];
request);
TRACE_smpi_comm_out(pid);
- smpi_bench_begin();
return MPI_SUCCESS;
}
return MPI_ERR_TRUNCATE;
}
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t pid = simgrid::s4u::this_actor::get_pid();
simgrid::smpi::colls::iscatter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm, request);
TRACE_smpi_comm_out(pid);
- smpi_bench_begin();
return MPI_SUCCESS;
}
CHECK_NOT_IN_PLACE_ROOT(4, recvbuf)
}
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t pid = simgrid::s4u::this_actor::get_pid();
int dt_size_send = sendtype->is_replayable() ? 1 : sendtype->size();
request);
TRACE_smpi_comm_out(pid);
- smpi_bench_begin();
return MPI_SUCCESS;
}
CHECK_ROOT(7)
CHECK_REQUEST(8)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t pid = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(pid, request == MPI_REQUEST_IGNORED ? "PMPI_Reduce" : "PMPI_Ireduce",
simgrid::smpi::colls::ireduce(sendbuf, recvbuf, count, datatype, op, root, comm, request);
TRACE_smpi_comm_out(pid);
- smpi_bench_begin();
return MPI_SUCCESS;
}
CHECK_BUFFER(2, inoutbuf, count, datatype)
CHECK_OP(5, op, datatype)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
op->apply(inbuf, inoutbuf, &count, datatype);
- smpi_bench_begin();
return MPI_SUCCESS;
}
CHECK_BUFFER(2, recvbuf, count, datatype)
CHECK_REQUEST(7)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
std::vector<unsigned char> tmp_sendbuf;
const void* real_sendbuf = smpi_get_in_place_buf(sendbuf, recvbuf, tmp_sendbuf, count, datatype);
simgrid::smpi::colls::iallreduce(real_sendbuf, recvbuf, count, datatype, op, comm, request);
TRACE_smpi_comm_out(pid);
- smpi_bench_begin();
return MPI_SUCCESS;
}
CHECK_REQUEST(7)
CHECK_OP(5, op, datatype)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t pid = simgrid::s4u::this_actor::get_pid();
std::vector<unsigned char> tmp_sendbuf;
const void* real_sendbuf = smpi_get_in_place_buf(sendbuf, recvbuf, tmp_sendbuf, count, datatype);
retval = simgrid::smpi::colls::iscan(real_sendbuf, recvbuf, count, datatype, op, comm, request);
TRACE_smpi_comm_out(pid);
- smpi_bench_begin();
return retval;
}
CHECK_REQUEST(7)
CHECK_OP(5, op, datatype)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t pid = simgrid::s4u::this_actor::get_pid();
std::vector<unsigned char> tmp_sendbuf;
const void* real_sendbuf = smpi_get_in_place_buf(sendbuf, recvbuf, tmp_sendbuf, count, datatype);
retval = simgrid::smpi::colls::iexscan(real_sendbuf, recvbuf, count, datatype, op, comm, request);
TRACE_smpi_comm_out(pid);
- smpi_bench_begin();
return retval;
}
CHECK_BUFFER(2, recvbuf, recvcounts[i], datatype)
}
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t pid = simgrid::s4u::this_actor::get_pid();
auto trace_recvcounts = std::make_shared<std::vector<int>>();
int dt_send_size = datatype->is_replayable() ? 1 : datatype->size();
simgrid::smpi::colls::ireduce_scatter(real_sendbuf, recvbuf, recvcounts, datatype, op, comm, request);
TRACE_smpi_comm_out(pid);
- smpi_bench_begin();
return MPI_SUCCESS;
}
CHECK_REQUEST(7)
CHECK_OP(5, op, datatype)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
int count = comm->size();
aid_t pid = simgrid::s4u::this_actor::get_pid();
simgrid::smpi::colls::ireduce_scatter(real_sendbuf, recvbuf, recvcounts.data(), datatype, op, comm, request);
TRACE_smpi_comm_out(pid);
- smpi_bench_begin();
return MPI_SUCCESS;
}
return MPI_ERR_TRUNCATE;
}
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
TRACE_smpi_comm_in(pid, request == MPI_REQUEST_IGNORED ? "PMPI_Alltoall" : "PMPI_Ialltoall",
new simgrid::instr::CollTIData(
comm, request);
TRACE_smpi_comm_out(pid);
- smpi_bench_begin();
return retval;
}
CHECK_COUNT(6, recvcounts[i])
}
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
int send_size = 0;
int recv_size = 0;
auto trace_sendcounts = std::make_shared<std::vector<int>>();
if(recvtype->size() * recvcounts[comm->rank()] != real_sendtype->size() * real_sendcounts[comm->rank()]){
XBT_WARN("MPI_(I)Alltoallv : receive size from me differs from sent size to me : %zu vs %zu", recvtype->size() * recvcounts[comm->rank()], real_sendtype->size() * real_sendcounts[comm->rank()]);
- smpi_bench_begin();
return MPI_ERR_TRUNCATE;
}
recvcounts, recvdispls, recvtype, comm, request);
TRACE_smpi_comm_out(pid);
- smpi_bench_begin();
return retval;
}
CHECK_BUFFER(5, recvbuf, recvcounts[i], recvtypes[i])
}
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
int send_size = 0;
int recv_size = 0;
const MPI_Datatype* real_sendtypes = sendtypes;
unsigned long maxsize = 0;
for (int i = 0; i < size; i++) { // copy data to avoid bad free
- if (recvtypes[i] == MPI_DATATYPE_NULL) {
- smpi_bench_begin();
+ if (recvtypes[i] == MPI_DATATYPE_NULL)
return MPI_ERR_TYPE;
- }
recv_size += recvcounts[i] * recvtypes[i]->size();
trace_recvcounts->push_back(recvcounts[i] * recvtypes[i]->size());
if ((recvdispls[i] + (recvcounts[i] * recvtypes[i]->size())) > maxsize)
if(recvtypes[comm->rank()]->size() * recvcounts[comm->rank()] != real_sendtypes[comm->rank()]->size() * real_sendcounts[comm->rank()]){
XBT_WARN("MPI_(I)Alltoallw : receive size from me differs from sent size to me : %zu vs %zu", recvtypes[comm->rank()]->size() * recvcounts[comm->rank()], real_sendtypes[comm->rank()]->size() * real_sendcounts[comm->rank()]);
- smpi_bench_begin();
return MPI_ERR_TRUNCATE;
}
recvcounts, recvdispls, recvtypes, comm, request);
TRACE_smpi_comm_out(pid);
- smpi_bench_begin();
return retval;
}
CHECK_COMM2(1, comm)
if( color != MPI_UNDEFINED)//we use a negative value for MPI_UNDEFINED
CHECK_NEGATIVE(3, MPI_ERR_ARG, color)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
*comm_out = comm->split(color, key);
- smpi_bench_begin();
return MPI_SUCCESS;
}
{
CHECK_COMM(1)
CHECK_NULL(5, MPI_ERR_ARG, newcomm)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
*newcomm = comm->split_type(split_type, key, info);
- smpi_bench_begin();
return MPI_SUCCESS;
}
CHECK_COMM(1)
CHECK_GROUP(2, group)
CHECK_NULL(5, MPI_ERR_ARG, comm_out)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
int retval = MPI_Comm_create(comm, group, comm_out);
- smpi_bench_begin();
return retval;
}
CHECK_NULL(2, MPI_ERR_FILE, filename)
if (amode < 0)
return MPI_ERR_AMODE;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
*fh = new simgrid::smpi::File(comm, filename, amode, info);
- smpi_bench_begin();
if ((*fh)->size() != 0 && (amode & MPI_MODE_EXCL)){
delete fh;
return MPI_ERR_AMODE;
int PMPI_File_close(MPI_File *fh){
CHECK_NULL(2, MPI_ERR_ARG, fh)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
int ret = simgrid::smpi::File::close(fh);
*fh = MPI_FILE_NULL;
- smpi_bench_begin();
return ret;
}
int PMPI_File_seek(MPI_File fh, MPI_Offset offset, int whence){
CHECK_FILE(1, fh)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
int ret = fh->seek(offset,whence);
- smpi_bench_begin();
return ret;
}
int PMPI_File_seek_shared(MPI_File fh, MPI_Offset offset, int whence){
CHECK_FILE(1, fh)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
int ret = fh->seek_shared(offset,whence);
- smpi_bench_begin();
return ret;
}
int PMPI_File_get_position(MPI_File fh, MPI_Offset* offset){
CHECK_FILE(1, fh)
CHECK_NULL(2, MPI_ERR_DISP, offset)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
int ret = fh->get_position(offset);
- smpi_bench_begin();
return ret;
}
int PMPI_File_get_position_shared(MPI_File fh, MPI_Offset* offset){
CHECK_FILE(1, fh)
CHECK_NULL(2, MPI_ERR_DISP, offset)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
int ret = fh->get_position_shared(offset);
- smpi_bench_begin();
return ret;
}
CHECK_FILE_INPUTS
CHECK_WRONLY(fh)
PASS_ZEROCOUNT(count)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t rank_traced = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - read", count * datatype->size()));
int ret = simgrid::smpi::File::read(fh, buf, count, datatype, status);
TRACE_smpi_comm_out(rank_traced);
- smpi_bench_begin();
return ret;
}
CHECK_FILE_INPUTS
CHECK_WRONLY(fh)
PASS_ZEROCOUNT(count)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t rank_traced = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(rank_traced, __func__,
new simgrid::instr::CpuTIData("IO - read_shared", count * datatype->size()));
int ret = simgrid::smpi::File::read_shared(fh, buf, count, datatype, status);
TRACE_smpi_comm_out(rank_traced);
- smpi_bench_begin();
return ret;
}
CHECK_FILE_INPUTS
CHECK_RDONLY(fh)
PASS_ZEROCOUNT(count)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t rank_traced = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - write", count * datatype->size()));
int ret = simgrid::smpi::File::write(fh, const_cast<void*>(buf), count, datatype, status);
TRACE_smpi_comm_out(rank_traced);
- smpi_bench_begin();
return ret;
}
CHECK_FILE_INPUTS
CHECK_RDONLY(fh)
PASS_ZEROCOUNT(count)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t rank_traced = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(rank_traced, __func__,
new simgrid::instr::CpuTIData("IO - write_shared", count * datatype->size()));
int ret = simgrid::smpi::File::write_shared(fh, buf, count, datatype, status);
TRACE_smpi_comm_out(rank_traced);
- smpi_bench_begin();
return ret;
}
int PMPI_File_read_all(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){
CHECK_FILE_INPUTS
CHECK_WRONLY(fh)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t rank_traced = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - read_all", count * datatype->size()));
int ret = fh->op_all<simgrid::smpi::File::read>(buf, count, datatype, status);
TRACE_smpi_comm_out(rank_traced);
- smpi_bench_begin();
return ret;
}
int PMPI_File_read_ordered(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){
CHECK_FILE_INPUTS
CHECK_WRONLY(fh)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t rank_traced = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(rank_traced, __func__,
new simgrid::instr::CpuTIData("IO - read_ordered", count * datatype->size()));
int ret = simgrid::smpi::File::read_ordered(fh, buf, count, datatype, status);
TRACE_smpi_comm_out(rank_traced);
- smpi_bench_begin();
return ret;
}
int PMPI_File_write_all(MPI_File fh, const void *buf, int count,MPI_Datatype datatype, MPI_Status *status){
CHECK_FILE_INPUTS
CHECK_RDONLY(fh)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t rank_traced = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - write_all", count * datatype->size()));
int ret = fh->op_all<simgrid::smpi::File::write>(const_cast<void*>(buf), count, datatype, status);
TRACE_smpi_comm_out(rank_traced);
- smpi_bench_begin();
return ret;
}
int PMPI_File_write_ordered(MPI_File fh, const void *buf, int count,MPI_Datatype datatype, MPI_Status *status){
CHECK_FILE_INPUTS
CHECK_RDONLY(fh)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t rank_traced = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(rank_traced, __func__,
new simgrid::instr::CpuTIData("IO - write_ordered", count * datatype->size()));
int ret = simgrid::smpi::File::write_ordered(fh, buf, count, datatype, status);
TRACE_smpi_comm_out(rank_traced);
- smpi_bench_begin();
return ret;
}
CHECK_FILE_INPUTS
CHECK_WRONLY(fh)
PASS_ZEROCOUNT(count)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t rank_traced = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - read", count * datatype->size()));
int ret = fh->seek(offset,MPI_SEEK_SET);
if (ret == MPI_SUCCESS)
ret = simgrid::smpi::File::read(fh, buf, count, datatype, status);
TRACE_smpi_comm_out(rank_traced);
- smpi_bench_begin();
return ret;
}
int PMPI_File_read_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){
CHECK_FILE_INPUT_OFFSET
CHECK_WRONLY(fh)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t rank_traced = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(rank_traced, __func__,
new simgrid::instr::CpuTIData("IO - read_at_all", count * datatype->size()));
if (ret == MPI_SUCCESS)
ret = fh->op_all<simgrid::smpi::File::read>(buf, count, datatype, status);
TRACE_smpi_comm_out(rank_traced);
- smpi_bench_begin();
return ret;
}
CHECK_FILE_INPUT_OFFSET
CHECK_RDONLY(fh)
PASS_ZEROCOUNT(count)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t rank_traced = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - write", count * datatype->size()));
int ret = fh->seek(offset,MPI_SEEK_SET);
if (ret == MPI_SUCCESS)
ret = simgrid::smpi::File::write(fh, const_cast<void*>(buf), count, datatype, status);
TRACE_smpi_comm_out(rank_traced);
- smpi_bench_begin();
return ret;
}
int PMPI_File_write_at_all(MPI_File fh, MPI_Offset offset, const void *buf, int count,MPI_Datatype datatype, MPI_Status *status){
CHECK_FILE_INPUT_OFFSET
CHECK_RDONLY(fh)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t rank_traced = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(rank_traced, __func__,
new simgrid::instr::CpuTIData("IO - write_at_all", count * datatype->size()));
if (ret == MPI_SUCCESS)
ret = fh->op_all<simgrid::smpi::File::write>(const_cast<void*>(buf), count, datatype, status);
TRACE_smpi_comm_out(rank_traced);
- smpi_bench_begin();
return ret;
}
int PMPI_File_delete(const char *filename, MPI_Info info){
if (filename == nullptr)
return MPI_ERR_FILE;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
int ret = simgrid::smpi::File::del(filename, info);
- smpi_bench_begin();
return ret;
}
CHECK_OFFSET(2, disp)
CHECK_TYPE(3, etype)
CHECK_TYPE(4, filetype)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
int ret = fh->set_view(disp, etype, filetype, datarep, info);
- smpi_bench_begin();
return ret;
}
CHECK_NULL(2, MPI_ERR_ARG, disp)
CHECK_NULL(3, MPI_ERR_ARG, etype)
CHECK_NULL(4, MPI_ERR_ARG, filetype)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
int ret = fh->get_view(disp, etype, filetype, datarep);
- smpi_bench_begin();
return ret;
}
{
CHECK_ISEND_INPUTS
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
*request = simgrid::smpi::Request::send_init(buf, count, datatype, dst, tag, comm);
- smpi_bench_begin();
return MPI_SUCCESS;
}
{
CHECK_IRECV_INPUTS
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
*request = simgrid::smpi::Request::recv_init(buf, count, datatype, src, tag, comm);
- smpi_bench_begin();
return MPI_SUCCESS;
}
CHECK_ISEND_INPUTS
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
*request = simgrid::smpi::Request::ssend_init(buf, count, datatype, dst, tag, comm);
retval = MPI_SUCCESS;
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
CHECK_REQUEST_VALID(1)
if ( *request == MPI_REQUEST_NULL) {
retval = MPI_ERR_REQUEST;
retval = MPI_SUCCESS;
TRACE_smpi_comm_out(my_proc_id);
}
- smpi_bench_begin();
return retval;
}
int PMPI_Startall(int count, MPI_Request * requests)
{
int retval;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
if (requests == nullptr) {
retval = MPI_ERR_ARG;
} else {
TRACE_smpi_comm_out(my_proc_id);
}
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
if (*request != MPI_REQUEST_NULL) {
(*request)->mark_as_deleted();
simgrid::smpi::Request::unref(request);
*request = MPI_REQUEST_NULL;
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
CHECK_IRECV_INPUTS
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__,
new simgrid::instr::Pt2PtTIData("irecv", src,
tag, simgrid::smpi::Datatype::encode(datatype)));
*request = simgrid::smpi::Request::irecv(buf, count, datatype, src, tag, comm);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return MPI_SUCCESS;
}
{
CHECK_ISEND_INPUTS
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
int retval = 0;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
aid_t trace_dst = getPid(comm, dst);
*request = simgrid::smpi::Request::isend(buf, count, datatype, dst, tag, comm);
retval = MPI_SUCCESS;
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
{
CHECK_ISEND_INPUTS
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
aid_t trace_dst = getPid(comm, dst);
TRACE_smpi_comm_in(my_proc_id, __func__,
TRACE_smpi_send(my_proc_id, my_proc_id, trace_dst, tag, count * datatype->size());
*request = simgrid::smpi::Request::issend(buf, count, datatype, dst, tag, comm);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return MPI_SUCCESS;
}
CHECK_TAG(5, tag)
CHECK_COMM(6)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
if (src == MPI_PROC_NULL) {
if(status != MPI_STATUS_IGNORE){
simgrid::smpi::Status::empty(status);
TRACE_smpi_comm_out(my_proc_id);
}
- smpi_bench_begin();
return retval;
}
{
CHECK_SEND_INPUTS
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
aid_t dst_traced = getPid(comm, dst);
TRACE_smpi_comm_in(my_proc_id, __func__,
}
simgrid::smpi::Request::send(buf, count, datatype, dst, tag, comm);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return MPI_SUCCESS;
}
{
CHECK_SEND_INPUTS
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
aid_t dst_traced = getPid(comm, dst);
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) {
- smpi_bench_begin();
+ if (bsend_buf == nullptr || bsend_buf_size < size + MPI_BSEND_OVERHEAD)
return MPI_ERR_BUFFER;
- }
TRACE_smpi_comm_in(my_proc_id, __func__,
new simgrid::instr::Pt2PtTIData("bsend", dst,
datatype->is_replayable() ? count : count * datatype->size(),
}
simgrid::smpi::Request::bsend(buf, count, datatype, dst, tag, comm);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return MPI_SUCCESS;
}
{
CHECK_ISEND_INPUTS
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
aid_t trace_dst = getPid(comm, dst);
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) {
- smpi_bench_begin();
+ if (bsend_buf == nullptr || bsend_buf_size < size + MPI_BSEND_OVERHEAD)
return MPI_ERR_BUFFER;
- }
TRACE_smpi_comm_in(my_proc_id, __func__,
new simgrid::instr::Pt2PtTIData("ibsend", dst,
datatype->is_replayable() ? count : count * datatype->size(),
TRACE_smpi_send(my_proc_id, my_proc_id, trace_dst, tag, count * datatype->size());
*request = simgrid::smpi::Request::ibsend(buf, count, datatype, dst, tag, comm);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return MPI_SUCCESS;
}
{
CHECK_ISEND_INPUTS
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
int retval = 0;
int bsend_buf_size = 0;
void* bsend_buf = nullptr;
*request = simgrid::smpi::Request::bsend_init(buf, count, datatype, dst, tag, comm);
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
CHECK_SEND_INPUTS
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
aid_t dst_traced = getPid(comm, dst);
TRACE_smpi_comm_in(my_proc_id, __func__,
TRACE_smpi_send(my_proc_id, my_proc_id, dst_traced, tag, count * datatype->size());
simgrid::smpi::Request::ssend(buf, count, datatype, dst, tag, comm);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return MPI_SUCCESS;
}
CHECK_BUFFER(6, recvbuf, recvcount, recvtype)
CHECK_TAG(10, recvtag)
CHECK_COMM(11)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
if (src == MPI_PROC_NULL) {
if(status!=MPI_STATUS_IGNORE){
TRACE_smpi_comm_out(my_proc_id);
}
- smpi_bench_begin();
return retval;
}
int PMPI_Test(MPI_Request * request, int *flag, MPI_Status * status)
{
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
if (request == nullptr || flag == nullptr) {
retval = MPI_ERR_ARG;
} else if (*request == MPI_REQUEST_NULL) {
TRACE_smpi_comm_out(my_proc_id);
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
CHECK_COUNT(1, count)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
if (index == nullptr || flag == nullptr) {
retval = MPI_ERR_ARG;
} else {
retval = simgrid::smpi::Request::testany(count, requests, index, flag, status);
TRACE_smpi_comm_out(my_proc_id);
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
CHECK_COUNT(1, count)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
if (flag == nullptr) {
retval = MPI_ERR_ARG;
} else {
retval = simgrid::smpi::Request::testall(count, requests, flag, statuses);
TRACE_smpi_comm_out(my_proc_id);
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
CHECK_COUNT(1, incount)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
if (outcount == nullptr) {
retval = MPI_ERR_ARG;
} else {
retval = simgrid::smpi::Request::testsome(incount, requests, outcount, indices, status);
TRACE_smpi_comm_out(my_proc_id);
}
- smpi_bench_begin();
return retval;
}
int PMPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status* status) {
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
CHECK_COMM(6)
if(source!=MPI_ANY_SOURCE && source!=MPI_PROC_NULL)\
simgrid::smpi::Request::probe(source, tag, comm, status);
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
int PMPI_Iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* status) {
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
CHECK_COMM(6)
if(source!=MPI_ANY_SOURCE && source!=MPI_PROC_NULL)\
CHECK_RANK(1, source, comm)
simgrid::smpi::Request::iprobe(source, tag, comm, flag, status);
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
simgrid::smpi::Status::empty(status);
simgrid::smpi::Request::unref(&savedreq);
}
- smpi_bench_begin();
return retval;
}
if (count <= 0)
return MPI_SUCCESS;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
// for tracing, save the handles which might get overridden before we can use the helper on it
std::vector<MPI_Request> savedreqs(requests, requests + count);
for (MPI_Request& req : savedreqs) {
if (req != MPI_REQUEST_NULL)
simgrid::smpi::Request::unref(&req);
- smpi_bench_begin();
return MPI_SUCCESS;
}
int PMPI_Waitall(int count, MPI_Request requests[], MPI_Status status[])
{
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
CHECK_COUNT(1, count)
// for tracing, save the handles which might get overridden before we can use the helper on it
std::vector<MPI_Request> savedreqs(requests, requests + count);
if (req != MPI_REQUEST_NULL)
simgrid::smpi::Request::unref(&req);
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
CHECK_COUNT(1, incount)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
if (outcount == nullptr) {
retval = MPI_ERR_ARG;
} else {
*outcount = simgrid::smpi::Request::waitsome(incount, requests, indices, status);
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
CHECK_REQUEST_VALID(1)
if (*request == MPI_REQUEST_NULL) {
retval = MPI_ERR_REQUEST;
(*request)->cancel();
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
CHECK_COMM(5)
CHECK_NEGATIVE(2, MPI_ERR_OTHER, size)
CHECK_NEGATIVE(3, MPI_ERR_OTHER, disp_unit)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
if (base == nullptr && size != 0){
retval= MPI_ERR_OTHER;
}else{
*win = new simgrid::smpi::Win( base, size, disp_unit, info, comm);
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
CHECK_NEGATIVE(2, MPI_ERR_OTHER, size)
CHECK_NEGATIVE(3, MPI_ERR_OTHER, disp_unit)
void* ptr = xbt_malloc(size);
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
*static_cast<void**>(base) = ptr;
*win = new simgrid::smpi::Win( ptr, size, disp_unit, info, comm,1);
- smpi_bench_begin();
return MPI_SUCCESS;
}
if(rank==0){
ptr = xbt_malloc(size*comm->size());
}
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
simgrid::smpi::colls::bcast(&ptr, sizeof(void*), MPI_BYTE, 0, comm);
simgrid::smpi::colls::barrier(comm);
*static_cast<void**>(base) = (char*)ptr+rank*size;
*win = new simgrid::smpi::Win( ptr, size, disp_unit, info, comm,rank==0);
- smpi_bench_begin();
return MPI_SUCCESS;
}
int PMPI_Win_create_dynamic( MPI_Info info, MPI_Comm comm, MPI_Win *win){
CHECK_COMM(2)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
*win = new simgrid::smpi::Win(info, comm);
- smpi_bench_begin();
return MPI_SUCCESS;
}
CHECK_NEGATIVE(3, MPI_ERR_OTHER, size)
if (base == nullptr && size != 0)
return MPI_ERR_OTHER;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
int retval = win->attach(base, size);
- smpi_bench_begin();
return retval;
}
{
CHECK_WIN(1, win)
CHECK_NULL(2, MPI_ERR_OTHER, base)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
int retval = win->detach(base);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_free( MPI_Win* win){
CHECK_NULL(1, MPI_ERR_WIN, win)
CHECK_WIN(1, (*win))
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
delete *win;
- smpi_bench_begin();
return MPI_SUCCESS;
}
int PMPI_Win_fence( int assert, MPI_Win win){
CHECK_WIN(2, win)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_fence"));
int retval = win->fence(assert);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
CHECK_TARGET_DISP(5)
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
target_datatype);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
CHECK_NULL(9, MPI_ERR_ARG, request)
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
CHECK_TARGET_DISP(5)
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
CHECK_TARGET_DISP(5)
CHECK_NULL(9, MPI_ERR_ARG, request)
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
win->get_group(&group);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
CHECK_TARGET_DISP(8)
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
CHECK_TARGET_DISP(8)
CHECK_NULL(10, MPI_ERR_ARG, request)
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
MPI_Group group;
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_post(MPI_Group group, int assert, MPI_Win win){
CHECK_GROUP(1, group)
CHECK_WIN(2, win)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_post"));
int retval = win->post(group,assert);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_start(MPI_Group group, int assert, MPI_Win win){
CHECK_GROUP(1, group)
CHECK_WIN(2, win)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_start"));
int retval = win->start(group,assert);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_complete(MPI_Win win){
CHECK_WIN(1, win)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_complete"));
int retval = win->complete();
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_wait(MPI_Win win){
CHECK_WIN(1, win)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_wait"));
int retval = win->wait();
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
CHECK_WIN(4, win)
CHECK_PROC_RMA(2, rank, win)
int retval = 0;
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
if (lock_type != MPI_LOCK_EXCLUSIVE &&
lock_type != MPI_LOCK_SHARED) {
retval = MPI_ERR_LOCKTYPE;
retval = win->lock(lock_type,rank,assert);
TRACE_smpi_comm_out(my_proc_id);
}
- smpi_bench_begin();
return retval;
}
int PMPI_Win_unlock(int rank, MPI_Win win){
CHECK_WIN(2, win)
CHECK_PROC_RMA(1, rank, win)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_unlock"));
int retval = win->unlock(rank);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_lock_all(int assert, MPI_Win win){
CHECK_WIN(2, win)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_lock_all"));
int retval = win->lock_all(assert);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_unlock_all(MPI_Win win){
CHECK_WIN(1, win)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_unlock_all"));
int retval = win->unlock_all();
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_flush(int rank, MPI_Win win){
CHECK_WIN(2, win)
CHECK_PROC_RMA(1, rank, win)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_flush"));
int retval = win->flush(rank);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_flush_local(int rank, MPI_Win win){
CHECK_WIN(2, win)
CHECK_PROC_RMA(1, rank, win)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_flush_local"));
int retval = win->flush_local(rank);
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_flush_all(MPI_Win win){
CHECK_WIN(1, win)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_flush_all"));
int retval = win->flush_all();
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
int PMPI_Win_flush_local_all(MPI_Win win){
CHECK_WIN(1, win)
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_flush_local_all"));
int retval = win->flush_local_all();
TRACE_smpi_comm_out(my_proc_id);
- smpi_bench_begin();
return retval;
}
XBT_PRIVATE void smpi_shared_destroy();
XBT_PRIVATE double smpi_adjust_comp_speed();
+// This helper class uses RAII to call smpi_bench_end() when an object is built, and have smpi_bench_begin() be called
+// automatically when going out of scope.
+class XBT_PRIVATE SmpiBenchGuard {
+public:
+ SmpiBenchGuard() { smpi_bench_end(); }
+ SmpiBenchGuard(const SmpiBenchGuard&) = delete;
+ SmpiBenchGuard& operator=(const SmpiBenchGuard&) = delete;
+ ~SmpiBenchGuard() { smpi_bench_begin(); }
+};
+
XBT_PRIVATE unsigned char* smpi_get_tmp_sendbuffer(size_t size);
XBT_PRIVATE unsigned char* smpi_get_tmp_recvbuffer(size_t size);
XBT_PRIVATE void smpi_free_tmp_buffer(const unsigned char* buf);
void smpi_execute_benched(double duration)
{
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
double speed = sg_host_get_speed(sg_host_self());
smpi_execute_flops(duration*speed);
- smpi_bench_begin();
}
void smpi_execute_flops_benched(double flops) {
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
smpi_execute_flops(flops);
- smpi_bench_begin();
}
void smpi_bench_begin()
/* Private sleep function used by smpi_sleep(), smpi_usleep() and friends */
static unsigned int private_sleep(double secs)
{
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
XBT_DEBUG("Sleep for: %lf secs", secs);
aid_t pid = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_sleeping_out(pid);
- smpi_bench_begin();
return 0;
}
if (not smpi_process()->initialized() || smpi_process()->finalized() || smpi_process()->sampling())
return gettimeofday(tv, tz);
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
double now = simgrid::s4u::Engine::get_clock();
if (tv) {
tv->tv_sec = static_cast<time_t>(now);
}
if (smpi_wtime_sleep > 0)
simgrid::s4u::this_actor::sleep_for(smpi_wtime_sleep);
- smpi_bench_begin();
return 0;
}
if (not smpi_process()->initialized() || smpi_process()->finalized() || smpi_process()->sampling())
return clock_gettime(clk_id, tp);
//there is only one time in SMPI, so clk_id is ignored.
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
double now = simgrid::s4u::Engine::get_clock();
tp->tv_sec = static_cast<time_t>(now);
tp->tv_nsec = static_cast<long int>((now - tp->tv_sec) * 1e9);
if (smpi_wtime_sleep > 0)
simgrid::s4u::this_actor::sleep_for(smpi_wtime_sleep);
- smpi_bench_begin();
return 0;
}
#endif
{
double time;
if (smpi_process()->initialized() && not smpi_process()->finalized() && not smpi_process()->sampling()) {
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
time = simgrid::s4u::Engine::get_clock();
if (smpi_wtime_sleep > 0)
simgrid::s4u::this_actor::sleep_for(smpi_wtime_sleep);
- smpi_bench_begin();
} else {
time = simgrid::s4u::Engine::get_clock();
}
extern double sg_surf_precision;
unsigned long long smpi_rastro_resolution ()
{
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
double resolution = (1/sg_surf_precision);
- smpi_bench_begin();
return static_cast<unsigned long long>(resolution);
}
unsigned long long smpi_rastro_timestamp ()
{
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
double now = simgrid::s4u::Engine::get_clock();
auto sec = static_cast<unsigned long long>(now);
unsigned long long pre = (now - sec) * smpi_rastro_resolution();
- smpi_bench_begin();
return sec * smpi_rastro_resolution() + pre;
}
*/
int APMPI_Iteration_in(MPI_Comm comm)
{
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
TRACE_Iteration_in(comm->rank() + 1, new simgrid::instr::NoOpTIData("iteration_in")); // implemented on instr_smpi.c
- smpi_bench_begin();
return 1;
}
int APMPI_Iteration_out(MPI_Comm comm)
{
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
TRACE_Iteration_out(comm->rank() + 1, new simgrid::instr::NoOpTIData("iteration_out"));
- smpi_bench_begin();
return 1;
}
void APMPI_Migrate(MPI_Comm comm)
{
- smpi_bench_end();
+ const SmpiBenchGuard suspend_bench;
aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_migration_call(comm->rank() + 1, new simgrid::instr::AmpiMigrateTIData(memory_size[my_proc_id]));
- smpi_bench_begin();
}
int AMPI_Iteration_in(MPI_Comm comm)