Commit 31f2ca1e authored by Stan Moore's avatar Stan Moore
Browse files

Use multiple inheritance to remove accelerator_kokkos.h out of pair.h

parent 15a3364c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
/kokkos.h
/kokkos_type.h
/kokkos_few.h
/kokkos_base.h

/manifold*.cpp
/manifold*.h
+2 −1
Original line number Diff line number Diff line
@@ -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
+4 −2
Original line number Diff line number Diff line
@@ -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);
  }
}

+36 −0
Original line number Diff line number Diff line
/* ----------------------------------------------------------------------
   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:

*/
+2 −3
Original line number Diff line number Diff line
@@ -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
Loading