std::unordered_map<std::string, double> location2speedup;
static std::map</*process_id*/ simgrid::s4u::Actor const*, simgrid::smpi::ActorExt*> process_data;
-int process_count = 0;
static int smpi_exit_status = 0;
-int smpi_universe_size = 0;
extern double smpi_total_benched_time;
xbt_os_timer_t global_timer;
static std::vector<std::string> privatize_libs_paths;
void (*smpi_comm_copy_data_callback)(simgrid::kernel::activity::CommImpl*, void*,
size_t) = &smpi_comm_copy_buffer_callback;
-int smpi_process_count()
-{
- return process_count;
-}
-
simgrid::smpi::ActorExt* smpi_process()
{
simgrid::s4u::ActorPtr me = simgrid::s4u::Actor::self();
}
int smpi_enabled() {
- return not process_data.empty();
+ return MPI_COMM_WORLD != MPI_COMM_UNINITIALIZED;
}
void smpi_global_init()
std::string filename = simgrid::config::get_value<std::string>("smpi/comp-adjustment-file");
if (not filename.empty()) {
std::ifstream fstream(filename);
- if (not fstream.is_open()) {
- xbt_die("Could not open file %s. Does it exist?", filename.c_str());
- }
+ xbt_assert(fstream.is_open(), "Could not open file %s. Does it exist?", filename.c_str());
std::string line;
typedef boost::tokenizer< boost::escaped_list_separator<char>> Tokenizer;
smpi_copy_file(libpath, target_lib, fdin_size2);
std::string sedcommand = "sed -i -e 's/" + libname + "/" + target_lib + "/g' " + target_executable;
- int ret = system(sedcommand.c_str());
- if (ret != 0)
- xbt_die("error while applying sed command %s \n", sedcommand.c_str());
+ xbt_assert(system(sedcommand.c_str()) == 0, "error while applying sed command %s \n", sedcommand.c_str());
}
}
for (const std::string& target_lib : target_libs)
unlink(target_lib.c_str());
}
- if (handle == nullptr)
- xbt_die("dlopen failed: %s (errno: %d -- %s)", dlerror(), saved_errno, strerror(saved_errno));
+ xbt_assert(handle != nullptr, "dlopen failed: %s (errno: %d -- %s)", dlerror(), saved_errno,
+ strerror(saved_errno));
+
smpi_entry_point_type entry_point = smpi_resolve_function(handle);
- if (not entry_point)
- xbt_die("Could not resolve entry point");
+ xbt_assert(entry_point, "Could not resolve entry point");
smpi_run_entry_point(entry_point, executable, args);
});
};
{
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.c_str(), RTLD_LAZY | RTLD_LOCAL);
- if (handle == nullptr)
- xbt_die("dlopen failed for %s: %s (errno: %d -- %s)", executable.c_str(), dlerror(), errno, strerror(errno));
+ xbt_assert(handle != nullptr, "dlopen failed for %s: %s (errno: %d -- %s)", executable.c_str(), dlerror(), errno,
+ strerror(errno));
smpi_entry_point_type entry_point = smpi_resolve_function(handle);
- if (not entry_point)
- xbt_die("main not found in %s", executable.c_str());
+ xbt_assert(entry_point, "main not found in %s", executable.c_str());
+
if (smpi_privatize_global_variables == SmpiPrivStrategies::MMAP)
smpi_backup_global_memory_segment();
SMPI_app_instance_register(smpi_default_instance_name.c_str(), nullptr,
process_data.size()); // This call has a side effect on process_count...
MPI_COMM_WORLD = *smpi_deployment_comm_world(smpi_default_instance_name);
- smpi_universe_size = process_count;
-
/* Clean IO before the run */
fflush(stdout);
void SMPI_init(){
simgrid::s4u::Actor::on_creation.connect([](simgrid::s4u::Actor& actor) {
if (not actor.is_daemon()) {
- process_data.insert({&actor, new simgrid::smpi::ActorExt(&actor, nullptr)});
+ process_data.insert({&actor, new simgrid::smpi::ActorExt(&actor)});
}
});
simgrid::s4u::Actor::on_destruction.connect([](simgrid::s4u::Actor const& actor) {