-/* Copyright (c) 2004-2018. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2004-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 "simgrid/Exception.hpp"
+#include <cmath>
#include "simgrid/s4u/Mailbox.hpp"
#include "src/instr/instr_private.hpp"
simdata->bytes_parallel_amount, -1.0, timeout));
XBT_DEBUG("Parallel execution action created: %p", simdata->compute.get());
if (task->category != nullptr)
- simcall_set_category(simdata->compute, task->category);
+ simgrid::simix::simcall([task] { task->simdata->compute->set_category(task->category); });
} else {
- simdata->compute = boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(
- simcall_execution_start(task->name ?: "", task->category ?: "", simdata->flops_amount, simdata->priority,
- simdata->bound, MSG_process_get_host(MSG_process_self())));
+ sg_host_t host = MSG_process_get_host(MSG_process_self());
+ simdata->compute = simgrid::simix::simcall([task, host] {
+ return simgrid::kernel::activity::ExecImplPtr(
+ new simgrid::kernel::activity::ExecImpl(task->name ?: "", task->category ?: "",
+ /*timeout_detector*/ nullptr, host));
+ });
+ /* checking for infinite values */
+ xbt_assert(std::isfinite(simdata->flops_amount), "flops_amount is not finite!");
+ xbt_assert(std::isfinite(simdata->priority), "priority is not finite!");
+
+ simdata->compute->start(simdata->flops_amount, simdata->priority, simdata->bound);
}
comp_state = simcall_execution_wait(simdata->compute);
comm = new simgrid::msg::Comm(task, nullptr, act);
}
- if (TRACE_is_enabled())
- simcall_set_category(act, task->category);
+ if (TRACE_is_enabled() && task->category != nullptr)
+ simgrid::simix::simcall([act, task] { act->set_category(task->category); });
+
TRACE_msg_task_put_end();
return comm;
// notify the user callback if any
if (msg_global->task_copy_callback) {
msg_task_t task = static_cast<msg_task_t>(buff);
- msg_global->task_copy_callback(task, comm->src_proc->ciface(), comm->dst_proc->ciface());
+ msg_global->task_copy_callback(task, comm->src_actor_->ciface(), comm->dst_actor_->ciface());
}
}
comm = simcall_comm_isend(SIMIX_process_self(), mailbox->get_impl(), t_simdata->bytes_amount, t_simdata->rate, task,
sizeof(void*), nullptr, nullptr, nullptr, nullptr, 0);
if (TRACE_is_enabled() && task->category != nullptr)
- simcall_set_category(comm, task->category);
+ simgrid::simix::simcall([comm, task] { comm->set_category(task->category); });
t_simdata->comm = boost::static_pointer_cast<simgrid::kernel::activity::CommImpl>(comm);
simcall_comm_wait(comm, timeout);
} catch (simgrid::TimeoutError& e) {
if (not comm)
return -1;
- return MSG_process_get_PID(static_cast<msg_task_t>(comm->src_buff)->simdata->sender);
+ return MSG_process_get_PID(static_cast<msg_task_t>(comm->src_buff_)->simdata->sender);
}
/**