enforce that the number of threads is properly reset for /omp styles
This commit is contained in:
@ -1329,9 +1329,9 @@ void LammpsGui::preferences()
|
||||
// must delete LAMMPS instance after preferences have changed that require
|
||||
// using different command line flags when creating the LAMMPS instance like
|
||||
// suffixes or package commands
|
||||
int newthreads = settings.value("nthreads", 1).toInt();
|
||||
if ((oldaccel != settings.value("accelerator", AcceleratorTab::None).toInt()) ||
|
||||
(oldthreads != settings.value("nthreads", 1).toInt()) ||
|
||||
(oldecho != settings.value("echo", false).toBool()) ||
|
||||
(oldthreads != newthreads) || (oldecho != settings.value("echo", false).toBool()) ||
|
||||
(oldcite != settings.value("cite", false).toBool())) {
|
||||
if (lammps.is_running()) {
|
||||
stop_run();
|
||||
@ -1340,6 +1340,10 @@ void LammpsGui::preferences()
|
||||
}
|
||||
lammps.close();
|
||||
lammpsstatus->hide();
|
||||
#if defined(_OPENMP)
|
||||
qputenv("OMP_NUM_THREADS", std::to_string(newthreads).c_str());
|
||||
omp_set_num_threads(newthreads);
|
||||
#endif
|
||||
}
|
||||
if (imagewindow) imagewindow->createImage();
|
||||
settings.beginGroup("reformat");
|
||||
|
||||
Reference in New Issue
Block a user