Selaa lähdekoodia

Add STARPU_SIMGRID guard against using a native build for simulation

Samuel Thibault 4 vuotta sitten
vanhempi
commit
d95b675fd4
3 muutettua tiedostoa jossa 18 lisäystä ja 0 poistoa
  1. 1 0
      ChangeLog
  2. 9 0
      doc/doxygen/chapters/501_environment_variables.doxy
  3. 8 0
      src/core/workers.c

+ 1 - 0
ChangeLog

@@ -69,6 +69,7 @@ Small features:
     STARPU_MPI_THREAD_COREID environment variables to bind threads to cores
     instead of hyperthreads.
   * New STARPU_TASK_PROGRESS environment variable to show task progression.
+  * Add STARPU_SIMGRID environment variable guard against native builds.
 
 StarPU 1.3.7
 ====================================================================

+ 9 - 0
doc/doxygen/chapters/501_environment_variables.doxy

@@ -738,6 +738,15 @@ block when the memory allocation required for network reception overflows the
 available main memory (as typically set by \ref STARPU_LIMIT_CPU_MEM)
 </dd>
 
+<dt>STARPU_SIMGRID</dt>
+<dd>
+\anchor STARPU_SIMGRID
+\addindex __env__STARPU_SIMGRID
+When set to 1 (the default is 0), this makes StarPU check that it was really
+build with simulation support. This is convenient in scripts to avoid using a
+native version, that would try to update performance models...
+</dd>
+
 <dt>STARPU_SIMGRID_TRANSFER_COST</dt>
 <dd>
 \anchor STARPU_SIMGRID_TRANSFER_COST

+ 8 - 0
src/core/workers.c

@@ -1531,6 +1531,14 @@ int starpu_initialize(struct starpu_conf *user_conf, int *argc, char ***argv)
 		_STARPU_DISP("Warning: STARPU_ENABLE_STATS is enabled, which slows down a bit\n");
 	}
 
+#ifndef STARPU_SIMGRID
+	if (starpu_get_env_number_default("STARPU_SIMGRID", 0))
+	{
+		_STARPU_DISP("Simulation mode requested, but this libstarpu was built without simgrid support, please recompile\n");
+		return -EINVAL;
+	}
+#endif
+
 #if defined(_WIN32) && !defined(__CYGWIN__)
 	WSADATA wsadata;
 	WSAStartup(MAKEWORD(1,0), &wsadata);