X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/0b63f78dc217b79305cef05bd2200069d3e24475..a900ac9d39fee1b3de240499c5326e5b8d4f44c2:/src/smpi/internals/smpi_bench.cpp diff --git a/src/smpi/internals/smpi_bench.cpp b/src/smpi/internals/smpi_bench.cpp index 78442e2050..54736a67be 100644 --- a/src/smpi/internals/smpi_bench.cpp +++ b/src/smpi/internals/smpi_bench.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007, 2009-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007, 2009-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. */ @@ -30,24 +30,25 @@ double smpi_host_speed; shared_malloc_type smpi_cfg_shared_malloc = shmalloc_global; double smpi_total_benched_time = 0; -extern "C" XBT_PUBLIC(void) smpi_execute_flops_(double *flops); +extern "C" XBT_PUBLIC void smpi_execute_flops_(double* flops); void smpi_execute_flops_(double *flops) { smpi_execute_flops(*flops); } -extern "C" XBT_PUBLIC(void) smpi_execute_(double *duration); +extern "C" XBT_PUBLIC void smpi_execute_(double* duration); void smpi_execute_(double *duration) { smpi_execute(*duration); } void smpi_execute_flops(double flops) { + xbt_assert(flops >= 0, "You're trying to execute a negative amount of flops (%f)!", flops); XBT_DEBUG("Handle real computation time: %f flops", flops); - smx_activity_t action = simcall_execution_start("computation", flops, 1, 0, smpi_process()->process()->getImpl()->host); + 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(simgrid::s4u::Actor::self()->getPid()); + smpi_switch_data_segment(simgrid::s4u::Actor::self()); } void smpi_execute(double duration) @@ -55,7 +56,7 @@ 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 = simgrid::s4u::Actor::self()->getPid(); + int rank = simgrid::s4u::this_actor::getPid(); TRACE_smpi_computing_in(rank, flops); smpi_execute_flops(flops); @@ -78,8 +79,8 @@ void smpi_execute_benched(double duration) void smpi_bench_begin() { - if (smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP) { - smpi_switch_data_segment(simgrid::s4u::Actor::self()->getPid()); + if (smpi_privatize_global_variables == SmpiPrivStrategies::Mmap) { + smpi_switch_data_segment(simgrid::s4u::Actor::self()); } if (MC_is_active() || MC_record_replay_is_active()) @@ -157,7 +158,7 @@ void smpi_bench_end() #if HAVE_PAPI if (xbt_cfg_get_string("smpi/papi-events")[0] != '\0' && TRACE_smpi_is_enabled()) { container_t container = - new simgrid::instr::Container(std::string("rank-") + std::to_string(simgrid::s4u::Actor::self()->getPid())); + new simgrid::instr::Container(std::string("rank-") + std::to_string(simgrid::s4u::this_actor::getPid)); papi_counter_t& counter_data = smpi_process()->papi_counters(); for (auto const& pair : counter_data) { @@ -262,7 +263,7 @@ public: 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(simgrid::s4u::Actor::self()->getPid())); + this->append(":" + std::to_string(simgrid::s4u::this_actor::getPid())); } }; @@ -396,7 +397,6 @@ void smpi_sample_3(int global, const char *file, int line) data.benching = false; } -extern "C" { /** These functions will be called from the user code **/ smpi_trace_call_location_t* smpi_trace_get_call_location() { return smpi_process()->call_location(); @@ -423,7 +423,6 @@ void smpi_trace_set_call_location__(const char* file, int* line) { smpi_trace_set_call_location(file, *line); } -} void smpi_bench_destroy() {