STORMM Source Documentation
Loading...
Searching...
No Matches
cacheresource.h
1// -*-c++-*-
2#ifndef STORMM_CACHERESOURCE_H
3#define STORMM_CACHERESOURCE_H
4
5#include "copyright.h"
6#include "Accelerator/hybrid.h"
7#include "DataTypes/common_types.h"
8
9namespace stormm {
10namespace energy {
11
12using card::Hybrid;
13using card::HybridTargetLevel;
14
17template <typename T> struct CacheResourceKit {
18
22 CacheResourceKit(int max_blocks_in, int max_atoms_in, llint* xcrd_in, llint* ycrd_in,
23 llint* zcrd_in, llint* xvel_in, llint* yvel_in, llint* zvel_in,
24 int* xcrd_ovrf_in, int* ycrd_ovrf_in, int* zcrd_ovrf_in, int* xvel_ovrf_in,
25 int* yvel_ovrf_in, int* zvel_ovrf_in, int* xfrc_ovrf_in, int* yfrc_ovrf_in,
26 int* zfrc_ovrf_in, T* charges_in, int* lj_idx_in);
27
31 CacheResourceKit(const CacheResourceKit &original) = default;
32 CacheResourceKit(CacheResourceKit &&original) = default;
34
35 const int max_blocks;
36 const int max_atoms;
38 llint* xcrd;
39 llint* ycrd;
40 llint* zcrd;
41 llint* xvel;
42 llint* yvel;
43 llint* zvel;
44 int* xcrd_ovrf;
45 int* ycrd_ovrf;
46 int* zcrd_ovrf;
47 int* xvel_ovrf;
48 int* yvel_ovrf;
49 int* zvel_ovrf;
50 int* xfrc_ovrf;
51 int* yfrc_ovrf;
52 int* zfrc_ovrf;
55 int* lj_idx;
56};
57
64public:
65
79 CacheResource(int block_limit_in, int atom_limit_in);
80 CacheResource(int block_limit_in, int2 atom_limits_in);
82
87 CacheResource(const CacheResource &original);
88 CacheResource(CacheResource &&original);
90
98
101 CacheResourceKit<double> dpData(HybridTargetLevel tier = HybridTargetLevel::HOST);
102
105 CacheResourceKit<float> spData(HybridTargetLevel tier = HybridTargetLevel::HOST);
106
107private:
108 int block_limit;
110 int atom_limit;
113 Hybrid<llint> x_coordinates;
114 Hybrid<llint> y_coordinates;
115 Hybrid<llint> z_coordinates;
116 Hybrid<llint> x_velocities;
117 Hybrid<llint> y_velocities;
118 Hybrid<llint> z_velocities;
119 Hybrid<int> x_coordinate_overflow;
120 Hybrid<int> y_coordinate_overflow;
121 Hybrid<int> z_coordinate_overflow;
122 Hybrid<int> x_velocity_overflow;
123 Hybrid<int> y_velocity_overflow;
124 Hybrid<int> z_velocity_overflow;
125 Hybrid<int> x_force_overflow;
126 Hybrid<int> y_force_overflow;
127 Hybrid<int> z_force_overflow;
128 Hybrid<double> charges;
129 Hybrid<float> sp_charges;
131 Hybrid<int> lennard_jones_indices;
132 Hybrid<int> int_data;
134 Hybrid<llint> llint_data;
136
140 void repairPointers();
141};
142
143} // namespace energy
144} // namespace stormm
145
146#include "cacheresource.tpp"
147
148#endif
An evolution of GpuBuffer in pmemd.cuda, the Composite array has elements that are accessible from ei...
Definition hybrid.h:202
CacheResourceKit< float > spData(HybridTargetLevel tier=HybridTargetLevel::HOST)
Get a set of pointers to this object with single-precision representations for the charges.
Definition cacheresource.cpp:204
CacheResource & operator=(const CacheResource &other)
Basic copy and move assignment operators.
Definition cacheresource.cpp:121
CacheResourceKit< double > dpData(HybridTargetLevel tier=HybridTargetLevel::HOST)
Get a set of pointers to this object with double-precision representations for the charges.
Definition cacheresource.cpp:190
CacheResource(int block_limit_in, int atom_limit_in)
The constructor does not take a GPU description, but instead maximum numbers of blocks and atoms per ...
Definition cacheresource.cpp:13
Definition stormm_vector_types.h:22
Abstract for the CacheResource object, accessible as a C-style struct and suitable for passing to GPU...
Definition cacheresource.h:17
int * ycrd_ovrf
Cartesian Y coordinate overflow buffers.
Definition cacheresource.h:45
int * xfrc_ovrf
Cartesian X force overflow buffers.
Definition cacheresource.h:50
int * yvel_ovrf
Cartesian Y velocity overflow buffers.
Definition cacheresource.h:48
T * charges
Definition cacheresource.h:53
int * yfrc_ovrf
Cartesian Y force overflow buffers.
Definition cacheresource.h:51
llint * ycrd
Cartesian Y coordinates of locally cached particles.
Definition cacheresource.h:39
const int max_atoms
Definition cacheresource.h:36
int * zcrd_ovrf
Cartesian Z coordinate overflow buffers.
Definition cacheresource.h:46
llint * xvel
Cartesian X velocities of locally cached particles.
Definition cacheresource.h:41
llint * zcrd
Cartesian Z coordinates of locally cached particles.
Definition cacheresource.h:40
CacheResourceKit(const CacheResourceKit &original)=default
The usual copy and move constructors for an abstract with one or more const member variables apply.
llint * xcrd
Cartesian X coordinates of locally cached particles.
Definition cacheresource.h:38
llint * yvel
Cartesian Y velocities of locally cached particles.
Definition cacheresource.h:42
int * xvel_ovrf
Cartesian X velocity overflow buffers.
Definition cacheresource.h:47
int * zvel_ovrf
Cartesian Z velocity overflow buffers.
Definition cacheresource.h:49
const int max_blocks
Maximum number of blocks that resources are designed to accommodate.
Definition cacheresource.h:35
CacheResourceKit(int max_blocks_in, int max_atoms_in, llint *xcrd_in, llint *ycrd_in, llint *zcrd_in, llint *xvel_in, llint *yvel_in, llint *zvel_in, int *xcrd_ovrf_in, int *ycrd_ovrf_in, int *zcrd_ovrf_in, int *xvel_ovrf_in, int *yvel_ovrf_in, int *zvel_ovrf_in, int *xfrc_ovrf_in, int *yfrc_ovrf_in, int *zfrc_ovrf_in, T *charges_in, int *lj_idx_in)
The constructor for this abstract takes all of the usual pointer arguments to fill out its member var...
llint * zvel
Cartesian Z velocities of locally cached particles.
Definition cacheresource.h:43
int * xcrd_ovrf
Cartesian X coordinate overflow buffers.
Definition cacheresource.h:44
int * zfrc_ovrf
Cartesian Z force overflow buffers.
Definition cacheresource.h:52
int * lj_idx
Lennard-Jones indices of locally cached particles.
Definition cacheresource.h:55