Refine OpenMP number-of-threads output.

Now each MPI rank will report, making it easier to see how
MPI and OpenMP interacts w.r.t. processes and threads.
This commit is contained in:
Atgeirr Flø Rasmussen 2015-12-09 11:12:43 +01:00
parent f7c96b4fc5
commit c1bd7670c6

View File

@ -455,8 +455,13 @@ namespace Opm
}
#pragma omp parallel
if (omp_get_thread_num() == 0) {
// opm_get_num_threads() only works as expected within a parallel region.
std::cout << "OpenMP using " << omp_get_num_threads() << " threads." << std::endl;
// omp_get_num_threads() only works as expected within a parallel region.
const int num_omp_threads = omp_get_num_threads();
if (mpi_size == 1) {
std::cout << "OpenMP using " << num_omp_threads << " threads." << std::endl;
} else {
std::cout << "OpenMP using " << num_omp_threads << " threads on MPI rank " << mpi_rank << "." << std::endl;
}
}
#endif
}