diff --git a/tools/lammps-gui/TODO.md b/tools/lammps-gui/TODO.md index bb8c469542..abb0292387 100644 --- a/tools/lammps-gui/TODO.md +++ b/tools/lammps-gui/TODO.md @@ -3,7 +3,6 @@ LAMMPS-GUI TODO list: # Short term goals - use qgetenv, qputenv for portability -- update enabled/disabled status for accelerators during startup and fall back to None if needed. - rewrite syntax highlighting to be line oriented instead of word oriented. handle first part of line based on regular expressions, then advance and only highlight strings and numbers. handle "&" continuation and multiline strings with """ like C style comments in Qt docs example diff --git a/tools/lammps-gui/lammpsgui.cpp b/tools/lammps-gui/lammpsgui.cpp index ce3843b5a8..33771819aa 100644 --- a/tools/lammps-gui/lammpsgui.cpp +++ b/tools/lammps-gui/lammpsgui.cpp @@ -87,6 +87,25 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) : // restorge and initialize settings QSettings settings; + // switch configured accelerator back to "none" if needed. + int accel = settings.value("accelerator", AcceleratorTab::None).toInt(); + if (accel == AcceleratorTab::Opt) { + if (!lammps.config_has_package("OPT")) + settings.setValue("accelerator", AcceleratorTab::None); + } else if (accel == AcceleratorTab::OpenMP) { + if (!lammps.config_has_package("OPENMP")) + settings.setValue("accelerator", AcceleratorTab::None); + } else if (accel == AcceleratorTab::Intel) { + if (!lammps.config_has_package("INTEL")) + settings.setValue("accelerator", AcceleratorTab::None); + } else if (accel == AcceleratorTab::Gpu) { + if (!lammps.config_has_package("GPU") || !lammps.has_gpu_device()) + settings.setValue("accelerator", AcceleratorTab::None); + } else if (accel == AcceleratorTab::Kokkos) { + if (!lammps.config_has_package("KOKKOS")) + settings.setValue("accelerator", AcceleratorTab::None); + } + // check and initialize nthreads setting. Default is to use max if there // is no preference but do not override OMP_NUM_THREADS #if defined(_OPENMP)