Browse Source

Replace last MSG bits with s4u equivalents

Samuel Thibault 5 years ago
parent
commit
ba664d6a57
7 changed files with 24 additions and 12 deletions
  1. 2 0
      configure.ac
  2. 2 1
      include/starpu_config.h.in
  3. 1 1
      include/starpu_thread.h
  4. 2 1
      src/common/fxt.c
  5. 16 0
      src/core/simgrid.c
  6. 1 1
      src/core/simgrid.h
  7. 0 8
      src/core/simgrid_cpp.cpp

+ 2 - 0
configure.ac

@@ -173,6 +173,7 @@ if test x$enable_simgrid = xyes ; then
 		]
 	)
 	AC_CHECK_HEADERS([simgrid/msg.h], [AC_DEFINE([STARPU_HAVE_SIMGRID_MSG_H], [1], [Define to 1 if you have msg.h in simgrid/.])])
+	AC_CHECK_HEADERS([msg/msg.h], [AC_DEFINE([STARPU_HAVE_MSG_MSG_H], [1], [Define to 1 if you have msg.h in msg/.])])
 	AC_CHECK_HEADERS([simgrid/host.h], [AC_DEFINE([STARPU_HAVE_SIMGRID_HOST_H], [1], [Define to 1 if you have host.h in simgrid/.])])
 	AC_CHECK_HEADERS([xbt/base.h], [AC_DEFINE([STARPU_HAVE_XBT_BASE_H], [1], [Define to 1 if you have base.h in xbt/.])])
 	AC_CHECK_HEADERS([simgrid/version.h], [AC_DEFINE([STARPU_HAVE_SIMGRID_VERSION_H], [1], [Define to 1 if you have version.h in simgrid/.])], [], [[
@@ -196,6 +197,7 @@ if test x$enable_simgrid = xyes ; then
 	# Latest functions
 	AC_CHECK_FUNCS([MSG_process_attach sg_actor_attach sg_actor_init MSG_zone_get_hosts sg_zone_get_hosts MSG_process_self_name MSG_process_userdata_init sg_actor_data])
 	AC_CHECK_FUNCS([xbt_mutex_try_acquire smpi_process_set_user_data sg_zone_get_by_name sg_link_name sg_host_route sg_host_self sg_host_speed simcall_process_create sg_config_continue_after_help])
+	AC_CHECK_FUNCS([simgrid_init], [AC_DEFINE([STARPU_SIMGRID_HAVE_SIMGRID_INIT], [1], [Define to 1 if you have the `simgrid_init' function.])])
 	AC_CHECK_FUNCS([xbt_barrier_init], [AC_DEFINE([STARPU_SIMGRID_HAVE_XBT_BARRIER_INIT], [1], [Define to 1 if you have the `xbt_barrier_init' function.])])
 	AC_CHECK_FUNCS([sg_actor_sleep_for sg_actor_self sg_actor_ref sg_host_get_properties sg_host_send_to sg_cfg_set_int sg_actor_self_execute simgrid_get_clock])
 	AC_CHECK_DECLS([smpi_process_set_user_data], [], [], [[#include <smpi/smpi.h>]])

+ 2 - 1
include/starpu_config.h.in

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2011,2012,2014,2016,2017                 Inria
- * Copyright (C) 2009-2019                                Université de Bordeaux
+ * Copyright (C) 2009-2020                                Université de Bordeaux
  * Copyright (C) 2010-2017,2019                           CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -43,6 +43,7 @@
 #undef STARPU_SIMGRID_MC
 #undef STARPU_SIMGRID_HAVE_XBT_BARRIER_INIT
 #undef STARPU_HAVE_SIMGRID_MSG_H
+#undef STARPU_HAVE_MSG_MSG_H
 #undef STARPU_HAVE_SIMGRID_ACTOR_H
 #undef STARPU_HAVE_SIMGRID_SEMAPHORE_H
 #undef STARPU_HAVE_SIMGRID_MUTEX_H

+ 1 - 1
include/starpu_thread.h

@@ -50,7 +50,7 @@
 #endif
 #ifdef STARPU_HAVE_SIMGRID_MSG_H
 #include <simgrid/msg.h>
-#else
+#elif defined(STARPU_HAVE_MSG_MSG_H)
 #include <msg/msg.h>
 #endif
 #elif !defined(_MSC_VER) || defined(BUILDING_STARPU)

+ 2 - 1
src/common/fxt.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2012,2013,2015                           Inria
- * Copyright (C) 2008-2019                                Université de Bordeaux
+ * Copyright (C) 2008-2020                                Université de Bordeaux
  * Copyright (C) 2010-2018                                CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -19,6 +19,7 @@
 #include <starpu.h>
 #include <common/config.h>
 #include <common/utils.h>
+#include <core/simgrid.h>
 #include <starpu_util.h>
 #include <starpu_profiling.h>
 

+ 16 - 0
src/core/simgrid.c

@@ -286,7 +286,11 @@ void _starpu_start_simgrid(int *argc, char **argv)
 
 	simgrid_started = 1;
 
+#if defined(STARPU_SIMGRID_HAVE_SIMGRID_INIT) && defined(HAVE_SG_ACTOR_INIT)
+	simgrid_init(argc, argv);
+#else
 	MSG_init(argc, argv);
+#endif
 	/* Simgrid uses tiny stacks by default.  This comes unexpected to our users.  */
 	unsigned stack_size = 8192;
 #ifdef HAVE_GETRLIMIT
@@ -310,7 +314,11 @@ void _starpu_start_simgrid(int *argc, char **argv)
 #else
 	_starpu_simgrid_get_platform_path(4, path, sizeof(path));
 #endif
+#if defined(STARPU_SIMGRID_HAVE_SIMGRID_INIT) && defined(HAVE_SG_ACTOR_INIT)
+	simgrid_load_platform(path);
+#else
 	MSG_create_environment(path);
+#endif
 
 	simgrid_transfer_cost = starpu_get_env_number_default("STARPU_SIMGRID_TRANSFER_COST", 1);
 }
@@ -384,14 +392,22 @@ int main(int argc, char **argv)
 	_starpu_simgrid_actor_create("main", &do_starpu_main, _starpu_simgrid_get_host_by_name("MAIN"), argc, argv_cpy);
 
 	/* And run maestro in the main thread */
+#if defined(STARPU_SIMGRID_HAVE_SIMGRID_INIT) && defined(HAVE_SG_ACTOR_INIT)
+	simgrid_run();
+#else
 	MSG_main();
+#endif
 	return main_ret;
 }
 
 #if defined(HAVE_MSG_PROCESS_ATTACH) || defined(MSG_process_attach) || defined(HAVE_SG_ACTOR_ATTACH)
 static void maestro(void *data STARPU_ATTRIBUTE_UNUSED)
 {
+#if defined(STARPU_SIMGRID_HAVE_SIMGRID_INIT) && defined(HAVE_SG_ACTOR_INIT)
+	simgrid_run();
+#else
 	MSG_main();
+#endif
 }
 #endif
 

+ 1 - 1
src/core/simgrid.h

@@ -27,7 +27,7 @@ extern "C"
 #ifdef STARPU_SIMGRID
 #ifdef STARPU_HAVE_SIMGRID_MSG_H
 #include <simgrid/msg.h>
-#else
+#elif defined(STARPU_HAVE_MSG_MSG_H)
 #include <msg/msg.h>
 #endif
 

+ 0 - 8
src/core/simgrid_cpp.cpp

@@ -21,19 +21,11 @@
 #include <common/config.h>
 
 #ifdef STARPU_SIMGRID
-#ifdef STARPU_HAVE_SIMGRID_MSG_H
-#include <simgrid/msg.h>
-#else
-#include <msg/msg.h>
-#endif
 #if SIMGRID_VERSION >= 32190
 #include <simgrid/simix.hpp>
 #else
 #include <simgrid/simix.h>
 #endif
-#ifdef STARPU_HAVE_SIMGRID_HOST_H
-#include <simgrid/host.h>
-#endif
 
 /* thread_create function which implements inheritence of MPI privatization */
 /* See https://github.com/simgrid/simgrid/issues/139 */