1 /* Copyright (c) 2007-2020. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "simgrid/s4u/Host.hpp"
7 #include "smx_private.hpp"
8 #include "src/kernel/EngineImpl.hpp"
9 #include "src/surf/xml/platf_private.hpp" // FIXME: KILLME. There must be a better way than mimicking XML here
10 #include <simgrid/engine.h>
11 #include <simgrid/s4u/Engine.hpp>
16 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_deployment, simix, "Logging specific to SIMIX (deployment)");
18 void SIMIX_init_application() // XBT_DEPRECATED_v329
24 void SIMIX_launch_application(const std::string& file) // XBT_DEPRECATED_v329
26 simgrid_load_deployment(file.c_str());
28 void SIMIX_function_register(const std::string& name, xbt_main_func_t code) // XBT_DEPRECATED_v329
30 simgrid::s4u::Engine::get_instance()->register_function(name, code);
32 void SIMIX_function_register(const std::string& name, void (*code)(std::vector<std::string>)) // XBT_DEPRECATED_v329
34 simgrid::s4u::Engine::get_instance()->register_function(name, code);
36 void SIMIX_function_register_default(xbt_main_func_t code) // XBT_DEPRECATED_v329
38 simgrid::s4u::Engine::get_instance()->register_default(code);
41 /** @brief Bypass the parser, get arguments, and set function to each process */
42 void SIMIX_process_set_function(const char* process_host, const char* process_function, xbt_dynar_t arguments,
43 double process_start_time, double process_kill_time) // XBT_ATTRIB_DEPRECATED_v329
45 simgrid::kernel::routing::ActorCreationArgs actor;
47 const simgrid::s4u::Host* host = sg_host_by_name(process_host);
49 throw std::invalid_argument(simgrid::xbt::string_printf("Host '%s' unknown", process_host));
50 actor.host = process_host;
51 actor.args.push_back(process_function);
55 xbt_dynar_foreach(arguments, i, arg) {
56 actor.args.push_back(arg);
59 // Check we know how to handle this function name:
60 const simgrid::kernel::actor::ActorCodeFactory& parse_code =
61 simgrid::kernel::EngineImpl::get_instance()->get_function(process_function);
62 xbt_assert(parse_code, "Function '%s' unknown", process_function);
64 actor.function = process_function;
65 actor.host = process_host;
66 actor.kill_time = process_kill_time;
67 actor.start_time = process_start_time;
68 actor.restart_on_failure = false;
69 sg_platf_new_actor(&actor);