diff --git a/src/KOKKOS/kokkos.cpp b/src/KOKKOS/kokkos.cpp index 7e637788ec..53cb1fa590 100644 --- a/src/KOKKOS/kokkos.cpp +++ b/src/KOKKOS/kokkos.cpp @@ -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)