fall back to "none" accelerator, if one was selected, but is no longer available

This commit is contained in:
Axel Kohlmeyer
2023-08-07 22:53:49 -04:00
parent 407bcf30a0
commit 54c62c86a7
2 changed files with 19 additions and 1 deletions

View File

@ -3,7 +3,6 @@ LAMMPS-GUI TODO list:
# Short term goals # Short term goals
- use qgetenv, qputenv for portability - 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. - 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 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 handle "&" continuation and multiline strings with """ like C style comments in Qt docs example

View File

@ -87,6 +87,25 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
// restorge and initialize settings // restorge and initialize settings
QSettings 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 // 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)