Commit d2cbfef1 authored by Stan Moore's avatar Stan Moore
Browse files

Add CUDA support to atom_vec_hybrid_kokkos

parent 4b4bc7dc
Loading
Loading
Loading
Loading
+32 −5
Original line number Diff line number Diff line
@@ -13,7 +13,6 @@

#include <stdlib.h>
#include <string.h>
#include "atom_vec_kokkos.h"
#include "atom_vec_hybrid_kokkos.h"
#include "atom_kokkos.h"
#include "domain.h"
@@ -21,6 +20,7 @@
#include "fix.h"
#include "memory.h"
#include "error.h"
#include "atom_masks.h"

using namespace LAMMPS_NS;

@@ -132,10 +132,6 @@ void AtomVecHybridKokkos::init()
{
  AtomVec::init();
  for (int k = 0; k < nstyles; k++) styles[k]->init();

#ifdef KOKKOS_HAVE_CUDA
  error->all(FLERR,"AtomVecHybridKokkos doesn't yet support CUDA");
#endif
}

/* ----------------------------------------------------------------------
@@ -303,6 +299,8 @@ int AtomVecHybridKokkos::unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf, int
int AtomVecHybridKokkos::pack_comm(int n, int *list, double *buf,
                             int pbc_flag, int *pbc)
{
  sync(Host,X_MASK);

  int i,j,k,m;
  double dx,dy,dz;

@@ -345,6 +343,8 @@ int AtomVecHybridKokkos::pack_comm(int n, int *list, double *buf,
int AtomVecHybridKokkos::pack_comm_vel(int n, int *list, double *buf,
                                 int pbc_flag, int *pbc)
{
  sync(Host,X_MASK|V_MASK|OMEGA_MASK/*|ANGMOM_MASK*/);

  int i,j,k,m;
  double dx,dy,dz,dvx,dvy,dvz;
  int omega_flag = atom->omega_flag;
@@ -455,6 +455,8 @@ void AtomVecHybridKokkos::unpack_comm(int n, int first, double *buf)
    h_x(i,2) = buf[m++];
  }

  modified(Host,X_MASK);

  // unpack sub-style contributions as contiguous chunks

  for (k = 0; k < nstyles; k++)
@@ -490,6 +492,8 @@ void AtomVecHybridKokkos::unpack_comm_vel(int n, int first, double *buf)
    }
  }

  modified(Host,X_MASK|V_MASK|OMEGA_MASK/*|ANGMOM_MASK*/);

  // unpack sub-style contributions as contiguous chunks

  for (k = 0; k < nstyles; k++)
@@ -500,6 +504,8 @@ void AtomVecHybridKokkos::unpack_comm_vel(int n, int first, double *buf)

int AtomVecHybridKokkos::pack_reverse(int n, int first, double *buf)
{
  sync(Host,F_MASK);

  int i,k,m,last;

  m = 0;
@@ -532,6 +538,8 @@ void AtomVecHybridKokkos::unpack_reverse(int n, int *list, double *buf)
    h_f(j,2) += buf[m++];
  }

  modified(Host,F_MASK);

  // unpack sub-style contributions as contiguous chunks

  for (k = 0; k < nstyles; k++)
@@ -543,6 +551,8 @@ void AtomVecHybridKokkos::unpack_reverse(int n, int *list, double *buf)
int AtomVecHybridKokkos::pack_border(int n, int *list, double *buf,
                               int pbc_flag, int *pbc)
{
  sync(Host,X_MASK|TAG_MASK|TYPE_MASK|MASK_MASK);

  int i,j,k,m;
  double dx,dy,dz;

@@ -595,6 +605,7 @@ int AtomVecHybridKokkos::pack_border(int n, int *list, double *buf,
int AtomVecHybridKokkos::pack_border_vel(int n, int *list, double *buf,
                                   int pbc_flag, int *pbc)
{
  sync(Host,X_MASK|TAG_MASK|TYPE_MASK|MASK_MASK|V_MASK|OMEGA_MASK/*|ANGMOM_MASK*/);
  int i,j,k,m;
  double dx,dy,dz,dvx,dvy,dvz;
  int omega_flag = atom->omega_flag;
@@ -722,6 +733,8 @@ void AtomVecHybridKokkos::unpack_border(int n, int first, double *buf)
    h_mask[i] = (int) ubuf(buf[m++]).i;
  }

  modified(Host,X_MASK|TAG_MASK|TYPE_MASK|MASK_MASK);

  // unpack sub-style contributions as contiguous chunks

  for (k = 0; k < nstyles; k++)
@@ -766,6 +779,8 @@ void AtomVecHybridKokkos::unpack_border_vel(int n, int first, double *buf)
    }
  }

  modified(Host,X_MASK|TAG_MASK|TYPE_MASK|MASK_MASK|V_MASK|OMEGA_MASK/*|ANGMOM_MASK*/);

  // unpack sub-style contributions as contiguous chunks

  for (k = 0; k < nstyles; k++)
@@ -946,6 +961,8 @@ void AtomVecHybridKokkos::create_atom(int itype, double *coord)

void AtomVecHybridKokkos::data_atom(double *coord, imageint imagetmp, char **values)
{
  sync(Host,X_MASK|TAG_MASK|TYPE_MASK|IMAGE_MASK|MASK_MASK|V_MASK|OMEGA_MASK/*|ANGMOM_MASK*/);

  int nlocal = atom->nlocal;
  if (nlocal == nmax) grow(0);

@@ -975,6 +992,8 @@ void AtomVecHybridKokkos::data_atom(double *coord, imageint imagetmp, char **val
    h_angmom(nlocal,2) = 0.0;
  }

  modified(Host,X_MASK|TAG_MASK|TYPE_MASK|IMAGE_MASK|MASK_MASK|V_MASK|OMEGA_MASK/*|ANGMOM_MASK*/);

  // each sub-style parses sub-style specific values

  int m = 5;
@@ -990,10 +1009,14 @@ void AtomVecHybridKokkos::data_atom(double *coord, imageint imagetmp, char **val

void AtomVecHybridKokkos::data_vel(int m, char **values)
{
  sync(Host,V_MASK);

  h_v(m,0) = atof(values[0]);
  h_v(m,1) = atof(values[1]);
  h_v(m,2) = atof(values[2]);

  modified(Host,V_MASK);

  // each sub-style parses sub-style specific values

  int n = 3;
@@ -1007,6 +1030,8 @@ void AtomVecHybridKokkos::data_vel(int m, char **values)

void AtomVecHybridKokkos::pack_data(double **buf)
{
  sync(Host,TAG_MASK|TYPE_MASK|X_MASK);

  int k,m;

  int nlocal = atom->nlocal;
@@ -1056,6 +1081,8 @@ void AtomVecHybridKokkos::write_data(FILE *fp, int n, double **buf)

void AtomVecHybridKokkos::pack_vel(double **buf)
{
  sync(Host,V_MASK);

  int k,m;

  int nlocal = atom->nlocal;
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ AtomStyle(hybrid/kk,AtomVecHybridKokkos)
#define LMP_ATOM_VEC_HYBRID_KOKKOS_H

#include <stdio.h>
#include "atom_vec.h"
#include "atom_vec_kokkos.h"
#include "kokkos_type.h"

namespace LAMMPS_NS {