Merge pull request #415 from stanmoore1/kk_qeq

Add neigh/qeq option to Kokkos package
This commit is contained in:
sjplimp 2017-03-15 13:12:08 -06:00 committed by GitHub
commit b1c59126f7
4 changed files with 32 additions and 21 deletions

View File

@ -62,12 +62,13 @@ args = arguments specific to the style :l
{no_affinity} values = none {no_affinity} values = none
{kokkos} args = keyword value ... {kokkos} args = keyword value ...
zero or more keyword/value pairs may be appended zero or more keyword/value pairs may be appended
keywords = {neigh} or {newton} or {binsize} or {comm} or {comm/exchange} or {comm/forward} keywords = {neigh} or {neigh/qeq} or {newton} or {binsize} or {comm} or {comm/exchange} or {comm/forward}
{neigh} value = {full} or {half} or {n2} or {full/cluster} {neigh} value = {full} or {half}
full = full neighbor list
half = half neighbor list built in thread-safe manner
{neigh/qeq} value = {full} or {half}
full = full neighbor list full = full neighbor list
half = half neighbor list built in thread-safe manner half = half neighbor list built in thread-safe manner
n2 = non-binning neighbor list build, O(N^2) algorithm
full/cluster = full neighbor list with clustered groups of atoms
{newton} = {off} or {on} {newton} = {off} or {on}
off = set Newton pairwise and bonded flags off (default) off = set Newton pairwise and bonded flags off (default)
on = set Newton pairwise and bonded flags on on = set Newton pairwise and bonded flags on
@ -392,10 +393,7 @@ default value as listed below.
The {neigh} keyword determines how neighbor lists are built. A value The {neigh} keyword determines how neighbor lists are built. A value
of {half} uses a thread-safe variant of half-neighbor lists, of {half} uses a thread-safe variant of half-neighbor lists,
the same as used by most pair styles in LAMMPS. A value of the same as used by most pair styles in LAMMPS.
{n2} uses an O(N^2) algorithm to build the neighbor list without
binning, where N = # of atoms on a processor. It is typically slower
than the other methods, which use binning.
A value of {full} uses a full neighbor lists and is the default. This A value of {full} uses a full neighbor lists and is the default. This
performs twice as much computation as the {half} option, however that performs twice as much computation as the {half} option, however that
@ -403,15 +401,9 @@ is often a win because it is thread-safe and doesn't require atomic
operations in the calculation of pair forces. For that reason, {full} operations in the calculation of pair forces. For that reason, {full}
is the default setting. However, when running in MPI-only mode with 1 is the default setting. However, when running in MPI-only mode with 1
thread per MPI task, {half} neighbor lists will typically be faster, thread per MPI task, {half} neighbor lists will typically be faster,
just as it is for non-accelerated pair styles. just as it is for non-accelerated pair styles. Similarly, the {neigh/qeq}
keyword determines how neighbor lists are built for "fix qeq/reax/kk"_fix_qeq_reax.html.
A value of {full/cluster} is an experimental neighbor style, where If not explicitly set, the value of {neigh/qeq} will match {neigh}.
particles interact with all particles within a small cluster, if at
least one of the clusters particles is within the neighbor cutoff
range. This potentially allows for better vectorization on
architectures such as the Intel Phi. If also reduces the size of the
neighbor list by roughly a factor of the cluster size, thus reducing
the total memory footprint considerably.
The {newton} keyword sets the Newton flags for pairwise and bonded The {newton} keyword sets the Newton flags for pairwise and bonded
interactions to {off} or {on}, the same as the "newton"_newton.html interactions to {off} or {on}, the same as the "newton"_newton.html
@ -582,9 +574,9 @@ is used. If it is not used, you must invoke the package intel
command in your input script or or via the "-pk intel" "command-line command in your input script or or via the "-pk intel" "command-line
switch"_Section_start.html#start_7. switch"_Section_start.html#start_7.
For the KOKKOS package, the option defaults neigh = full, newton = For the KOKKOS package, the option defaults neigh = full, neigh/qeq
off, binsize = 0.0, and comm = device. These settings are made = full, newton = off, binsize = 0.0, and comm = device. These settings
automatically by the required "-k on" "command-line are made automatically by the required "-k on" "command-line
switch"_Section_start.html#start_7. You can change them bu using the switch"_Section_start.html#start_7. You can change them bu using the
package kokkos command in your input script or via the "-pk kokkos" package kokkos command in your input script or via the "-pk kokkos"
"command-line switch"_Section_start.html#start_7. "command-line switch"_Section_start.html#start_7.

View File

@ -82,7 +82,7 @@ void FixQEqReaxKokkos<DeviceType>::init()
FixQEqReax::init(); FixQEqReax::init();
neighflag = lmp->kokkos->neighflag; neighflag = lmp->kokkos->neighflag_qeq;
int irequest = neighbor->nrequest - 1; int irequest = neighbor->nrequest - 1;
neighbor->requests[irequest]-> neighbor->requests[irequest]->

View File

@ -119,6 +119,8 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
// default settings for package kokkos command // default settings for package kokkos command
neighflag = FULL; neighflag = FULL;
neighflag_qeq = FULL;
neighflag_qeq_set = 0;
exchange_comm_classic = 0; exchange_comm_classic = 0;
forward_comm_classic = 0; forward_comm_classic = 0;
exchange_comm_on_host = 0; exchange_comm_on_host = 0;
@ -152,6 +154,8 @@ void KokkosLMP::accelerator(int narg, char **arg)
// defaults // defaults
neighflag = FULL; neighflag = FULL;
neighflag_qeq = FULL;
neighflag_qeq_set = 0;
int newtonflag = 0; int newtonflag = 0;
double binsize = 0.0; double binsize = 0.0;
exchange_comm_classic = forward_comm_classic = 0; exchange_comm_classic = forward_comm_classic = 0;
@ -169,6 +173,19 @@ void KokkosLMP::accelerator(int narg, char **arg)
neighflag = HALF; neighflag = HALF;
} else if (strcmp(arg[iarg+1],"n2") == 0) neighflag = N2; } else if (strcmp(arg[iarg+1],"n2") == 0) neighflag = N2;
else error->all(FLERR,"Illegal package kokkos command"); else error->all(FLERR,"Illegal package kokkos command");
if (!neighflag_qeq_set) neighflag_qeq = neighflag;
iarg += 2;
} else if (strcmp(arg[iarg],"neigh/qeq") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal package kokkos command");
if (strcmp(arg[iarg+1],"full") == 0) neighflag_qeq = FULL;
else if (strcmp(arg[iarg+1],"half") == 0) {
if (num_threads > 1 || ngpu > 0)
neighflag_qeq = HALFTHREAD;
else
neighflag_qeq = HALF;
} else if (strcmp(arg[iarg+1],"n2") == 0) neighflag_qeq = N2;
else error->all(FLERR,"Illegal package kokkos command");
neighflag_qeq_set = 1;
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"binsize") == 0) { } else if (strcmp(arg[iarg],"binsize") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal package kokkos command"); if (iarg+2 > narg) error->all(FLERR,"Illegal package kokkos command");

View File

@ -23,6 +23,8 @@ class KokkosLMP : protected Pointers {
public: public:
int kokkos_exists; int kokkos_exists;
int neighflag; int neighflag;
int neighflag_qeq;
int neighflag_qeq_set;
int exchange_comm_classic; int exchange_comm_classic;
int forward_comm_classic; int forward_comm_classic;
int exchange_comm_on_host; int exchange_comm_on_host;