Parcourir la source

nmad: add FXT sync point before starting comms and only if tracing is ON

Philippe SWARTVAGHER il y a 5 ans
Parent
commit
8c9f6248de
2 fichiers modifiés avec 11 ajouts et 7 suppressions
  1. 7 6
      mpi/src/nmad/starpu_mpi_nmad.c
  2. 4 1
      src/common/fxt.h

+ 7 - 6
mpi/src/nmad/starpu_mpi_nmad.c

@@ -524,10 +524,13 @@ static void *_starpu_mpi_progress_thread_func(void *arg)
 	_starpu_mpi_datatype_init();
 
 #ifdef STARPU_USE_FXT
-	_starpu_fxt_wait_initialisation();
-	/* We need to record our ID in the trace before the main thread makes any MPI call */
-	_STARPU_MPI_TRACE_START(argc_argv->rank, argc_argv->world_size);
-	starpu_profiling_set_id(argc_argv->rank);
+	if (_starpu_fxt_wait_initialisation())
+	{
+		/* We need to record our ID in the trace before the main thread makes any MPI call */
+		_STARPU_MPI_TRACE_START(argc_argv->rank, argc_argv->world_size);
+		starpu_profiling_set_id(argc_argv->rank);
+		_starpu_mpi_add_sync_point_in_fxt();
+	}
 #endif //STARPU_USE_FXT
 
 	/* notify the main thread that the progression thread is ready */
@@ -536,8 +539,6 @@ static void *_starpu_mpi_progress_thread_func(void *arg)
 	STARPU_PTHREAD_COND_SIGNAL(&progress_cond);
 	STARPU_PTHREAD_MUTEX_UNLOCK(&progress_mutex);
 
-	_starpu_mpi_add_sync_point_in_fxt();
-
 	while (1)
 	{
 		struct callback_lfstack_cell_s* c = callback_lfstack_pop(&callback_stack);

+ 4 - 1
src/common/fxt.h

@@ -265,12 +265,15 @@ extern int _starpu_fxt_willstart;
 extern starpu_pthread_mutex_t _starpu_fxt_started_mutex;
 extern starpu_pthread_cond_t _starpu_fxt_started_cond;
 
-static inline void _starpu_fxt_wait_initialisation()
+/* Wait until FXT is started (or not). Returns if FXT was started */
+static inline int _starpu_fxt_wait_initialisation()
 {
 	STARPU_PTHREAD_MUTEX_LOCK(&_starpu_fxt_started_mutex);
 	while (_starpu_fxt_willstart && !_starpu_fxt_started)
 		STARPU_PTHREAD_COND_WAIT(&_starpu_fxt_started_cond, &_starpu_fxt_started_mutex);
 	STARPU_PTHREAD_MUTEX_UNLOCK(&_starpu_fxt_started_mutex);
+
+	return _starpu_fxt_started;
 }
 
 extern unsigned long _starpu_submit_order;