From d89f9b870ba1e06fef42f0c8380aa8316457ceba Mon Sep 17 00:00:00 2001 From: "Peter W. Draper" <p.w.draper@durham.ac.uk> Date: Tue, 18 Oct 2016 17:06:28 +0100 Subject: [PATCH] Make sure all message have the correct MPI rank Otherwise until engine_init we see [0000] --- examples/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/main.c b/examples/main.c index e9396bf1c2..06efe75b32 100644 --- a/examples/main.c +++ b/examples/main.c @@ -120,6 +120,10 @@ int main(int argc, char *argv[]) { error("MPI_Comm_size failed with error %i.", res); if ((res = MPI_Comm_rank(MPI_COMM_WORLD, &myrank)) != MPI_SUCCESS) error("Call to MPI_Comm_rank failed with error %i.", res); + + /* Make sure messages are stamped with the correct rank. */ + engine_rank = myrank; + if ((res = MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN)) != MPI_SUCCESS) error("Call to MPI_Comm_set_errhandler failed with error %i.", res); @@ -131,6 +135,7 @@ int main(int argc, char *argv[]) { message("WARNING: you should use the non-MPI version of this program."); } fflush(stdout); + #endif /* Let's pin the main thread */ -- GitLab