Commit 580f6b56 authored by Stan Moore's avatar Stan Moore
Browse files

Add neigh/qeq option to Kokkos

parent f871ecdc
Loading
Loading
Loading
Loading
+8 −17
Original line number Diff line number Diff line
@@ -62,12 +62,13 @@ args = arguments specific to the style :l
      {no_affinity} values = none
  {kokkos} args = keyword value ...
    zero or more keyword/value pairs may be appended
    keywords = {neigh} or {newton} or {binsize} or {comm} or {comm/exchange} or {comm/forward}
      {neigh} value = {full} or {half} or {n2} or {full/cluster}
    keywords = {neigh} or {neigh/qeq} or {newton} or {binsize} or {comm} or {comm/exchange} or {comm/forward}
      {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
        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}
        off = set Newton pairwise and bonded flags off (default)
        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
of {half} uses a thread-safe variant of half-neighbor lists,
the same as used by most pair styles in LAMMPS.  A value of
{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.
the same as used by most pair styles in LAMMPS.

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
@@ -403,15 +401,8 @@ 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}
is the default setting.  However, when running in MPI-only mode with 1
thread per MPI task, {half} neighbor lists will typically be faster,
just as it is for non-accelerated pair styles.

A value of {full/cluster} is an experimental neighbor style, where
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.
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.

The {newton} keyword sets the Newton flags for pairwise and bonded
interactions to {off} or {on}, the same as the "newton"_newton.html
+1 −1
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ void FixQEqReaxKokkos<DeviceType>::init()

  FixQEqReax::init();

  neighflag = lmp->kokkos->neighflag;
  neighflag = lmp->kokkos->neighflag_qeq;
  int irequest = neighbor->nrequest - 1;
  
  neighbor->requests[irequest]->
+17 −0
Original line number Diff line number Diff line
@@ -119,6 +119,8 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
  // default settings for package kokkos command

  neighflag = FULL;
  neighflag_qeq = FULL;
  neighflag_qeq_set = 0;
  exchange_comm_classic = 0;
  forward_comm_classic = 0;
  exchange_comm_on_host = 0;
@@ -152,6 +154,8 @@ void KokkosLMP::accelerator(int narg, char **arg)
  // defaults

  neighflag = FULL;
  neighflag_qeq = FULL;
  neighflag_qeq_set = 0;
  int newtonflag = 0;
  double binsize = 0.0;
  exchange_comm_classic = forward_comm_classic = 0;
@@ -169,6 +173,19 @@ void KokkosLMP::accelerator(int narg, char **arg)
          neighflag = HALF;
      } else if (strcmp(arg[iarg+1],"n2") == 0) neighflag = N2;
      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;
    } else if (strcmp(arg[iarg],"binsize") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal package kokkos command");
+2 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ class KokkosLMP : protected Pointers {
 public:
  int kokkos_exists;
  int neighflag;
  int neighflag_qeq;
  int neighflag_qeq_set;
  int exchange_comm_classic;
  int forward_comm_classic;
  int exchange_comm_on_host;