* under the terms of the license (GNU LGPL) which comes with this package. */
#include "mc/mc.h"
-#include "simgrid/s4u/Engine.hpp"
#include "simgrid/plugins/file_system.h"
+#include "simgrid/s4u/Engine.hpp"
#include "smpi_coll.hpp"
+#include "smpi_config.hpp"
#include "smpi_f2c.hpp"
#include "smpi_host.hpp"
-#include "smpi_config.hpp"
+#include "src/kernel/EngineImpl.hpp"
#include "src/kernel/activity/CommImpl.hpp"
#include "src/simix/smx_private.hpp"
#include "src/smpi/include/smpi_actor.hpp"
#include <array>
#include <boost/algorithm/string.hpp> /* split */
#include <boost/tokenizer.hpp>
-#include <boost/core/demangle.hpp>
#include <cerrno>
#include <cinttypes>
#include <cstdint> /* intmax_t */
auto private_blocks = merge_private_blocks(src_private_blocks, dst_private_blocks);
check_blocks(private_blocks, buff_size);
void* tmpbuff=buff;
- if ((smpi_cfg_privatization() == SmpiPrivStrategies::MMAP) &&
- (static_cast<char*>(buff) >= smpi_data_exe_start) &&
- (static_cast<char*>(buff) < smpi_data_exe_start + smpi_data_exe_size)) {
+ if (smpi_switch_data_segment(comm->src_actor_->get_iface(), buff)) {
XBT_DEBUG("Privatization : We are copying from a zone inside global memory... Saving data to temp buffer !");
- smpi_switch_data_segment(comm->src_actor_->get_iface());
tmpbuff = xbt_malloc(buff_size);
memcpy_private(tmpbuff, buff, private_blocks);
}
- if ((smpi_cfg_privatization() == SmpiPrivStrategies::MMAP) &&
- ((char*)comm->dst_buff_ >= smpi_data_exe_start) &&
- ((char*)comm->dst_buff_ < smpi_data_exe_start + smpi_data_exe_size)) {
+ if (smpi_switch_data_segment(comm->dst_actor_->get_iface(), comm->dst_buff_))
XBT_DEBUG("Privatization : We are copying to a zone inside global memory - Switch data segment");
- smpi_switch_data_segment(comm->dst_actor_->get_iface());
- }
+
XBT_DEBUG("Copying %zu bytes from %p to %p", buff_size, tmpbuff, comm->dst_buff_);
memcpy_private(comm->dst_buff_, tmpbuff, private_blocks);
dlerror(), saved_errno, strerror(saved_errno));
smpi_entry_point_type entry_point = smpi_resolve_function(handle);
- xbt_assert(entry_point, "Could not resolve entry point");
+ xbt_assert(entry_point, "Could not resolve entry point. Does your program contain a main() function?");
smpi_run_entry_point(entry_point, executable, args);
});
});
// Execute the same entry point for each simulated process:
simgrid::s4u::Engine::get_instance()->register_default([entry_point, executable](std::vector<std::string> args) {
- return std::function<void()>(
- [entry_point, executable, args] { smpi_run_entry_point(entry_point, executable, args); });
+ return std::function<void()>([entry_point, executable, args] {
+ if (smpi_cfg_privatization() == SmpiPrivStrategies::MMAP) {
+ simgrid::smpi::ActorExt* ext = smpi_process();
+ /* Now using the segment index of this process */
+ ext->set_privatized_region(smpi_init_global_memory_segment_process());
+ /* Done at the process's creation */
+ smpi_switch_data_segment(simgrid::s4u::Actor::self());
+ }
+ smpi_run_entry_point(entry_point, executable, args);
+ });
});
}
* configuration tools */
return 0;
}
-
- SMPI_switch_data_segment = &smpi_switch_data_segment;
- smpi_init_options();
+
+ smpi_init_options(true);
simgrid::instr::init();
SIMIX_global_init(&argc, argv);
if (MC_is_active()) {
MC_run();
} else {
- SIMIX_run();
+ simgrid::kernel::EngineImpl::get_instance()->run();
xbt_os_walltimer_stop(global_timer);
simgrid::smpi::utils::print_time_analysis(xbt_os_timer_elapsed(global_timer));
void SMPI_thread_create() {
TRACE_smpi_init(simgrid::s4u::this_actor::get_pid(), __func__);
+ smpi_process()->mark_as_initialized();
}