Use correct number of threads when printing banner.

At that stage flow did not set the number of thread in the case where
OMP_NUM_THREADS is not defined. That happens in setupParallelism which
is called when the simulator is run. Hence we have to manually compute
the number of threads similar to there.
This commit is contained in:
Markus Blatt 2019-11-12 09:36:56 +01:00
parent afc76a8b27
commit b4ec2f0611

View File

@ -224,7 +224,13 @@ namespace Opm
int mpiSize = 1; int mpiSize = 1;
#ifdef _OPENMP #ifdef _OPENMP
threads = omp_get_max_threads(); // This function is called before the parallel OpenMP stuff gets initialized.
// That initialization happends after the deck is read and we want this message.
// Hence we duplicate the code of setupParallelism to get the number of threads.
if (getenv("OMP_NUM_THREADS"))
threads = omp_get_max_threads();
else
threads = std::min(2, omp_get_max_threads());
#endif #endif
#if HAVE_MPI #if HAVE_MPI