reset number of threads to 1 when using no accelerator or opt
This commit is contained in:
@ -508,6 +508,8 @@ void LammpsGui::update_variables()
|
||||
|
||||
for (const auto &line : doc) {
|
||||
|
||||
if (line.isEmpty()) continue;
|
||||
|
||||
// first find variable definitions.
|
||||
// index variables are special since they can be overridden from the command line
|
||||
auto index = indexvar.match(line);
|
||||
|
||||
@ -40,8 +40,8 @@
|
||||
#include <QSpacerItem>
|
||||
#include <QSpinBox>
|
||||
#include <QTabWidget>
|
||||
#include <QVBoxLayout>
|
||||
#include <QThread>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#if defined(_OPENMP)
|
||||
#include <omp.h>
|
||||
@ -110,10 +110,15 @@ void Preferences::accept()
|
||||
}
|
||||
}
|
||||
|
||||
// store number of threads
|
||||
// store number of threads, reset to 1 for "None" and "Opt" settings
|
||||
QLineEdit *field = tabWidget->findChild<QLineEdit *>("nthreads");
|
||||
if (field)
|
||||
if (field->hasAcceptableInput()) settings->setValue("nthreads", field->text());
|
||||
if (field) {
|
||||
int accel = settings->value("accelerator", AcceleratorTab::None).toInt();
|
||||
if ((accel == AcceleratorTab::None) || (accel == AcceleratorTab::Opt))
|
||||
settings->setValue("nthreads", 1);
|
||||
else if (field->hasAcceptableInput())
|
||||
settings->setValue("nthreads", field->text());
|
||||
}
|
||||
|
||||
// store image width, height, zoom, and rendering settings
|
||||
|
||||
|
||||
Reference in New Issue
Block a user