mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Reduce default number of threads from four to two with OpenMP
This commit is contained in:
parent
48bcfacb41
commit
e72ef6bcc7
@ -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