#include "SmpiHost.hpp"
#include "mc/mc.h"
-#include "private.hpp"
#include "simgrid/s4u/Engine.hpp"
-#include "simgrid/s4u/Host.hpp"
-#include "simgrid/s4u/Mailbox.hpp"
-#include "simgrid/s4u/forward.hpp"
#include "smpi_coll.hpp"
-#include "smpi_comm.hpp"
-#include "smpi_group.hpp"
-#include "smpi_info.hpp"
#include "smpi_process.hpp"
#include "src/msg/msg_private.hpp"
#include "src/simix/smx_private.hpp"
-#include "src/surf/surf_interface.hpp"
#include "xbt/config.hpp"
#include <cfloat> /* DBL_MAX */
#include <dlfcn.h>
#include <fcntl.h>
#include <fstream>
-#include <sys/stat.h>
#if HAVE_SENDFILE
#include <sys/sendfile.h>
papi_counter_t counter_data;
int event_set;
};
-
#endif
+
using simgrid::s4u::Actor;
using simgrid::s4u::ActorPtr;
std::unordered_map<std::string, double> location2speedup;
ActorPtr me = Actor::self();
if (me == nullptr) // This happens sometimes (eg, when linking against NS3 because it pulls openMPI...)
return nullptr;
- simgrid::msg::ActorExt* msgExt = static_cast<simgrid::msg::ActorExt*>(me->getImpl()->userdata);
+ simgrid::msg::ActorExt* msgExt = static_cast<simgrid::msg::ActorExt*>(me->get_impl()->userdata);
return static_cast<simgrid::smpi::Process*>(msgExt->data);
}
}
int smpi_process_index(){
- return simgrid::s4u::this_actor::getPid();
+ return simgrid::s4u::this_actor::get_pid();
}
void * smpi_process_get_user_data(){
/* nothing done in this version */
}
-static void smpi_check_options(){
+static void smpi_check_options()
+{
//check correctness of MPI parameters
- xbt_assert(xbt_cfg_get_int("smpi/async-small-thresh") <= xbt_cfg_get_int("smpi/send-is-detached-thresh"));
+ xbt_assert(simgrid::config::get_config<int>("smpi/async-small-thresh") <=
+ simgrid::config::get_config<int>("smpi/send-is-detached-thresh"));
- if (xbt_cfg_is_default_value("smpi/host-speed")) {
- XBT_INFO("You did not set the power of the host running the simulation. "
- "The timings will certainly not be accurate. "
- "Use the option \"--cfg=smpi/host-speed:<flops>\" to set its value."
- "Check http://simgrid.org/simgrid/latest/doc/options.html#options_smpi_bench for more information.");
- }
+ if (xbt_cfg_is_default_value("smpi/host-speed")) {
+ XBT_INFO("You did not set the power of the host running the simulation. "
+ "The timings will certainly not be accurate. "
+ "Use the option \"--cfg=smpi/host-speed:<flops>\" to set its value."
+ "Check http://simgrid.org/simgrid/latest/doc/options.html#options_smpi_bench for more information.");
+ }
- xbt_assert(xbt_cfg_get_double("smpi/cpu-threshold") >=0,
- "The 'smpi/cpu-threshold' option cannot have negative values [anymore]. If you want to discard "
- "the simulation of any computation, please use 'smpi/simulate-computation:no' instead.");
+ xbt_assert(xbt_cfg_get_double("smpi/cpu-threshold") >= 0,
+ "The 'smpi/cpu-threshold' option cannot have negative values [anymore]. If you want to discard "
+ "the simulation of any computation, please use 'smpi/simulate-computation:no' instead.");
}
int smpi_enabled() {
// Load the copy and resolve the entry point:
void* handle = dlopen(target_executable.c_str(), RTLD_LAZY | RTLD_LOCAL | RTLD_DEEPBIND);
int saved_errno = errno;
- if (xbt_cfg_get_boolean("smpi/keep-temps") == false)
+ if (simgrid::config::get_config<bool>("smpi/keep-temps") == false)
unlink(target_executable.c_str());
if (handle == nullptr)
xbt_die("dlopen failed: %s (errno: %d -- %s)", dlerror(), saved_errno, strerror(saved_errno));
};
}
else {
+ if (smpi_privatize_global_variables == SmpiPrivStrategies::Mmap)
+ smpi_prepare_global_memory_segment();
// Load the dynamic library and resolve the entry point:
void* handle = dlopen(executable, RTLD_LAZY | RTLD_LOCAL);
if (handle == nullptr)
smpi_entry_point_type entry_point = smpi_resolve_function(handle);
if (not entry_point)
xbt_die("main not found in %s", executable);
- // TODO, register the executable for SMPI privatization
+ if (smpi_privatize_global_variables == SmpiPrivStrategies::Mmap)
+ smpi_backup_global_memory_segment();
// Execute the same entry point for each simulated process:
simix_global->default_function = [entry_point](std::vector<std::string> args) {
SIMIX_run();
xbt_os_walltimer_stop(global_timer);
- if (xbt_cfg_get_boolean("smpi/display-timing")){
+ if (simgrid::config::get_config<bool>("smpi/display-timing")) {
double global_time = xbt_os_timer_elapsed(global_timer);
XBT_INFO("Simulated time: %g seconds. \n\n"
"The simulation took %g seconds (after parsing and platform setup)\n"
// Called either directly from the user code, or from the code called by smpirun
void SMPI_init(){
- simgrid::s4u::Actor::onCreation.connect([](simgrid::s4u::ActorPtr actor) {
- if (not actor->isDaemon()) {
+ simgrid::s4u::Actor::on_creation.connect([](simgrid::s4u::ActorPtr actor) {
+ if (not actor->is_daemon()) {
process_data.insert({actor, new simgrid::smpi::Process(actor, nullptr)});
}
});
- simgrid::s4u::Actor::onDestruction.connect([](simgrid::s4u::ActorPtr actor) {
+ simgrid::s4u::Actor::on_destruction.connect([](simgrid::s4u::ActorPtr actor) {
auto it = process_data.find(actor);
if (it != process_data.end()) {
delete it->second;
smpi_init_options();
smpi_global_init();
smpi_check_options();
- TRACE_smpi_alloc();
simgrid::s4u::onSimulationEnd.connect(TRACE_smpi_release);
- if (smpi_privatize_global_variables == SmpiPrivStrategies::Mmap)
- smpi_backup_global_memory_segment();
}
void SMPI_finalize(){