Browse Source

nmad: fix signaling there is no pending request anymore

Philippe SWARTVAGHER 4 years ago
parent
commit
dec5e64cd7
2 changed files with 6 additions and 3 deletions
  1. 6 1
      mpi/src/nmad/starpu_mpi_nmad.c
  2. 0 2
      mpi/tests/mpi_scatter_gather.c

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

@@ -548,8 +548,13 @@ static void *_starpu_mpi_progress_thread_func(void *arg)
 			c->req->completed=1;
 			piom_cond_signal(&(c->req->backend->req_cond), REQ_FINALIZED);
 		}
-		STARPU_ATOMIC_ADD( &nb_pending_requests, -1);
+
 		/* we signal that the request is completed.*/
+		int pending_remaining = STARPU_ATOMIC_ADD(&nb_pending_requests, -1);
+		if (!pending_remaining)
+		{
+			STARPU_PTHREAD_COND_BROADCAST(&mpi_wait_for_all_running_cond);
+		}
 
 		free(c);
 	}

+ 0 - 2
mpi/tests/mpi_scatter_gather.c

@@ -192,8 +192,6 @@ int main(int argc, char **argv)
 	// Free memory
 	free(data_handles);
 
-	starpu_mpi_barrier(MPI_COMM_WORLD); // Why adding a barrier helps to to avoid a blocking at the end of the program (observed with nmad) ?
-
 	starpu_mpi_shutdown();
 	return (rank == 0) ? ret : 0;
 }