diff --git a/src/KOKKOS/Install.sh b/src/KOKKOS/Install.sh index af77bcd20666f06e1e574e55131c0846da851a5a..69620daa94edb47bdada0b872423429c6780aebc 100644 --- a/src/KOKKOS/Install.sh +++ b/src/KOKKOS/Install.sh @@ -77,6 +77,8 @@ action fix_nve_kokkos.cpp action fix_nve_kokkos.h action fix_nvt_kokkos.cpp action fix_nvt_kokkos.h +action fix_qeq_reax_kokkos.cpp fix_qeq_reax.cpp +action fix_qeq_reax_kokkos.h fix_qeq_reax.h action fix_setforce_kokkos.cpp action fix_setforce_kokkos.h action fix_wall_reflect_kokkos.cpp @@ -149,6 +151,8 @@ action pair_lj_gromacs_kokkos.cpp action pair_lj_gromacs_kokkos.h action pair_lj_sdk_kokkos.cpp pair_lj_sdk.cpp action pair_lj_sdk_kokkos.h pair_lj_sdk.h +action pair_reax_kokkos.cpp pair_reax.cpp +action pair_reax_kokkos.h pair_reax.h action pair_sw_kokkos.cpp pair_sw.cpp action pair_sw_kokkos.h pair_sw.h action pair_table_kokkos.cpp diff --git a/src/KOKKOS/kokkos.cpp b/src/KOKKOS/kokkos.cpp index 27400cd84a60ebe9fab2e41f87cfde9fc8c2b472..7b27ba3523fe8bbe45d4703161182dbd861b45f8 100644 --- a/src/KOKKOS/kokkos.cpp +++ b/src/KOKKOS/kokkos.cpp @@ -15,6 +15,8 @@ #include <string.h> #include <stdlib.h> #include <ctype.h> +#include <signal.h> +#include <unistd.h> #include "kokkos.h" #include "lammps.h" #include "force.h" @@ -119,6 +121,10 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) forward_comm_classic = 0; exchange_comm_on_host = 0; forward_comm_on_host = 0; + +#ifdef KILL_KOKKOS_ON_SIGSEGV + signal(SIGSEGV, my_signal_handler); +#endif } /* ---------------------------------------------------------------------- */ @@ -275,3 +281,9 @@ int KokkosLMP::neigh_count(int m) return nneigh; } +void KokkosLMP::my_signal_handler(int sig) +{ + if (sig == SIGSEGV) { + kill(getpid(),SIGABRT); + } +} \ No newline at end of file diff --git a/src/KOKKOS/kokkos.h b/src/KOKKOS/kokkos.h index c03d2ff43fe16a70450ce6ad3720ae7122efeb8e..f6d3404283a5582707eb44c799f94673bb5ef001 100644 --- a/src/KOKKOS/kokkos.h +++ b/src/KOKKOS/kokkos.h @@ -35,6 +35,8 @@ class KokkosLMP : protected Pointers { void accelerator(int, char **); int neigh_list_kokkos(int); int neigh_count(int); + private: + static void my_signal_handler(int); }; } diff --git a/src/KOKKOS/kokkos_type.h b/src/KOKKOS/kokkos_type.h index 6d8e8226348d13988216b49664ec39e8d6c628e3..dc52096d5a1914d0635dfc887e9d484149dc2183 100644 --- a/src/KOKKOS/kokkos_type.h +++ b/src/KOKKOS/kokkos_type.h @@ -209,6 +209,66 @@ struct s_EV_FLOAT { }; typedef struct s_EV_FLOAT EV_FLOAT; +struct s_EV_FLOAT_REAX { + E_FLOAT evdwl; + E_FLOAT ecoul; + E_FLOAT v[6]; + E_FLOAT ereax[10]; + KOKKOS_INLINE_FUNCTION + s_EV_FLOAT_REAX() { + evdwl = 0; + ecoul = 0; + v[0] = 0; v[1] = 0; v[2] = 0; + v[3] = 0; v[4] = 0; v[5] = 0; + ereax[0] = 0; ereax[1] = 0; ereax[2] = 0; + ereax[3] = 0; ereax[4] = 0; ereax[5] = 0; + ereax[6] = 0; ereax[7] = 0; ereax[8] = 0; + } + + KOKKOS_INLINE_FUNCTION + void operator+=(const s_EV_FLOAT_REAX &rhs) { + evdwl += rhs.evdwl; + ecoul += rhs.ecoul; + v[0] += rhs.v[0]; + v[1] += rhs.v[1]; + v[2] += rhs.v[2]; + v[3] += rhs.v[3]; + v[4] += rhs.v[4]; + v[5] += rhs.v[5]; + ereax[0] += rhs.ereax[0]; + ereax[1] += rhs.ereax[1]; + ereax[2] += rhs.ereax[2]; + ereax[3] += rhs.ereax[3]; + ereax[4] += rhs.ereax[4]; + ereax[5] += rhs.ereax[5]; + ereax[6] += rhs.ereax[6]; + ereax[7] += rhs.ereax[7]; + ereax[8] += rhs.ereax[8]; + } + + KOKKOS_INLINE_FUNCTION + void operator+=(const volatile s_EV_FLOAT_REAX &rhs) volatile { + evdwl += rhs.evdwl; + ecoul += rhs.ecoul; + v[0] += rhs.v[0]; + v[1] += rhs.v[1]; + v[2] += rhs.v[2]; + v[3] += rhs.v[3]; + v[4] += rhs.v[4]; + v[5] += rhs.v[5]; + ereax[0] += rhs.ereax[0]; + ereax[1] += rhs.ereax[1]; + ereax[2] += rhs.ereax[2]; + ereax[3] += rhs.ereax[3]; + ereax[4] += rhs.ereax[4]; + ereax[5] += rhs.ereax[5]; + ereax[6] += rhs.ereax[6]; + ereax[7] += rhs.ereax[7]; + ereax[8] += rhs.ereax[8]; + } +}; +typedef struct s_EV_FLOAT_REAX EV_FLOAT_REAX; + #ifndef PREC_POS #define PREC_POS PRECISION #endif