Explorar o código

notify main that mpi is started before waiting for fxt to start, otherwise we can have a deadlock

Samuel Thibault %!s(int64=7) %!d(string=hai) anos
pai
achega
89973c04cc
Modificáronse 2 ficheiros con 28 adicións e 27 borrados
  1. 17 17
      mpi/src/mpi/starpu_mpi_mpi.c
  2. 11 10
      mpi/src/nmad/starpu_mpi_nmad.c

+ 17 - 17
mpi/src/mpi/starpu_mpi_mpi.c

@@ -1248,18 +1248,6 @@ static void *_starpu_mpi_progress_thread_func(void *arg)
 	smpi_process_set_user_data(tsd);
 #endif
 
-#ifdef STARPU_USE_FXT
-	_starpu_fxt_wait_initialisation();
-#endif //STARPU_USE_FXT
-
-	{
-		_STARPU_MPI_TRACE_START(argc_argv->rank, argc_argv->world_size);
-#ifdef STARPU_USE_FXT
-		starpu_profiling_set_id(argc_argv->rank);
-#endif //STARPU_USE_FXT
-	}
-
-	_starpu_mpi_add_sync_point_in_fxt();
 	_starpu_mpi_comm_amounts_init(argc_argv->comm);
 	_starpu_mpi_cache_init(argc_argv->comm);
 	_starpu_mpi_select_node_init();
@@ -1271,18 +1259,30 @@ static void *_starpu_mpi_progress_thread_func(void *arg)
 	_starpu_mpi_sync_data_init();
 	_starpu_mpi_datatype_init();
 
+#ifdef STARPU_SIMGRID
+	starpu_pthread_wait_init(&wait);
+	starpu_pthread_queue_init(&dontsleep);
+	starpu_pthread_queue_register(&wait, &dontsleep);
+#endif
+
 	/* notify the main thread that the progression thread is ready */
 	STARPU_PTHREAD_MUTEX_LOCK(&progress_mutex);
 	running = 1;
 	STARPU_PTHREAD_COND_SIGNAL(&progress_cond);
 	STARPU_PTHREAD_MUTEX_UNLOCK(&progress_mutex);
 
-#ifdef STARPU_SIMGRID
-	starpu_pthread_wait_init(&wait);
-	starpu_pthread_queue_init(&dontsleep);
-	starpu_pthread_queue_register(&wait, &dontsleep);
-#endif
+#ifdef STARPU_USE_FXT
+	_starpu_fxt_wait_initialisation();
+#endif //STARPU_USE_FXT
 
+	{
+		_STARPU_MPI_TRACE_START(argc_argv->rank, argc_argv->world_size);
+#ifdef STARPU_USE_FXT
+		starpu_profiling_set_id(argc_argv->rank);
+#endif //STARPU_USE_FXT
+	}
+
+	_starpu_mpi_add_sync_point_in_fxt();
 	STARPU_PTHREAD_MUTEX_LOCK(&progress_mutex);
 
  	int envelope_request_submitted = 0;

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

@@ -606,6 +606,17 @@ static void *_starpu_mpi_progress_thread_func(void *arg)
 	smpi_process_set_user_data(tsd);
 #endif
 
+	_starpu_mpi_comm_amounts_init(argc_argv->comm);
+	_starpu_mpi_cache_init(argc_argv->comm);
+	_starpu_mpi_select_node_init();
+	_starpu_mpi_datatype_init();
+
+	/* notify the main thread that the progression thread is ready */
+	STARPU_PTHREAD_MUTEX_LOCK(&progress_mutex);
+	running = 1;
+	STARPU_PTHREAD_COND_SIGNAL(&progress_cond);
+	STARPU_PTHREAD_MUTEX_UNLOCK(&progress_mutex);
+
 #ifdef STARPU_USE_FXT
 	_starpu_fxt_wait_initialisation();
 #endif //STARPU_USE_FXT
@@ -618,16 +629,6 @@ static void *_starpu_mpi_progress_thread_func(void *arg)
 	}
 
 	_starpu_mpi_add_sync_point_in_fxt();
-	_starpu_mpi_comm_amounts_init(argc_argv->comm);
-	_starpu_mpi_cache_init(argc_argv->comm);
-	_starpu_mpi_select_node_init();
-	_starpu_mpi_datatype_init();
-
-	/* notify the main thread that the progression thread is ready */
-	STARPU_PTHREAD_MUTEX_LOCK(&progress_mutex);
-	running = 1;
-	STARPU_PTHREAD_COND_SIGNAL(&progress_cond);
-	STARPU_PTHREAD_MUTEX_UNLOCK(&progress_mutex);
 
 	while (1)
 	{