Side effect with WALBERLA_LOG_INFO_ON_ROOT
Hi,
I just stumbled over a side-effect of using WALBERLA_LOG_INFO_ON_ROOT
. Once understood what happens
Today I noticed that the two apps
- annulus
- PolarLaplacian
do get stuck when run with more than one MPI process. Now these are simple 2D demo apps, so were not necessarily intended to run in parallel. Nevertheless the behaviour was a little surprising. The problem turned out to be in each case a line of code such as the one below from annulus.cpp
WALBERLA_LOG_INFO_ON_ROOT( "* no. of global inner DoFs (HyTeG) ....... " << numberOfGlobalInnerDoFs< enumTag >( *storage, level ) );
The problem arises from the fact that WALBERLA_LOG_INFO_ON_ROOT
actually is a macro and not a function call. When expanded it seems it does not do anything, if not 'called' on the root process. Hence, as a side-effect, on all other processes numberOfGlobalInnerDoFs
is not invoked. However, the latter wants to perform an MPI reduction. Consequently the root process keeps waiting in vain for answers from its colleagues.
Simple to fix, of course.
Cheers
Marcus