From 75050b8920842e5ac451d42972a99ab05b87ec01 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 3 Oct 2023 15:40:06 -0400 Subject: [PATCH] get upper thread limit from Qt so we can raise the number of threads --- tools/lammps-gui/preferences.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/lammps-gui/preferences.cpp b/tools/lammps-gui/preferences.cpp index 1e8e23ad62..624f59009c 100644 --- a/tools/lammps-gui/preferences.cpp +++ b/tools/lammps-gui/preferences.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #if defined(_OPENMP) #include @@ -400,11 +401,11 @@ AcceleratorTab::AcceleratorTab(QSettings *_settings, LammpsWrapper *_lammps, QWi int maxthreads = 1; #if defined(_OPENMP) - maxthreads = omp_get_max_threads(); + maxthreads = QThread::idealThreadCount(); #endif auto *choices = new QFrame; auto *choiceLayout = new QVBoxLayout; - auto *ntlabel = new QLabel("Number of threads:"); + auto *ntlabel = new QLabel(QString("Number of threads (max %1):").arg(maxthreads)); auto *ntchoice = new QLineEdit(settings->value("nthreads", maxthreads).toString()); auto *intval = new QIntValidator(1, maxthreads, this); ntchoice->setValidator(intval);