-/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-2020. 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. */
static void (*saved_callback)(smx_activity_t, void*, size_t);
saved_callback = callback;
smpi_comm_copy_data_callback = [](simgrid::kernel::activity::CommImpl* comm, void* buff, size_t size) {
- saved_callback(smx_activity_t(comm), buff, size);
+ saved_callback(comm, buff, size);
};
}
-static void memcpy_private(void* dest, const void* src, std::vector<std::pair<size_t, size_t>>& private_blocks)
+static void memcpy_private(void* dest, const void* src, const std::vector<std::pair<size_t, size_t>>& private_blocks)
{
for (auto const& block : private_blocks)
memcpy((uint8_t*)dest+block.first, (uint8_t*)src+block.first, block.second-block.first);
}
-static void check_blocks(std::vector<std::pair<size_t, size_t>> &private_blocks, size_t buff_size) {
+static void check_blocks(const std::vector<std::pair<size_t, size_t>>& private_blocks, size_t buff_size)
+{
for (auto const& block : private_blocks)
xbt_assert(block.first <= block.second && block.second <= buff_size, "Oops, bug in shared malloc.");
}
}
}
- simix_global->default_function = [executable, fdin_size](std::vector<std::string> args) {
+ simgrid::s4u::Engine::get_instance()->register_default([executable, fdin_size](std::vector<std::string> args) {
return std::function<void()>([executable, fdin_size, args] {
static std::size_t rank = 0;
// Copy the dynamic library:
xbt_assert(entry_point, "Could not resolve entry point");
smpi_run_entry_point(entry_point, executable, args);
});
- };
+ });
}
static void smpi_init_privatization_no_dlopen(const std::string& executable)
smpi_backup_global_memory_segment();
// Execute the same entry point for each simulated process:
- simix_global->default_function = [entry_point, executable](std::vector<std::string> args) {
+ 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); });
- };
+ });
}
int smpi_main(const char* executable, int argc, char* argv[])
/* This is a ... heavy way to count the MPI ranks */
int rank_counts = 0;
- simgrid::s4u::Actor::on_creation.connect([&rank_counts](simgrid::s4u::Actor& actor) {
+ simgrid::s4u::Actor::on_creation.connect([&rank_counts](const simgrid::s4u::Actor& actor) {
if (not actor.is_daemon())
rank_counts++;
});
if(smpi_init_sleep > 0)
simgrid::s4u::this_actor::sleep_for(smpi_init_sleep);
}
+
+void SMPI_thread_create() {
+ TRACE_smpi_init(simgrid::s4u::this_actor::get_pid());
+}