Commit 8756a101 authored by Steve Plimpton's avatar Steve Plimpton
Browse files

Kokkos updates by Stan

parent 9806da69
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -38,9 +38,17 @@ The pressure is computed by the formula
where N is the number of atoms in the system (see discussion of DOF
below), Kb is the Boltzmann constant, T is the temperature, d is the
dimensionality of the system (2 or 3 for 2d/3d), V is the system
volume (or area in 2d), and the second term is the virial, computed
within LAMMPS for all pairwise as well as 2-body, 3-body, and 4-body,
and long-range interactions.  "Fixes"_fix.html that impose constraints
volume (or area in 2d).
The second term is the virial, -dU/dV, computed within LAMMPS for all
pairwise as well as 2-body, 3-body, 4-body, many-body, and
long-range interactions, where r_i and f_i are the position and
force vector of atom i, and the big black dot indicates dot product.
When periodic boundary conditions are used, the summation includes
contributions from periodic images of the atoms in the central box,
which involves computing partial forces on local and ghost atoms.
A detailed description of how partial forces for 2-body and manybody
potentials are computed is provided in "(Thompson)"_#Thompson.
"Fixes"_fix.html that impose constraints
(e.g. the "fix shake"_fix_shake.html command) also contribute to the
virial term.

+1 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ fi

if (test $1 = "CLASS2") then
  depend GPU
  depend KOKKOS
  depend USER-OMP
fi

+12 −2
Original line number Diff line number Diff line
@@ -83,8 +83,13 @@ class AtomVecKokkos : public AtomVec {
                   std::is_same<typename ViewType::execution_space,LMPDeviceType>::value,
                   Kokkos::CudaHostPinnedSpace,typename ViewType::memory_space>::type,
                 Kokkos::MemoryTraits<Kokkos::Unmanaged> > mirror_type;
    if(buffer_size < src.capacity())
    if (buffer_size == 0) {
       buffer = Kokkos::kokkos_malloc<Kokkos::CudaHostPinnedSpace>(src.capacity());
       buffer_size = src.capacity();
    } else if (buffer_size < src.capacity()) {
       buffer = Kokkos::kokkos_realloc<Kokkos::CudaHostPinnedSpace>(buffer,src.capacity());
       buffer_size = src.capacity();
    }
    return mirror_type( buffer ,
                             src.dimension_0() ,
                             src.dimension_1() ,
@@ -104,8 +109,13 @@ class AtomVecKokkos : public AtomVec {
                   std::is_same<typename ViewType::execution_space,LMPDeviceType>::value,
                   Kokkos::CudaHostPinnedSpace,typename ViewType::memory_space>::type,
                 Kokkos::MemoryTraits<Kokkos::Unmanaged> > mirror_type;
    if(buffer_size < src.capacity())
    if (buffer_size == 0) {
       buffer = Kokkos::kokkos_malloc<Kokkos::CudaHostPinnedSpace>(src.capacity()*sizeof(typename ViewType::value_type));
       buffer_size = src.capacity();
    } else if (buffer_size < src.capacity()) {
       buffer = Kokkos::kokkos_realloc<Kokkos::CudaHostPinnedSpace>(buffer,src.capacity()*sizeof(typename ViewType::value_type));
       buffer_size = src.capacity();
    }
    mirror_type tmp_view( (typename ViewType::value_type*)buffer ,
                             src.dimension_0() ,
                             src.dimension_1() ,
+18 −1
Original line number Diff line number Diff line
@@ -21,6 +21,11 @@
#include "atom_masks.h"
#include "error.h"
#include "kokkos.h"
#include "force.h"
#include "bond.h"
#include "angle.h"
#include "dihedral.h"
#include "improper.h"

using namespace LAMMPS_NS;

@@ -601,6 +606,18 @@ void NeighborKokkos::build_topology_kokkos() {
    k_anglelist.modify<LMPDeviceType>();
    k_dihedrallist.modify<LMPDeviceType>();
    k_improperlist.modify<LMPDeviceType>();

    // Transfer topology neighbor lists to Host for non-Kokkos styles
 
    if (force->bond && force->bond->execution_space == Host)
      k_bondlist.sync<LMPHostType>();
    if (force->angle && force->angle->execution_space == Host)
      k_anglelist.sync<LMPHostType>();
    if (force->dihedral && force->dihedral->execution_space == Host)
      k_dihedrallist.sync<LMPHostType>();
    if (force->improper && force->improper->execution_space == Host)
      k_improperlist.sync<LMPHostType>();

   } else {
    neighbond_host.build_topology_kk();

+20 −20
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ void PairTersoffKokkos<DeviceType>::setup_params()
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++)
      for (k = 1; k <= n; k++) {
	m = elem2param[i-1][j-1][k-1];
        m = elem2param[map[i]][map[j]][map[k]];
        k_params.h_view(i,j,k).powerm = params[m].powerm;
        k_params.h_view(i,j,k).gamma = params[m].gamma;
        k_params.h_view(i,j,k).lam3 = params[m].lam3;
Loading