Adding signal handler to Kokkos package

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@14920 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
stamoor 2016-05-02 23:01:37 +00:00
parent fda492ea48
commit c5c293d16f
4 changed files with 78 additions and 0 deletions

View File

@ -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

View File

@ -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);
}
}

View File

@ -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);
};
}

View File

@ -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