* under the terms of the license (GNU LGPL) which comes with this package. */
#include "private.hpp"
+#include "simgrid/host.h"
#include "simgrid/modelchecker.h"
#include "smpi_comm.hpp"
#include "smpi_process.hpp"
#include "src/internal_config.h"
-#include "src/mc/mc_replay.h"
+#include "src/mc/mc_replay.hpp"
+#include "src/simix/ActorImpl.hpp"
#include <unordered_map>
#ifndef WIN32
void smpi_execute_flops(double flops) {
XBT_DEBUG("Handle real computation time: %f flops", flops);
- smx_activity_t action = simcall_execution_start("computation", flops, 1, 0);
+ smx_activity_t action = simcall_execution_start("computation", flops, 1, 0, smpi_process()->process()->getHost());
simcall_set_category (action, TRACE_internal_smpi_get_category());
simcall_execution_wait(action);
- smpi_switch_data_segment(smpi_process()->index());
+ smpi_switch_data_segment(simgrid::s4u::Actor::self()->getPid());
}
void smpi_execute(double duration)
if (duration >= smpi_cpu_threshold) {
XBT_DEBUG("Sleep for %g to handle real computation time", duration);
double flops = duration * smpi_host_speed;
- int rank = smpi_process()->index();
- instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
- extra->type=TRACING_COMPUTING;
- extra->comp_size=flops;
- TRACE_smpi_computing_in(rank, extra);
+ int rank = simgrid::s4u::Actor::self()->getPid();
+ TRACE_smpi_computing_in(rank, flops);
smpi_execute_flops(flops);
void smpi_execute_benched(double duration)
{
smpi_bench_end();
- smpi_execute(duration);
+ double speed = sg_host_speed(sg_host_self());
+ smpi_execute_flops(duration*speed);
smpi_bench_begin();
}
void smpi_bench_begin()
{
if (smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP) {
- smpi_switch_data_segment(smpi_process()->index());
+ smpi_switch_data_segment(simgrid::s4u::Actor::self()->getPid());
}
if (MC_is_active() || MC_record_replay_is_active())
return;
#if HAVE_PAPI
- if (xbt_cfg_get_string("smpi/papi-events")[0] != '\0') {
+ if (not xbt_cfg_get_string("smpi/papi-events").empty()) {
int event_set = smpi_process()->papi_event_set();
// PAPI_start sets everything to 0! See man(3) PAPI_start
if (PAPI_LOW_LEVEL_INITED == PAPI_is_initialized()) {
#if HAVE_PAPI
if (xbt_cfg_get_string("smpi/papi-events")[0] != '\0' && TRACE_smpi_is_enabled()) {
- container_t container = new simgrid::instr::Container(smpi_container(smpi_process()->index()));
+ container_t container =
+ new simgrid::instr::Container(std::string("rank-") + std::to_string(simgrid::s4u::Actor::self()->getPid()));
papi_counter_t& counter_data = smpi_process()->papi_counters();
for (auto const& pair : counter_data) {
XBT_DEBUG("Sleep for: %lf secs", secs);
int rank = MPI_COMM_WORLD->rank();
- instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
- extra->type=TRACING_SLEEPING;
- extra->sleep_duration=secs;
- TRACE_smpi_sleeping_in(rank, extra);
+ TRACE_smpi_sleeping_in(rank, secs);
simcall_process_sleep(secs);
SampleLocation(bool global, const char* file, int line) : std::string(std::string(file) + ":" + std::to_string(line))
{
if (not global)
- this->append(":" + std::to_string(smpi_process()->index()));
+ this->append(":" + std::to_string(simgrid::s4u::Actor::self()->getPid()));
}
};