Pārlūkot izejas kodu

automatically set contexts/factory:thread when using MSG_process_attach, and test this

Samuel Thibault 8 gadi atpakaļ
vecāks
revīzija
173e6139ac
3 mainītis faili ar 16 papildinājumiem un 3 dzēšanām
  1. 2 3
      src/core/simgrid.c
  2. 5 0
      tests/Makefile.am
  3. 9 0
      tests/datawizard/simgrid-locality.c

+ 2 - 3
src/core/simgrid.c

@@ -267,9 +267,8 @@ void _starpu_simgrid_init(int *argc, char ***argv)
 #ifdef HAVE_MSG_PROCESS_ATTACH
 	if (!simgrid_started)
 	{
-#if SIMGRID_VERSION_MAJOR < 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR < 14)
-		_STARPU_DISP("In simgrid mode, the file containing the main() function of this application should to be compiled with starpu.h or starpu_simgrid_wrap.h included, to properly rename it into starpu_main to avoid having to use --cfg=contexts/factory:thread which reduces performance\n");
-#endif
+		_STARPU_DISP("Warning: In simgrid mode, the file containing the main() function of this application should to be compiled with starpu.h or starpu_simgrid_wrap.h included, to properly rename it into starpu_main to avoid having to use contexts/factory:thread which reduces performance\n");
+		xbt_cfg_set_string("contexts/factory", "thread");
 		/* We didn't catch application's main. */
 		/* Start maestro as a separate thread */
 		SIMIX_set_maestro(maestro, NULL);

+ 5 - 0
tests/Makefile.am

@@ -305,6 +305,11 @@ noinst_PROGRAMS =				\
 	sched_policies/simple_deps              \
 	sched_policies/simple_cpu_gpu_sched
 
+if STARPU_SIMGRID
+noinst_PROGRAMS +=				\
+	datawizard/simgrid-locality
+endif
+
 if STARPU_HAVE_FC
 if !STARPU_SANITIZE
 if !STARPU_SIMGRID

+ 9 - 0
tests/datawizard/simgrid-locality.c

@@ -0,0 +1,9 @@
+/* Check that defining a main makes starpu use MSG_process_attach. */
+#include "locality.c"
+#include <config.h>
+#ifdef HAVE_MSG_PROCESS_ATTACH
+#undef main
+int main(int argc, char *argv[]) {
+	return starpu_main(argc, argv);
+}
+#endif