mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Make 2 threads default and fix -1 for automatic
This commit is contained in:
parent
5ba8e87f55
commit
c3489c5e62
@ -125,7 +125,13 @@ struct MinTimeStepSize { static constexpr Scalar value = 0.0; };
|
|||||||
struct OutputDir { static constexpr auto value = ""; };
|
struct OutputDir { static constexpr auto value = ""; };
|
||||||
|
|
||||||
//! \brief Number of threads per process.
|
//! \brief Number of threads per process.
|
||||||
struct ThreadsPerProcess { static constexpr int value = 1; };
|
struct ThreadsPerProcess {
|
||||||
|
#if _OPENMP
|
||||||
|
static constexpr int value = 2;
|
||||||
|
#else
|
||||||
|
static constexpr int value = 1;
|
||||||
|
#endif // _OPENMP
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace Opm::Parameters
|
} // namespace Opm::Parameters
|
||||||
|
|
||||||
|
@ -261,9 +261,9 @@ void BlackoilModelParameters<Scalar>::registerParameters()
|
|||||||
|
|
||||||
Parameters::Hide<Parameters::DebugEmitCellPartition>();
|
Parameters::Hide<Parameters::DebugEmitCellPartition>();
|
||||||
|
|
||||||
// if openMP is available, determine the number threads per process automatically.
|
// if openMP is available, use two threads per mpi rank by default
|
||||||
#if _OPENMP
|
#if _OPENMP
|
||||||
Parameters::SetDefault<Parameters::ThreadsPerProcess>(-1);
|
Parameters::SetDefault<Parameters::ThreadsPerProcess>(2);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,10 +310,10 @@ namespace Opm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We are not limiting this to the number of processes
|
// Requesting -1 thread will let OMP automatically deduce the number
|
||||||
// reported by OpenMP as on some hardware (and some OpenMPI
|
if (requested_threads != -1) {
|
||||||
// versions) this will be 1 when run with mpirun
|
|
||||||
omp_set_num_threads(threads);
|
omp_set_num_threads(threads);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using TM = GetPropType<TypeTag, Properties::ThreadManager>;
|
using TM = GetPropType<TypeTag, Properties::ThreadManager>;
|
||||||
|
Loading…
Reference in New Issue
Block a user