mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #1562 from andlaus/threading_fixes
flow: default to 2 threads if OpenMP is available
This commit is contained in:
commit
af863c82a0
@ -78,6 +78,11 @@ SET_SCALAR_PROP(FlowModelParameters, MaxPressureChangeMsWells, 2.0 *1e5);
|
|||||||
SET_BOOL_PROP(FlowModelParameters, UseInnerIterationsMsWells, true);
|
SET_BOOL_PROP(FlowModelParameters, UseInnerIterationsMsWells, true);
|
||||||
SET_INT_PROP(FlowModelParameters, MaxInnerIterMsWells, 10);
|
SET_INT_PROP(FlowModelParameters, MaxInnerIterMsWells, 10);
|
||||||
|
|
||||||
|
// if openMP is available, determine the number threads per process automatically.
|
||||||
|
#if _OPENMP
|
||||||
|
SET_INT_PROP(FlowModelParameters, ThreadsPerProcess, -1);
|
||||||
|
#endif
|
||||||
|
|
||||||
END_PROPERTIES
|
END_PROPERTIES
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
|
@ -255,6 +255,13 @@ namespace Opm
|
|||||||
mpi_rank_ = 0;
|
mpi_rank_ = 0;
|
||||||
mpi_size_ = 1;
|
mpi_size_ = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if _OPENMP
|
||||||
|
// if openMP is available, default to 2 threads per process.
|
||||||
|
if (!getenv("OMP_NUM_THREADS"))
|
||||||
|
omp_set_num_threads(std::min(2, omp_get_num_procs()));
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef typename GET_PROP_TYPE(TypeTag, ThreadManager) ThreadManager;
|
typedef typename GET_PROP_TYPE(TypeTag, ThreadManager) ThreadManager;
|
||||||
ThreadManager::init();
|
ThreadManager::init();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user