Explorar o código

use MPI_THREAD_MULTIPLE and warn user if it is not supported

Corentin Salingue %!s(int64=8) %!d(string=hai) anos
pai
achega
b29424ca91
Modificáronse 1 ficheiros con 8 adicións e 1 borrados
  1. 8 1
      src/drivers/mpi/driver_mpi_common.c

+ 8 - 1
src/drivers/mpi/driver_mpi_common.c

@@ -54,9 +54,16 @@ static void _starpu_mpi_set_src_node_id()
 
 
 int _starpu_mpi_common_mp_init()
 int _starpu_mpi_common_mp_init()
 {
 {
-	if (mpi_initialized || MPI_Init(_starpu_get_argc(), _starpu_get_argv()) != MPI_SUCCESS)
+    int thread_support;
+	if (mpi_initialized || MPI_Init_thread(_starpu_get_argc(), _starpu_get_argv(), MPI_THREAD_MULTIPLE, &thread_support) != MPI_SUCCESS)
         return 0;
         return 0;
 
 
+    if (thread_support != MPI_THREAD_MULTIPLE)
+    {
+        fprintf(stderr, "MPI doesn't support MPI_THREAD_MULTIPLE option. MPI Master-Slave can have problems if multiple slaves are launched. \n");
+    }
+
+
 	mpi_initialized = 1;
 	mpi_initialized = 1;
 
 
     /* Find which node is the master */
     /* Find which node is the master */