1 /* ----------------------------------------------------------------------
2    SPARTA - Stochastic PArallel Rarefied-gas Time-accurate Analyzer
3    http://sparta.sandia.gov
4    Steve Plimpton, sjplimp@sandia.gov, Michael Gallis, magalli@sandia.gov
5    Sandia National Laboratories
6 
7    Copyright (2014) Sandia Corporation.  Under the terms of Contract
8    DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
9    certain rights in this software.  This software is distributed under
10    the GNU General Public License.
11 
12    See the README file in the top-level SPARTA directory.
13 ------------------------------------------------------------------------- */
14 
15 #ifdef COMPUTE_CLASS
16 
17 ComputeStyle(count/kk,ComputeCountKokkos)
18 
19 #else
20 
21 #ifndef SPARTA_COMPUTE_COUNT_KOKKOS_H
22 #define SPARTA_COMPUTE_COUNT_KOKKOS_H
23 
24 #include "compute_count.h"
25 #include "kokkos_base.h"
26 #include "kokkos_type.h"
27 
28 namespace SPARTA_NS {
29 
30 template<int NEED_ATOMICS>
31 struct TagComputeCount_per_species_tally_atomic{};
32 
33 class ComputeCountKokkos : public ComputeCount, public KokkosBase {
34  public:
35   ComputeCountKokkos(class SPARTA *, int, char **);
36   ~ComputeCountKokkos();
37 
38   void init();
39   double compute_scalar();
40   void compute_vector();
41 
42   template<int NEED_ATOMICS>
43   KOKKOS_INLINE_FUNCTION
44   void operator()(TagComputeCount_per_species_tally_atomic<NEED_ATOMICS>, const int&) const;
45 
46  private:
47 
48   DAT::tdual_int_1d k_count;
49   DAT::t_int_1d d_count;
50   int need_dup;
51   Kokkos::Experimental::ScatterView<int*, typename DAT::t_int_1d::array_layout,DeviceType,typename Kokkos::Experimental::ScatterSum,typename Kokkos::Experimental::ScatterDuplicated> dup_count;
52   Kokkos::Experimental::ScatterView<int*, typename DAT::t_int_1d::array_layout,DeviceType,typename Kokkos::Experimental::ScatterSum,typename Kokkos::Experimental::ScatterNonDuplicated> ndup_count;
53 
54   t_particle_1d d_particles;
55 
56   void per_species_tally_kokkos();
57 };
58 
59 
60 }
61 
62 #endif
63 #endif
64 
65 /* ERROR/WARNING messages:
66 
67 E: Illegal ... command
68 
69 Self-explanatory.  Check the input script syntax and compare to the
70 documentation for the command.  You can use -echo screen as a
71 command-line option when running SPARTA to see the offending line.
72 
73 */
74