mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-26 01:01:00 -06:00
Merge pull request #1515 from alfbr/master
Reduce default number of threads from four to two with OpenMP
This commit is contained in:
commit
10b0c45c2f
@ -155,10 +155,10 @@ namespace Opm
|
||||
#ifdef _OPENMP
|
||||
// OpenMP setup.
|
||||
if (!getenv("OMP_NUM_THREADS")) {
|
||||
// Default to at most 4 threads, regardless of
|
||||
// Default to at most 2 threads, regardless of
|
||||
// number of cores (unless ENV(OMP_NUM_THREADS) is defined)
|
||||
int num_cores = omp_get_num_procs();
|
||||
int num_threads = std::min(4, num_cores);
|
||||
int num_threads = std::min(2, num_cores);
|
||||
omp_set_num_threads(num_threads);
|
||||
}
|
||||
// omp_get_num_threads() only works as expected within a parallel region.
|
||||
|
Loading…
Reference in New Issue
Block a user