cap the maximum number of threads used by default at 16
This commit is contained in:
@ -137,8 +137,8 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
|
|||||||
// check and initialize nthreads setting. Default is to use max if there
|
// check and initialize nthreads setting. Default is to use max if there
|
||||||
// is no preference but do not override OMP_NUM_THREADS
|
// is no preference but do not override OMP_NUM_THREADS
|
||||||
#if defined(_OPENMP)
|
#if defined(_OPENMP)
|
||||||
// use maximum number of available threads unless OMP_NUM_THREADS was set
|
// use up to 16 available threads unless OMP_NUM_THREADS was set
|
||||||
int nthreads = settings.value("nthreads", omp_get_max_threads()).toInt();
|
int nthreads = settings.value("nthreads", std::min(omp_get_max_threads(), 16)).toInt();
|
||||||
if (!qEnvironmentVariableIsSet("OMP_NUM_THREADS")) {
|
if (!qEnvironmentVariableIsSet("OMP_NUM_THREADS")) {
|
||||||
qputenv("OMP_NUM_THREADS", std::to_string(nthreads).c_str());
|
qputenv("OMP_NUM_THREADS", std::to_string(nthreads).c_str());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user