allow -kokkos on g 0 without GPU support, report GPUs only if ngpu > 0

This commit is contained in:
Axel Kohlmeyer
2022-10-24 05:05:49 -04:00
parent 1e2ffe6cb7
commit b939ea55f6

View File

@ -121,11 +121,12 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
} else if (strcmp(arg[iarg],"g") == 0 ||
strcmp(arg[iarg],"gpus") == 0) {
#ifndef LMP_KOKKOS_GPU
error->all(FLERR,"GPUs are requested but Kokkos has not been compiled using a GPU-enabled backend");
#endif
if (iarg+2 > narg) error->all(FLERR,"Invalid Kokkos command-line args");
ngpus = utils::inumeric(FLERR, arg[iarg+1], false, lmp);
#ifndef LMP_KOKKOS_GPU
if (ngpus > 0)
error->all(FLERR,"GPUs are requested but Kokkos has not been compiled using a GPU-enabled backend");
#endif
int skip_gpu = 9999;
if (iarg+2 < narg && isdigit(arg[iarg+2][0])) {
@ -207,7 +208,8 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
init_ngpus = ngpus;
}
if (me == 0) utils::logmesg(lmp, " will use up to {} GPU(s) per node\n", ngpus);
if ((me == 0) && (ngpus > 0))
utils::logmesg(lmp, " will use up to {} GPU(s) per node\n", ngpus);
#ifdef LMP_KOKKOS_GPU
if (ngpus <= 0)