Use of timer_local before mpi_init

Issue #166 new
David Dickinson created an issue

When built with mpi we use mpi_wtime to provide the current time, as used in timer_local. Unfortunately it is undefined behaviour to call this before mpi_init . As such we should generally avoid calling timer_local before our call to init_mp.

Currently in GS2 the first thing we do is parse the command line and we then call init_gs2_optimisation which calls init_mp as the first action. As such, we’re currently safe in GS2. This issue is just to note the potential problem as it could exist for other codes built from the source.

We could add a call to mpi_initialised in timer_local to work out if we’re allowed to call mpi_wtime or not. This would add safety but may add overhead to our timer calls.

Comments (0)

  1. Log in to comment