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(){
int fdout = open(target_executable.c_str(), O_CREAT | O_RDWR, S_IRWXU);
xbt_assert(fdout >= 0, "Cannot write into %s", target_executable.c_str());
+ XBT_DEBUG("Copy %ld bytes into %s", static_cast<long>(fdin_size), target_executable.c_str());
#if HAVE_SENDFILE
ssize_t sent_size = sendfile(fdout, fdin, NULL, fdin_size);
xbt_assert(sent_size == fdin_size,
"Error while copying %s: only %zd bytes copied instead of %ld (errno: %d -- %s)",
target_executable.c_str(), sent_size, fdin_size, errno, strerror(errno));
#else
- XBT_VERB("Copy %d bytes into %s", static_cast<int>(fdin_size), target_executable.c_str());
const int bufsize = 1024 * 1024 * 4;
char buf[bufsize];
while (int got = read(fdin, buf, bufsize)) {
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) {
// 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_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(){