Browse Source

Add STARPU_MPI_PRIORITIES environment variable

Samuel Thibault 7 years ago
parent
commit
187c7a8839

+ 2 - 1
ChangeLog

@@ -53,7 +53,8 @@ Small features:
     STARPU_TASK_WHERE to be used when calling starpu_task_insert().
   * Add SubmitOrder trace field.
   * Add workerids and workerids_len task fields.
-  * Add priority management to StarPU-MPI.
+  * Add priority management to StarPU-MPI. Can be disabled with
+  the STARPU_MPI_PRIORITIES environment variable.
   * Add STARPU_MAIN_THREAD_CPUID and STARPU_MPI_THREAD_CPUID environment
     variables.
   * Add disk to disk copy functions and support asynchronous full read/write

+ 4 - 0
doc/doxygen/chapters/410_mpi_support.doxy

@@ -680,6 +680,10 @@ requests before submitting them to MPI. The default priority is 0.
 When using the starpu_mpi_task_insert helper, STARPU_PRIORITY defines both the
 task priority and the MPI requests priority.
 
+To test how much MPI priorities have a good effect on performance, you can
+set the environment variable STARPU_MPI_PRIORITIES to 0 to disable the use of
+priorities in StarPU-MPI.
+
 \section MPICache MPI cache support
 
 StarPU-MPI automatically optimizes duplicate data transmissions: if an MPI

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

@@ -585,6 +585,14 @@ it prints messages on the standard output when data are added or removed from th
 communication cache.
 </dd>
 
+<dt>STARPU_MPI_PRIORITIES</dt>
+<dd>
+\anchor STARPU_MPI_PRIORITIES
+\addindex __env__STARPU_MPI_PRIORITIES
+When set to 0, the use of priorities to order MPI communications is disabled
+(\ref MPISupport).
+</dd>
+
 <dt>STARPU_MPI_FAKE_SIZE</dt>
 <dd>
 \anchor STARPU_MPI_FAKE_SIZE

+ 4 - 1
mpi/src/mpi/starpu_mpi_mpi.c

@@ -50,6 +50,7 @@ static unsigned nready_process;
 static unsigned ndetached_send;
 
 static int mpi_thread_cpuid = -1;
+static int use_prio = 1;
 
 static void _starpu_mpi_add_sync_point_in_fxt(void);
 static void _starpu_mpi_submit_ready_request(void *arg);
@@ -371,7 +372,8 @@ struct _starpu_mpi_req *_starpu_mpi_isend_irecv_common(starpu_data_handle_t data
 	_starpu_mpi_request_init(&req);
 	req->request_type = request_type;
 	/* prio_list is sorted by increasing values */
-	req->prio = prio;
+	if (use_prio)
+		req->prio = prio;
 	req->data_handle = data_handle;
 	req->node_tag.rank = srcdst;
 	req->node_tag.data_tag = data_tag;
@@ -1583,6 +1585,7 @@ int _starpu_mpi_progress_init(struct _starpu_mpi_argc_argv *argc_argv)
 	nready_process = starpu_get_env_number_default("STARPU_MPI_NREADY_PROCESS", 10);
 	ndetached_send = starpu_get_env_number_default("STARPU_MPI_NDETACHED_SEND", 10);
 	mpi_thread_cpuid = starpu_get_env_number_default("STARPU_MPI_THREAD_CPUID", -1);
+	use_prio = starpu_get_env_number_default("STARPU_MPI_PRIORITIES", 1);
 
 #ifdef STARPU_SIMGRID
 	STARPU_PTHREAD_MUTEX_INIT(&wait_counter_mutex, NULL);

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

@@ -47,6 +47,7 @@ static void _starpu_mpi_handle_pending_request(struct _starpu_mpi_req *req);
 static void _starpu_mpi_add_sync_point_in_fxt(void);
 
 static int mpi_thread_cpuid = -1;
+static int use_prio = 1;
 int _starpu_mpi_fake_world_size = -1;
 int _starpu_mpi_fake_world_rank = -1;
 
@@ -174,7 +175,8 @@ struct _starpu_mpi_req *_starpu_mpi_isend_irecv_common(starpu_data_handle_t data
 	_starpu_mpi_request_init(&req);
 	req->request_type = request_type;
 	/* prio_list is sorted by increasing values */
-	req->prio = prio;
+	if (use_prio)
+		req->prio = prio;
 	req->data_handle = data_handle;
 	req->node_tag.rank = srcdst;
 	req->node_tag.data_tag = data_tag;
@@ -741,6 +743,7 @@ int _starpu_mpi_progress_init(struct _starpu_mpi_argc_argv *argc_argv)
 	starpu_sem_init(&callback_sem, 0, 0);
 	running = 0;
 	mpi_thread_cpuid = starpu_get_env_number_default("STARPU_MPI_THREAD_CPUID", -1);
+	use_prio = starpu_get_env_number_default("STARPU_MPI_PRIORITIES", 1);
 
 	STARPU_PTHREAD_CREATE(&progress_thread, NULL, _starpu_mpi_progress_thread_func, argc_argv);