Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
deprecate some of simix.h C API
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 13 Jul 2018 19:41:13 +0000 (21:41 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 13 Jul 2018 19:41:13 +0000 (21:41 +0200)
include/simgrid/engine.h
include/simgrid/simix.h
src/msg/msg_legacy.cpp
src/s4u/s4u_Engine.cpp
src/simix/smx_deployment.cpp
src/simix/smx_environment.cpp
src/smpi/internals/smpi_deployment.cpp
src/smpi/internals/smpi_global.cpp
teshsuite/simix/generic-simcalls/generic-simcalls.cpp
teshsuite/simix/stack-overflow/stack-overflow.cpp

index 216127a..194e28c 100644 (file)
@@ -15,7 +15,7 @@ XBT_PUBLIC void simgrid_load_platform(const char* filename);
 XBT_PUBLIC void simgrid_load_deployment(const char* filename);
 XBT_PUBLIC void simgrid_run();
 XBT_PUBLIC void simgrid_register_function(const char* name, int (*code)(int, char**));
 XBT_PUBLIC void simgrid_load_deployment(const char* filename);
 XBT_PUBLIC void simgrid_run();
 XBT_PUBLIC void simgrid_register_function(const char* name, int (*code)(int, char**));
-XBT_PUBLIC void sg_engine_register_default(int (*code)(int, char**));
+XBT_PUBLIC void simgrid_register_default(int (*code)(int, char**));
 XBT_PUBLIC double simgrid_get_clock();
 SG_END_DECL()
 
 XBT_PUBLIC double simgrid_get_clock();
 SG_END_DECL()
 
index 1af2dff..c216902 100644 (file)
@@ -113,7 +113,8 @@ SG_END_DECL()
 
 /******************************* Environment **********************************/
 SG_BEGIN_DECL()
 
 /******************************* Environment **********************************/
 SG_BEGIN_DECL()
-XBT_PUBLIC void SIMIX_create_environment(const char* file);
+XBT_ATTRIB_DEPRECATED_v324("Please use simgrid_load_platform()") XBT_PUBLIC
+    void SIMIX_create_environment(const char* file);
 SG_END_DECL()
 
 #ifdef __cplusplus
 SG_END_DECL()
 
 #ifdef __cplusplus
@@ -122,11 +123,13 @@ XBT_PUBLIC void SIMIX_create_environment(std::string file);
 
 /******************************** Deployment **********************************/
 SG_BEGIN_DECL()
 
 /******************************** Deployment **********************************/
 SG_BEGIN_DECL()
-XBT_PUBLIC void SIMIX_function_register(const char* name, xbt_main_func_t code);
+XBT_ATTRIB_DEPRECATED_v324("Please use simgrid_register_function()") XBT_PUBLIC
+    void SIMIX_function_register(const char* name, xbt_main_func_t code);
+XBT_ATTRIB_DEPRECATED_v324("Please use simgrid_load_deployment()") XBT_PUBLIC
+    void SIMIX_launch_application(const char* file);
 XBT_PUBLIC void SIMIX_function_register_default(xbt_main_func_t code);
 XBT_PUBLIC void SIMIX_function_register_default(xbt_main_func_t code);
-XBT_PUBLIC void SIMIX_init_application();
-XBT_PUBLIC void SIMIX_launch_application(const char* file);
 
 
+XBT_PUBLIC void SIMIX_init_application();
 XBT_PUBLIC void SIMIX_process_set_function(const char* process_host, const char* process_function,
                                            xbt_dynar_t arguments, double process_start_time, double process_kill_time);
 SG_END_DECL()
 XBT_PUBLIC void SIMIX_process_set_function(const char* process_host, const char* process_function,
                                            xbt_dynar_t arguments, double process_start_time, double process_kill_time);
 SG_END_DECL()
index 72957ca..297c8f4 100644 (file)
@@ -28,7 +28,7 @@ void MSG_function_register(const char* name, xbt_main_func_t code)
 }
 void MSG_function_register_default(xbt_main_func_t code)
 {
 }
 void MSG_function_register_default(xbt_main_func_t code)
 {
-  sg_engine_register_default(code);
+  simgrid_register_default(code);
 }
 double MSG_get_clock()
 {
 }
 double MSG_get_clock()
 {
index 2afeecb..4c7026b 100644 (file)
@@ -387,7 +387,7 @@ void simgrid_register_function(const char* name, int (*code)(int, char**))
 {
   simgrid::s4u::Engine::get_instance()->register_function(name, code);
 }
 {
   simgrid::s4u::Engine::get_instance()->register_function(name, code);
 }
-void sg_engine_register_default(int (*code)(int, char**))
+void simgrid_register_default(int (*code)(int, char**))
 {
   simgrid::s4u::Engine::get_instance()->register_default(code);
 }
 {
   simgrid::s4u::Engine::get_instance()->register_default(code);
 }
index b40a64e..d94d87f 100644 (file)
@@ -9,6 +9,7 @@
 #include "simgrid/s4u/Host.hpp"
 #include "smx_private.hpp"
 #include "src/surf/xml/platf_private.hpp" // FIXME: KILLME. There must be a better way than mimicking XML here
 #include "simgrid/s4u/Host.hpp"
 #include "smx_private.hpp"
 #include "src/surf/xml/platf_private.hpp" // FIXME: KILLME. There must be a better way than mimicking XML here
+#include <simgrid/engine.h>
 #include <xbt/ex.hpp>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_deployment, simix, "Logging specific to SIMIX (deployment)");
 #include <xbt/ex.hpp>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_deployment, simix, "Logging specific to SIMIX (deployment)");
@@ -56,9 +57,9 @@ void SIMIX_launch_application(std::string file)
   }
 }
 
   }
 }
 
