From e840d422efb937ab2bef3db0de971149a0bde4e5 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Tue, 3 Oct 2023 10:07:41 -0600 Subject: [PATCH 1/4] Use a_f to be consistent --- src/KOKKOS/pair_kokkos.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/KOKKOS/pair_kokkos.h b/src/KOKKOS/pair_kokkos.h index 2c2a622791..6f48aa0266 100644 --- a/src/KOKKOS/pair_kokkos.h +++ b/src/KOKKOS/pair_kokkos.h @@ -138,9 +138,9 @@ struct PairComputeFunctor { F_FLOAT fztmp = 0.0; if (NEIGHFLAG == FULL) { - f(i,0) = 0.0; - f(i,1) = 0.0; - f(i,2) = 0.0; + a_f(i,0) = 0.0; + a_f(i,1) = 0.0; + a_f(i,2) = 0.0; } for (int jj = 0; jj < jnum; jj++) { @@ -212,9 +212,9 @@ struct PairComputeFunctor { F_FLOAT fztmp = 0.0; if (NEIGHFLAG == FULL) { - f(i,0) = 0.0; - f(i,1) = 0.0; - f(i,2) = 0.0; + a_f(i,0) = 0.0; + a_f(i,1) = 0.0; + a_f(i,2) = 0.0; } for (int jj = 0; jj < jnum; jj++) { From 367d0ac90518d751af2d872e9cde355c7cef7f22 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Tue, 3 Oct 2023 10:07:52 -0600 Subject: [PATCH 2/4] Add support for FLUX --- src/KOKKOS/kokkos.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/KOKKOS/kokkos.cpp b/src/KOKKOS/kokkos.cpp index 91ea6d37ac..b611502f74 100644 --- a/src/KOKKOS/kokkos.cpp +++ b/src/KOKKOS/kokkos.cpp @@ -175,6 +175,14 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) set_flag = 1; } } + if ((str = getenv("FLUX_TASK_LOCAL_ID"))) { + if (ngpus > 0) { + int local_rank = atoi(str); + device = local_rank % ngpus; + if (device >= skip_gpu) device++; + set_flag = 1; + } + } if (ngpus > 1 && !set_flag) error->all(FLERR,"Could not determine local MPI rank for multiple " From ff23da1c9725695cbe8f5429a6f213b96208cead Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Tue, 3 Oct 2023 10:28:08 -0600 Subject: [PATCH 3/4] Switch order --- src/KOKKOS/kokkos.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/KOKKOS/kokkos.cpp b/src/KOKKOS/kokkos.cpp index b611502f74..84a8f59dd0 100644 --- a/src/KOKKOS/kokkos.cpp +++ b/src/KOKKOS/kokkos.cpp @@ -137,13 +137,13 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) int set_flag = 0; char *str; - if ((str = getenv("SLURM_LOCALID"))) { + if (str = getenv("SLURM_LOCALID")) { int local_rank = atoi(str); device = local_rank % ngpus; if (device >= skip_gpu) device++; set_flag = 1; } - if ((str = getenv("MPT_LRANK"))) { + if (str = getenv("FLUX_TASK_LOCAL_ID")) { if (ngpus > 0) { int local_rank = atoi(str); device = local_rank % ngpus; @@ -151,7 +151,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) set_flag = 1; } } - if ((str = getenv("MV2_COMM_WORLD_LOCAL_RANK"))) { + if (str = getenv("MPT_LRANK")) { if (ngpus > 0) { int local_rank = atoi(str); device = local_rank % ngpus; @@ -159,7 +159,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) set_flag = 1; } } - if ((str = getenv("OMPI_COMM_WORLD_LOCAL_RANK"))) { + if (str = getenv("MV2_COMM_WORLD_LOCAL_RANK")) { if (ngpus > 0) { int local_rank = atoi(str); device = local_rank % ngpus; @@ -167,7 +167,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) set_flag = 1; } } - if ((str = getenv("PMI_LOCAL_RANK"))) { + if (str = getenv("OMPI_COMM_WORLD_LOCAL_RANK")) { if (ngpus > 0) { int local_rank = atoi(str); device = local_rank % ngpus; @@ -175,7 +175,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) set_flag = 1; } } - if ((str = getenv("FLUX_TASK_LOCAL_ID"))) { + if (str = getenv("PMI_LOCAL_RANK")) { if (ngpus > 0) { int local_rank = atoi(str); device = local_rank % ngpus; From c521d54f85c2aaef9e937cabbc19e60bb8154452 Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Tue, 3 Oct 2023 10:58:22 -0600 Subject: [PATCH 4/4] Fix compile error --- src/KOKKOS/pair_kokkos.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/KOKKOS/pair_kokkos.h b/src/KOKKOS/pair_kokkos.h index 6f48aa0266..da6bd11006 100644 --- a/src/KOKKOS/pair_kokkos.h +++ b/src/KOKKOS/pair_kokkos.h @@ -138,9 +138,9 @@ struct PairComputeFunctor { F_FLOAT fztmp = 0.0; if (NEIGHFLAG == FULL) { - a_f(i,0) = 0.0; - a_f(i,1) = 0.0; - a_f(i,2) = 0.0; + a_f(i,0) -= f(i,0); + a_f(i,1) -= f(i,1); + a_f(i,2) -= f(i,2); } for (int jj = 0; jj < jnum; jj++) { @@ -212,9 +212,9 @@ struct PairComputeFunctor { F_FLOAT fztmp = 0.0; if (NEIGHFLAG == FULL) { - a_f(i,0) = 0.0; - a_f(i,1) = 0.0; - a_f(i,2) = 0.0; + a_f(i,0) -= f(i,0); + a_f(i,1) -= f(i,1); + a_f(i,2) -= f(i,2); } for (int jj = 0; jj < jnum; jj++) {