diff --git a/src/.gitignore b/src/.gitignore index 8d99776096..bd0e952bbf 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -25,6 +25,7 @@ /kokkos.h /kokkos_type.h /kokkos_few.h +/kokkos_base.h /manifold*.cpp /manifold*.h diff --git a/src/KOKKOS/Install.sh b/src/KOKKOS/Install.sh index f86ef990d5..a5ee300e70 100644 --- a/src/KOKKOS/Install.sh +++ b/src/KOKKOS/Install.sh @@ -124,8 +124,9 @@ action improper_harmonic_kokkos.cpp improper_harmonic.cpp action improper_harmonic_kokkos.h improper_harmonic.h action kokkos.cpp action kokkos.h -action kokkos_type.h +action kokkos_base.h action kokkos_few.h +action kokkos_type.h action memory_kokkos.h action modify_kokkos.cpp action modify_kokkos.h diff --git a/src/KOKKOS/comm_kokkos.cpp b/src/KOKKOS/comm_kokkos.cpp index 7bb416df93..53c6a163af 100644 --- a/src/KOKKOS/comm_kokkos.cpp +++ b/src/KOKKOS/comm_kokkos.cpp @@ -28,6 +28,7 @@ #include "dump.h" #include "output.h" #include "modify.h" +#include "kokkos_base.h" using namespace LAMMPS_NS; @@ -379,6 +380,7 @@ void CommKokkos::forward_comm_pair_device(Pair *pair) MPI_Request request; int nsize = pair->comm_forward; + KokkosBase* pairKKBase = (KokkosBase*) pair; for (iswap = 0; iswap < nswap; iswap++) { int n = MAX(max_buf_pair,nsize*sendnum[iswap]); @@ -391,7 +393,7 @@ void CommKokkos::forward_comm_pair_device(Pair *pair) // pack buffer - n = pair->pack_forward_comm_kokkos(sendnum[iswap],k_sendlist, + n = pairKKBase->pack_forward_comm_kokkos(sendnum[iswap],k_sendlist, iswap,k_buf_send_pair,pbc_flag[iswap],pbc[iswap]); // exchange with another proc @@ -408,7 +410,7 @@ void CommKokkos::forward_comm_pair_device(Pair *pair) // unpack buffer - pair->unpack_forward_comm_kokkos(recvnum[iswap],firstrecv[iswap],k_buf_recv_pair); + pairKKBase->unpack_forward_comm_kokkos(recvnum[iswap],firstrecv[iswap],k_buf_recv_pair); } } diff --git a/src/KOKKOS/kokkos_base.h b/src/KOKKOS/kokkos_base.h new file mode 100644 index 0000000000..72cc57135e --- /dev/null +++ b/src/KOKKOS/kokkos_base.h @@ -0,0 +1,36 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef KOKKOS_BASE_H +#define KOKKOS_BASE_H + +#include "kokkos_type.h" + +namespace LAMMPS_NS { + +class KokkosBase { + public: + KokkosBase() {} + virtual int pack_forward_comm_kokkos(int, DAT::tdual_int_2d, + int, DAT::tdual_xfloat_1d &, + int, int *) {return 0;}; + virtual void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d &) {} +}; + +} + +#endif + +/* ERROR/WARNING messages: + +*/ diff --git a/src/KOKKOS/memory_kokkos.h b/src/KOKKOS/memory_kokkos.h index 2454b7c412..c063e1d624 100644 --- a/src/KOKKOS/memory_kokkos.h +++ b/src/KOKKOS/memory_kokkos.h @@ -14,15 +14,14 @@ #ifndef LMP_MEMORY_KOKKOS_H #define LMP_MEMORY_KOKKOS_H -#ifdef LMP_KOKKOS +#include "memory.h" #include "kokkos_type.h" -#endif namespace LAMMPS_NS { class MemoryKokkos : public Memory { public: - MemoryKokkos::MemoryKokkos(class LAMMPS *lmp) : Memory(lmp) {} + MemoryKokkos(class LAMMPS *lmp) : Memory(lmp) {} /* ---------------------------------------------------------------------- Kokkos versions of create/grow/destroy multi-dimensional arrays diff --git a/src/KOKKOS/neighbor_kokkos.cpp b/src/KOKKOS/neighbor_kokkos.cpp index cf1b318201..8d36add10b 100644 --- a/src/KOKKOS/neighbor_kokkos.cpp +++ b/src/KOKKOS/neighbor_kokkos.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "neighbor_kokkos.h" -#include "atom.h" +#include "atom_kokkos.h" #include "pair.h" #include "fix.h" #include "neigh_request.h" diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.h b/src/KOKKOS/pair_eam_alloy_kokkos.h index fb07eec32b..a962f55908 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.h +++ b/src/KOKKOS/pair_eam_alloy_kokkos.h @@ -24,6 +24,7 @@ PairStyle(eam/alloy/kk/host,PairEAMAlloyKokkos) #define LMP_PAIR_EAM_ALLOY_KOKKOS_H #include +#include "kokkos_base.h" #include "pair_kokkos.h" #include "pair_eam.h" #include "neigh_list_kokkos.h" @@ -49,7 +50,7 @@ struct TagPairEAMAlloyKernelC{}; // Cannot use virtual inheritance on the GPU template -class PairEAMAlloyKokkos : public PairEAM { +class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { public: enum {EnabledNeighFlags=FULL|HALFTHREAD|HALF}; enum {COUL_FLAG=0}; @@ -59,7 +60,7 @@ class PairEAMAlloyKokkos : public PairEAM { PairEAMAlloyKokkos(class LAMMPS *); virtual ~PairEAMAlloyKokkos(); - virtual void compute(int, int); + void compute(int, int); void init_style(); void *extract(const char *, int &) { return NULL; } void coeff(int, char **); @@ -107,11 +108,11 @@ class PairEAMAlloyKokkos : public PairEAM { const F_FLOAT &epair, const F_FLOAT &fpair, const F_FLOAT &delx, const F_FLOAT &dely, const F_FLOAT &delz) const; - virtual int pack_forward_comm_kokkos(int, DAT::tdual_int_2d, int, DAT::tdual_xfloat_1d&, - int, int *); - virtual void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d&); - virtual int pack_forward_comm(int, int *, double *, int, int *); - virtual void unpack_forward_comm(int, int, double *); + int pack_forward_comm_kokkos(int, DAT::tdual_int_2d, int, DAT::tdual_xfloat_1d&, + int, int *); + void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d&); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); int pack_reverse_comm(int, int, double *); void unpack_reverse_comm(int, int *, double *); @@ -148,7 +149,7 @@ class PairEAMAlloyKokkos : public PairEAM { t_ffloat_2d_n7_randomread d_rhor_spline; t_ffloat_2d_n7_randomread d_z2r_spline; - virtual void file2array(); + void file2array(); void file2array_alloy(); void array2spline(); void interpolate(int, double, double *, t_host_ffloat_2d_n7, int); diff --git a/src/KOKKOS/pair_eam_fs_kokkos.h b/src/KOKKOS/pair_eam_fs_kokkos.h index d71ec2b887..ec87e44ece 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.h +++ b/src/KOKKOS/pair_eam_fs_kokkos.h @@ -24,6 +24,7 @@ PairStyle(eam/fs/kk/host,PairEAMFSKokkos) #define LMP_PAIR_EAM_FS_KOKKOS_H #include +#include "kokkos_base.h" #include "pair_kokkos.h" #include "pair_eam.h" #include "neigh_list_kokkos.h" @@ -49,7 +50,7 @@ struct TagPairEAMFSKernelC{}; // Cannot use virtual inheritance on the GPU template -class PairEAMFSKokkos : public PairEAM { +class PairEAMFSKokkos : public PairEAM, public KokkosBase { public: enum {EnabledNeighFlags=FULL|HALFTHREAD|HALF}; enum {COUL_FLAG=0}; @@ -59,7 +60,7 @@ class PairEAMFSKokkos : public PairEAM { PairEAMFSKokkos(class LAMMPS *); virtual ~PairEAMFSKokkos(); - virtual void compute(int, int); + void compute(int, int); void init_style(); void *extract(const char *, int &) { return NULL; } void coeff(int, char **); @@ -107,11 +108,11 @@ class PairEAMFSKokkos : public PairEAM { const F_FLOAT &epair, const F_FLOAT &fpair, const F_FLOAT &delx, const F_FLOAT &dely, const F_FLOAT &delz) const; - virtual int pack_forward_comm_kokkos(int, DAT::tdual_int_2d, int, DAT::tdual_xfloat_1d&, - int, int *); - virtual void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d&); - virtual int pack_forward_comm(int, int *, double *, int, int *); - virtual void unpack_forward_comm(int, int, double *); + int pack_forward_comm_kokkos(int, DAT::tdual_int_2d, int, DAT::tdual_xfloat_1d&, + int, int *); + void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d&); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); int pack_reverse_comm(int, int, double *); void unpack_reverse_comm(int, int *, double *); @@ -148,7 +149,7 @@ class PairEAMFSKokkos : public PairEAM { t_ffloat_2d_n7_randomread d_rhor_spline; t_ffloat_2d_n7_randomread d_z2r_spline; - virtual void file2array(); + void file2array(); void file2array_fs(); void array2spline(); void interpolate(int, double, double *, t_host_ffloat_2d_n7, int); diff --git a/src/KOKKOS/pair_eam_kokkos.h b/src/KOKKOS/pair_eam_kokkos.h index 856cc51f77..34a4795ec5 100644 --- a/src/KOKKOS/pair_eam_kokkos.h +++ b/src/KOKKOS/pair_eam_kokkos.h @@ -24,6 +24,7 @@ PairStyle(eam/kk/host,PairEAMKokkos) #define LMP_PAIR_EAM_KOKKOS_H #include +#include "kokkos_base.h" #include "pair_kokkos.h" #include "pair_eam.h" #include "neigh_list_kokkos.h" @@ -47,7 +48,7 @@ template struct TagPairEAMKernelC{}; template -class PairEAMKokkos : public PairEAM { +class PairEAMKokkos : public PairEAM, public KokkosBase { public: enum {EnabledNeighFlags=FULL|HALFTHREAD|HALF}; enum {COUL_FLAG=0}; @@ -57,7 +58,7 @@ class PairEAMKokkos : public PairEAM { PairEAMKokkos(class LAMMPS *); virtual ~PairEAMKokkos(); - virtual void compute(int, int); + void compute(int, int); void init_style(); void *extract(const char *, int &) { return NULL; } @@ -104,11 +105,11 @@ class PairEAMKokkos : public PairEAM { const F_FLOAT &epair, const F_FLOAT &fpair, const F_FLOAT &delx, const F_FLOAT &dely, const F_FLOAT &delz) const; - virtual int pack_forward_comm_kokkos(int, DAT::tdual_int_2d, int, DAT::tdual_xfloat_1d&, - int, int *); - virtual void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d&); - virtual int pack_forward_comm(int, int *, double *, int, int *); - virtual void unpack_forward_comm(int, int, double *); + int pack_forward_comm_kokkos(int, DAT::tdual_int_2d, int, DAT::tdual_xfloat_1d&, + int, int *); + void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d&); + int pack_forward_comm(int, int *, double *, int, int *); + void unpack_forward_comm(int, int, double *); int pack_reverse_comm(int, int, double *); void unpack_reverse_comm(int, int *, double *); @@ -146,7 +147,7 @@ class PairEAMKokkos : public PairEAM { t_ffloat_2d_n7_randomread d_z2r_spline; void interpolate(int, double, double *, t_host_ffloat_2d_n7, int); - virtual void file2array(); + void file2array(); void array2spline(); typename AT::t_neighbors_2d d_neighbors; diff --git a/src/KOKKOS/pair_hybrid_kokkos.cpp b/src/KOKKOS/pair_hybrid_kokkos.cpp index 48bdf3081d..db757f6ce1 100644 --- a/src/KOKKOS/pair_hybrid_kokkos.cpp +++ b/src/KOKKOS/pair_hybrid_kokkos.cpp @@ -27,6 +27,7 @@ #include "error.h" #include "respa.h" #include "atom_masks.h" +#include "kokkos.h" using namespace LAMMPS_NS; diff --git a/src/KOKKOS/pair_reaxc_kokkos.cpp b/src/KOKKOS/pair_reaxc_kokkos.cpp index 1407c464e3..4fa75a1d51 100644 --- a/src/KOKKOS/pair_reaxc_kokkos.cpp +++ b/src/KOKKOS/pair_reaxc_kokkos.cpp @@ -38,6 +38,7 @@ #include "reaxc_defs.h" #include "reaxc_lookup.h" #include "reaxc_tool_box.h" +#include "modify.h" #define TEAMSIZE 128 diff --git a/src/accelerator_kokkos.h b/src/accelerator_kokkos.h index f7781c822d..708592a25e 100644 --- a/src/accelerator_kokkos.h +++ b/src/accelerator_kokkos.h @@ -91,9 +91,9 @@ class NeighborKokkos : public Neighbor { ~NeighborKokkos() {} }; -class MemoryKokkos : public MemoryBrick { +class MemoryKokkos : public Memory { public: - MemoryKokkos(class LAMMPS *lmp) : MemoryBrick(lmp) {} + MemoryKokkos(class LAMMPS *lmp) : Memory(lmp) {} ~MemoryKokkos() {} void grow_kokkos(tagint **, tagint **, int, int, const char*) {} }; diff --git a/src/compute_aggregate_atom.cpp b/src/compute_aggregate_atom.cpp index 1155ac437a..1e91327e54 100644 --- a/src/compute_aggregate_atom.cpp +++ b/src/compute_aggregate_atom.cpp @@ -16,6 +16,7 @@ ------------------------------------------------------------------------- */ #include +#include #include "compute_aggregate_atom.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/compute_orientorder_atom.cpp b/src/compute_orientorder_atom.cpp index 90e2830e39..b443d56bf8 100644 --- a/src/compute_orientorder_atom.cpp +++ b/src/compute_orientorder_atom.cpp @@ -18,6 +18,7 @@ #include #include +#include #include "compute_orientorder_atom.h" #include "atom.h" #include "update.h" diff --git a/src/compute_rdf.cpp b/src/compute_rdf.cpp index 167de4576d..bcb620f3b3 100644 --- a/src/compute_rdf.cpp +++ b/src/compute_rdf.cpp @@ -32,6 +32,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" +#include "comm.h" using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/pair.h b/src/pair.h index eb71e88224..cfb6576653 100644 --- a/src/pair.h +++ b/src/pair.h @@ -15,7 +15,6 @@ #define LMP_PAIR_H #include "pointers.h" -#include "accelerator_kokkos.h" namespace LAMMPS_NS { @@ -165,10 +164,6 @@ class Pair : protected Pointers { virtual int pack_forward_comm(int, int *, double *, int, int *) {return 0;} virtual void unpack_forward_comm(int, int, double *) {} - virtual int pack_forward_comm_kokkos(int, DAT::tdual_int_2d, - int, DAT::tdual_xfloat_1d &, - int, int *) {return 0;}; - virtual void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d &) {} virtual int pack_reverse_comm(int, int, double *) {return 0;} virtual void unpack_reverse_comm(int, int *, double *) {} virtual double memory_usage(); diff --git a/src/write_coeff.cpp b/src/write_coeff.cpp index d4d4f99bf3..0556d647cf 100644 --- a/src/write_coeff.cpp +++ b/src/write_coeff.cpp @@ -23,6 +23,7 @@ #include "force.h" #include "universe.h" #include "error.h" +#include "domain.h" using namespace LAMMPS_NS;