-void SIMIX_launch_application(const char* file)
+void SIMIX_launch_application(const char* file) // deprecated
 {
 {
-  SIMIX_launch_application(std::string(file));
+  simgrid_load_deployment(file);
 }
 
 // Wrap a main() function into a ActorCodeFactory:
 }
 
 // Wrap a main() function into a ActorCodeFactory:
@@ -82,9 +83,9 @@ void SIMIX_function_register(std::string name, xbt_main_func_t code)
   simix_global->registered_functions[name] = toActorCodeFactory(code);
 }
 
   simix_global->registered_functions[name] = toActorCodeFactory(code);
 }
 
-void SIMIX_function_register(const char* name, xbt_main_func_t code)
+void SIMIX_function_register(const char* name, xbt_main_func_t code) // deprecated
 {
 {
-  SIMIX_function_register(std::string(name), code);
+  simgrid_register_function(name, code);
 }
 
 /**
 }
 
 /**
index 0eb0f4f..94b2e6e 100644 (file)
@@ -6,6 +6,8 @@
 #include "smx_private.hpp"
 #include "src/include/surf/surf.hpp"
 #include "xbt/xbt_os_time.h"
 #include "smx_private.hpp"
 #include "src/include/surf/surf.hpp"
 #include "xbt/xbt_os_time.h"
+
+#include <simgrid/engine.h>
 #include <xbt/ex.hpp>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_environment, simix, "Logging specific to SIMIX (environment)");
 #include <xbt/ex.hpp>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_environment, simix, "Logging specific to SIMIX (environment)");
@@ -44,9 +46,9 @@ void SIMIX_create_environment(std::string file)
   XBT_DEBUG("PARSE TIME: %g", (end - start));
 }
 
   XBT_DEBUG("PARSE TIME: %g", (end - start));
 }
 
-void SIMIX_create_environment(const char* file)
+void SIMIX_create_environment(const char* file) // deprecated
 {
 {
-  SIMIX_create_environment(std::string(file));
+  simgrid_load_platform(file);
 }
 
 void SIMIX_post_create_environment()
 }
 
 void SIMIX_post_create_environment()
index 72b798a..203ed2a 100644 (file)
@@ -50,7 +50,7 @@ extern int process_count; // How many processes have been allocated over all ins
 void SMPI_app_instance_register(const char *name, xbt_main_func_t code, int num_processes)
 {
   if (code != nullptr) { // When started with smpirun, we will not execute a function
 void SMPI_app_instance_register(const char *name, xbt_main_func_t code, int num_processes)
 {
   if (code != nullptr) { // When started with smpirun, we will not execute a function
-    SIMIX_function_register(name, code);
+    simgrid::s4u::Engine::get_instance()->register_function(name, code);
   }
 
   static int already_called = 0;
   }
 
   static int already_called = 0;
index f876f6a..e8e29ab 100644 (file)
@@ -633,12 +633,12 @@ int smpi_main(const char* executable, int argc, char* argv[])
 
   // TODO This will not be executed in the case where smpi_main is not called,
   // e.g., not for smpi_msg_masterslave. This should be moved to another location
 
   // TODO This will not be executed in the case where smpi_main is not called,
   // e.g., not for smpi_msg_masterslave. This should be moved to another location
-  // that is always called -- maybe close to Actor::onCreation?
+  // that is always called -- maybe close to Actor::on_creation?
   simgrid::s4u::Host::on_creation.connect(
       [](simgrid::s4u::Host& host) { host.extension_set(new simgrid::smpi::Host(&host)); });
 
   // parse the platform file: get the host list
   simgrid::s4u::Host::on_creation.connect(
       [](simgrid::s4u::Host& host) { host.extension_set(new simgrid::smpi::Host(&host)); });
 
   // parse the platform file: get the host list
-  SIMIX_create_environment(argv[1]);
+  simgrid::s4u::Engine::get_instance()->load_platform(argv[1]);
   SIMIX_comm_set_copy_data_callback(smpi_comm_copy_buffer_callback);
 
   smpi_init_options();
   SIMIX_comm_set_copy_data_callback(smpi_comm_copy_buffer_callback);
 
   smpi_init_options();
@@ -648,7 +648,7 @@ int smpi_main(const char* executable, int argc, char* argv[])
     smpi_init_privatization_no_dlopen(executable);
 
   SMPI_init();
     smpi_init_privatization_no_dlopen(executable);
 
   SMPI_init();
-  SIMIX_launch_application(argv[2]);
+  simgrid::s4u::Engine::get_instance()->load_deployment(argv[2]);
   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_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);
index 497861e..6bc8cf5 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <xbt/future.hpp>
 
 
 #include <xbt/future.hpp>
 
+#include <simgrid/engine.h>
 #include <simgrid/kernel/future.hpp>
 #include <simgrid/simix.hpp>
 #include <simgrid/simix/blocking_simcall.hpp>
 #include <simgrid/kernel/future.hpp>
 #include <simgrid/simix.hpp>
 #include <simgrid/simix/blocking_simcall.hpp>
@@ -102,8 +103,8 @@ int main(int argc, char* argv[])
 {
   SIMIX_global_init(&argc, argv);
   xbt_assert(argc == 2, "Usage: %s platform.xml\n", argv[0]);
 {
   SIMIX_global_init(&argc, argv);
   xbt_assert(argc == 2, "Usage: %s platform.xml\n", argv[0]);
-  SIMIX_function_register("master", example::master);
-  SIMIX_create_environment(argv[1]);
+  simgrid_register_function("master", example::master);
+  simgrid_load_platform(argv[1]);
   simcall_process_create("master", example::master, NULL, sg_host_by_name("Tremblay"), 0, NULL, NULL);
   SIMIX_run();
   return 0;
   simcall_process_create("master", example::master, NULL, sg_host_by_name("Tremblay"), 0, NULL, NULL);
   SIMIX_run();
   return 0;
index 94841ad..8c56b32 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "simgrid/simix.h"
 #include "xbt/log.h"
 
 #include "simgrid/simix.h"
 #include "xbt/log.h"
+#include <simgrid/engine.h>
 
 #include <string>
 
 
 #include <string>
 
@@ -45,8 +46,8 @@ int main(int argc, char* argv[])
 
   xbt_assert(argc == 2, "Usage: %s platform.xml\n", argv[0]);
 
 
   xbt_assert(argc == 2, "Usage: %s platform.xml\n", argv[0]);
 
-  SIMIX_function_register("master", master);
-  SIMIX_create_environment(argv[1]);
+  simgrid_register_function("master", master);
+  simgrid_load_platform(argv[1]);
   simcall_process_create("master", master, NULL, sg_host_by_name("Tremblay"), 0, NULL, NULL);
   SIMIX_run();
 
   simcall_process_create("master", master, NULL, sg_host_by_name("Tremblay"), 0, NULL, NULL);
   SIMIX_run();