Ver código fonte

nmad: take into account env var STARPU_MPI_THREAD_CPUID

Philippe SWARTVAGHER 5 anos atrás
pai
commit
63b1bed746
1 arquivos alterados com 10 adições e 18 exclusões
  1. 10 18
      mpi/src/nmad/starpu_mpi_nmad.c

+ 10 - 18
mpi/src/nmad/starpu_mpi_nmad.c

@@ -420,25 +420,14 @@ static void *_starpu_mpi_progress_thread_func(void *arg)
 	struct _starpu_mpi_argc_argv *argc_argv = (struct _starpu_mpi_argc_argv *) arg;
 
 #ifndef STARPU_SIMGRID
-	if (_starpu_mpi_thread_cpuid < 0)
-	{
-		_starpu_mpi_thread_cpuid = starpu_get_next_bindid(0, NULL, 0);
-	}
-
 	if (starpu_bind_thread_on(_starpu_mpi_thread_cpuid, 0, "MPI") < 0)
 	{
 		char hostname[65];
 		gethostname(hostname, sizeof(hostname));
 		_STARPU_DISP("[%s] No core was available for the MPI thread. You should use STARPU_RESERVE_NCPU to leave one core available for MPI, or specify one core less in STARPU_NCPU\n", hostname);
 	}
-
-	if (_starpu_mpi_thread_cpuid >= 0)
-		/* In case MPI changed the binding */
-		starpu_bind_thread_on(_starpu_mpi_thread_cpuid, STARPU_THREAD_ACTIVE, "MPI");
 #endif
 
-	_starpu_mpi_env_init();
-
 #ifdef STARPU_SIMGRID
 	/* Now that MPI is set up, let the rest of simgrid get initialized */
 	char **argv_cpy;
@@ -594,18 +583,21 @@ int _starpu_mpi_progress_init(struct _starpu_mpi_argc_argv *argc_argv)
 	starpu_sem_init(&callback_sem, 0, 0);
 	running = 0;
 
+	_starpu_mpi_env_init();
+
 	/* This function calls MPI_Init_thread if needed, and it initializes internal NMAD/Pioman variables,
 	 * required for piom_ltask_set_bound_thread_indexes() */
 	_starpu_mpi_do_initialize(argc_argv);
 
-	/* Tell pioman to use a bound thread for communication progression */
-	unsigned piom_bindid = starpu_get_next_bindid(STARPU_THREAD_ACTIVE, NULL, 0);
-	int indexes[1] = {piom_bindid};
-	piom_ltask_set_bound_thread_indexes(HWLOC_OBJ_PU,indexes,1);
+	if (_starpu_mpi_thread_cpuid < 0)
+	{
+		_starpu_mpi_thread_cpuid = starpu_get_next_bindid(STARPU_THREAD_ACTIVE, NULL, 0);
+	}
 
-	/* We force the "MPI" thread to share the same core as the pioman thread
-	   to avoid binding it on the same core as a worker */
-	_starpu_mpi_thread_cpuid = piom_bindid;
+	/* Tell pioman to use a bound thread for communication progression:
+	 * share the same core as StarPU's MPI thread, the MPI thread has very low activity with NMAD backend */
+	int indexes[1] = { _starpu_mpi_thread_cpuid };
+	piom_ltask_set_bound_thread_indexes(HWLOC_OBJ_PU, indexes, 1);
 
 	/* Register some hooks for communication progress if needed */
 	int polling_point_prog, polling_point_idle;