mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-02 12:36:54 -06:00
Added/fixed comments
This commit is contained in:
parent
a208f793d5
commit
d43b88af76
@ -156,14 +156,15 @@ try
|
|||||||
|
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
if (!getenv("OMP_NUM_THREADS")) {
|
if (!getenv("OMP_NUM_THREADS")) {
|
||||||
//Default to max(4,#cores) threads,
|
//Default to at most 4 threads, regardless of
|
||||||
//not number of cores (unless ENV(OMP_NUM_THREADS) is defined)
|
//number of cores (unless ENV(OMP_NUM_THREADS) is defined)
|
||||||
int num_cores = omp_get_num_procs();
|
int num_cores = omp_get_num_procs();
|
||||||
int num_threads = std::min(4, num_cores);
|
int num_threads = std::min(4, num_cores);
|
||||||
omp_set_num_threads(num_threads);
|
omp_set_num_threads(num_threads);
|
||||||
}
|
}
|
||||||
#pragma omp parallel
|
#pragma omp parallel
|
||||||
if (omp_get_thread_num() == 0){
|
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;
|
std::cout << "OpenMP using " << omp_get_num_threads() << " threads." << std::endl;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user