STORMM Source Documentation
Loading...
Searching...
No Matches
tile_manager.h
1// -*-c++-*-
2#ifndef STORMM_TILE_MANAGER_H
3#define STORMM_TILE_MANAGER_H
4
5#include <vector>
6#include "copyright.h"
7#include "Accelerator/hybrid.h"
8#include "DataTypes/stormm_vector_types.h"
9
10namespace stormm {
11namespace energy {
12
13using card::Hybrid;
14using card::HybridTargetLevel;
15
20struct TilePlan {
21
24 TilePlan(int nchoice_in, const int* read_assign_in, const int* self_assign_in,
25 const int* reduce_prep_in, const int* self_prep_in, const float* scalings_in,
26 const int* nt_stencil_in, int* xfrc_ovrf_in, int* yfrc_ovrf_in, int* zfrc_ovrf_in);
27
33 TilePlan(const TilePlan &original) = default;
34 TilePlan(TilePlan &&original) = default;
36
37 const int nchoice;
52 const int* read_assign;
54 const int* self_assign;
57 const int* reduce_prep;
59 const int* self_prep;
67 const float* scalings;
69 const int* nt_stencil;
74 int* xfrc_ovrf;
76 int* yfrc_ovrf;
77 int* zfrc_ovrf;
78};
79
89public:
90
98 TileManager(const int2 launch_parameters, int max_deg_in = 0);
99
105 TileManager(const TileManager &original);
106 TileManager(TileManager &&original);
107 TileManager& operator=(const TileManager &original);
108 TileManager& operator=(TileManager &&original);
110
112 int getMaximumBatchDegeneracy() const;
113
118 std::vector<int> getSendingAtomLayout(const int sending_atom_degeneracy) const;
119
125 std::vector<int> getReadAssignments(int sending_atom_degeneracy,
126 int recving_atom_degeneracy) const;
127
131 std::vector<int> getSelfAssignments(int sending_atom_degeneracy,
132 int recving_atom_degeneracy) const;
133
137 std::vector<int> getReductionPreparations(int sending_atom_degeneracy,
138 int recving_atom_degeneracy) const;
139
143 std::vector<int> getSelfPreparations(int sending_atom_degeneracy,
144 int recving_atom_degeneracy) const;
145
149 std::vector<float> getThreadScalings(int atom_degeneracy) const;
150
152 std::vector<int> getNeutralTerritoryStencil() const;
153
157 TilePlan data(HybridTargetLevel tier = HybridTargetLevel::HOST);
158
159#ifdef STORMM_USE_HPC
161 void upload();
162
164 void download();
165#endif
166
167private:
168
169 int maximum_degeneracy;
171 int block_count;
173 int thread_count;
175 Hybrid<int> read_assignments;
180 Hybrid<int> self_assignments;
184 Hybrid<int> reduce_preparations;
188 Hybrid<int> self_preparations;
203 Hybrid<float> thread_scalings;
208 Hybrid<int> tower_plate_stencil;
218 Hybrid<int> x_force_overflow;
220 Hybrid<int> y_force_overflow;
221 Hybrid<int> z_force_overflow;
222 Hybrid<int> int_data;
224
226 void allocate();
227
229 void planTowerPlateStencil();
230
240 std::vector<int> computeStaggeredOrder(int natom, int sending_reps, int iter);
241};
242
243} // namespace energy
244} // namespace stormm
245
246#endif
An evolution of GpuBuffer in pmemd.cuda, the Composite array has elements that are accessible from ei...
Definition hybrid.h:202
int getMaximumBatchDegeneracy() const
Get the base-two logarithm of the maximum degeneracy in the batch atoms.
Definition tile_manager.cpp:286
std::vector< int > getSelfAssignments(int sending_atom_degeneracy, int recving_atom_degeneracy) const
Get the list of reading assignments (for inspection) pertaining to given degeneracies in the tiles of...
Definition tile_manager.cpp:319
std::vector< int > getReductionPreparations(int sending_atom_degeneracy, int recving_atom_degeneracy) const
Get the list of reduction preparations (for inspection) pertaining to given degeneracies in the sendi...
Definition tile_manager.cpp:328
std::vector< int > getSendingAtomLayout(const int sending_atom_degeneracy) const
Get the layout of sending atoms for a given degeneracy. This is for convenience in testing or prototy...
Definition tile_manager.cpp:291
TileManager(const int2 launch_parameters, int max_deg_in=0)
The constructor requires specifications of the GPU and can accept a value for the maximum degeneracy ...
Definition tile_manager.cpp:25
std::vector< float > getThreadScalings(int atom_degeneracy) const
Get the scaling factors to be applied to each thread's computed interaction in the first iteration to...
Definition tile_manager.cpp:346
std::vector< int > getNeutralTerritoryStencil() const
Get the map of the neutral territory decomposition, for inspection.
Definition tile_manager.cpp:352
std::vector< int > getSelfPreparations(int sending_atom_degeneracy, int recving_atom_degeneracy) const
Get the list of reduction preparations (for inspection) as above, but for tiles that might include se...
Definition tile_manager.cpp:337
std::vector< int > getReadAssignments(int sending_atom_degeneracy, int recving_atom_degeneracy) const
Get the list of reading assignments (for inspection) pertaining to given degeneracies in the sending ...
Definition tile_manager.cpp:310
TilePlan data(HybridTargetLevel tier=HybridTargetLevel::HOST)
Get the abstract.
Definition tile_manager.cpp:357
Definition stormm_vector_types.h:22
The abstract of the TileManager contains pointers to direct the relative indexing of atom reads and t...
Definition tile_manager.h:20
const int nchoice
Definition tile_manager.h:37
TilePlan(int nchoice_in, const int *read_assign_in, const int *self_assign_in, const int *reduce_prep_in, const int *self_prep_in, const float *scalings_in, const int *nt_stencil_in, int *xfrc_ovrf_in, int *yfrc_ovrf_in, int *zfrc_ovrf_in)
The constructor follows from other abstracts and takes a list of all pointers and critical constants.
Definition tile_manager.cpp:14
const int * self_prep
Definition tile_manager.h:59
const int * read_assign
Definition tile_manager.h:52
int * zfrc_ovrf
Overflow accumulators for receiving atom forces in the Z direction.
Definition tile_manager.h:77
TilePlan(const TilePlan &original)=default
The presence of const member variables negates copy and move assignment operations,...
int * xfrc_ovrf
Definition tile_manager.h:74
const int * reduce_prep
Definition tile_manager.h:57
const float * scalings
Definition tile_manager.h:67
const int * nt_stencil
Definition tile_manager.h:69
int * yfrc_ovrf
Overflow accumulators for receiving atom forces in the Y direction.
Definition tile_manager.h:76
const int * self_assign
Definition tile_manager.h:54