瀏覽代碼

nmad: call MPI_Init_thread before any call to nmad functions

Philippe SWARTVAGHER 5 年之前
父節點
當前提交
5a7354bafc
共有 2 個文件被更改,包括 6 次插入2 次删除
  1. 1 1
      mpi/examples/filters/filter.c
  2. 5 1
      mpi/src/nmad/starpu_mpi_nmad.c

+ 1 - 1
mpi/examples/filters/filter.c

@@ -31,7 +31,7 @@ void cpu_func(void *buffers[], void *cl_arg)
 	int rank;
 
 	starpu_mpi_comm_rank(MPI_COMM_WORLD, &rank);
-	fprintf(stderr, "comuting on rank %d\n", rank);
+	fprintf(stderr, "computing on rank %d\n", rank);
         unsigned n = STARPU_VECTOR_GET_NX(buffers[0]);
         int *val = (int *)STARPU_VECTOR_GET_PTR(buffers[0]);
 	starpu_codelet_unpack_args(cl_arg, &factor);

+ 5 - 1
mpi/src/nmad/starpu_mpi_nmad.c

@@ -428,7 +428,7 @@ static void *_starpu_mpi_progress_thread_func(void *arg)
 		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);
 	}
-	_starpu_mpi_do_initialize(argc_argv);
+
 	if (_starpu_mpi_thread_cpuid >= 0)
 		/* In case MPI changed the binding */
 		starpu_bind_thread_on(_starpu_mpi_thread_cpuid, STARPU_THREAD_ACTIVE, "MPI");
@@ -591,6 +591,10 @@ int _starpu_mpi_progress_init(struct _starpu_mpi_argc_argv *argc_argv)
 	starpu_sem_init(&callback_sem, 0, 0);
 	running = 0;
 
+	/* 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};