STORMM Source Documentation
Loading...
Searching...
No Matches
reduction_abstracts.h
1// -*-c++-*-
2#ifndef STORMM_REDUCTION_ABSTRACTS_H
3#define STORMM_REDUCTION_ABSTRACTS_H
4
5#include "copyright.h"
6#include "Accelerator/hybrid.h"
7#include "DataTypes/common_types.h"
8#include "Synthesis/atomgraph_synthesis.h"
9#include "Synthesis/phasespace_synthesis.h"
10#include "reduction_bridge.h"
11#include "reduction_enumerators.h"
12
13namespace stormm {
14namespace stmath {
15
16using card::HybridTargetLevel;
17using synthesis::AtomGraphSynthesis;
18using synthesis::PhaseSpaceSynthesis;
19using synthesis::PsSynthesisWriter;
20
25
33 ReductionKit(int nrdwu_in, RdwuPerSystem rps_in, const int* rdwu_abstracts_in,
34 const int* atom_counts_in);
35
36 ReductionKit(const AtomGraphSynthesis &poly_ag,
37 HybridTargetLevel tier = HybridTargetLevel::HOST);
39
42 ReductionKit(const ReductionKit &original) = default;
43 ReductionKit(ReductionKit &&original) = default;
45
46 const int nrdwu;
47 const RdwuPerSystem rps;
48 const int* rdwu_abstracts;
49 const int* atom_counts;
50};
51
55template <typename T> struct GenericRdSubstrate {
56
65 GenericRdSubstrate(const T* x_read_in, double* x_buffer_in, T* x_write_in,
66 const int scale_bits_in = 0);
67
68 GenericRdSubstrate(const T* x_read_in, const T* y_read_in, const T* z_read_in,
69 double* x_buffer_in, double* y_buffer_in, double* z_buffer_in, T* x_write_in,
70 T* y_write_in, T* z_write_in, const int scale_bits_in = 0);
71
72 GenericRdSubstrate(const T* x_read_in, const int* x_read_ovrf_in, double* x_buffer_in,
73 T* x_write_in, int* x_write_ovrf_in, const int scale_bits_in = 0);
74
75 GenericRdSubstrate(const T* x_read_in, const int* x_read_ovrf_in, const T* y_read_in,
76 const int* y_read_ovrf_in, const T* z_read_in, const int* z_read_ovrf_in,
77 double* x_buffer_in, double* y_buffer_in, double* z_buffer_in, T* x_write_in,
78 int* x_write_ovrf_in, T* y_write_in, int* y_write_ovrf_in, T* z_write_in,
79 int* z_write_ovrf_in, const int scale_bits_in = 0);
81
84 GenericRdSubstrate(const GenericRdSubstrate &original) = default;
85 GenericRdSubstrate(GenericRdSubstrate &&original) = default;
87
88 const int dim;
90 const int scale_bits;
91 const double fp_scaling;
92 const double inv_fp_scaling;
93 const T* x_read;
94 const T* y_read;
95 const T* z_read;
96 const int* x_read_ovrf;
98 const int* y_read_ovrf;
100 const int* z_read_ovrf;
102 double* x_buffer;
103 double* y_buffer;
104 double* z_buffer;
114};
115
122
137 HybridTargetLevel tier = HybridTargetLevel::HOST);
138
140 HybridTargetLevel tier = HybridTargetLevel::HOST);
142
146 const double inv_frc_scale;
147
148 // The data pointers often repurpose arrays in the PhaseSpaceSynthesis object.
149 llint* xfrc;
150 llint* yfrc;
151 llint* zfrc;
155 llint* xprv;
156 llint* yprv;
157 llint* zprv;
161 llint* x_cg_temp;
162 llint* y_cg_temp;
163 llint* z_cg_temp;
167 double* gg_buffer;
168 double* dgg_buffer;
169 double* msum_buffer;
170};
171
172} // namespace stmath
173} // namespace stormm
174
175#include "reduction_abstracts.tpp"
176
177#endif
Allocate space for reduction operations to store temporary accumulations, bridging the gap between ga...
Definition reduction_bridge.h:18
A collection of one or more AtomGraph objects, with similar components arranged in contiguous arrays ...
Definition atomgraph_synthesis.h:55
A fixed-precision representation of coordinates, velocities, and forces to manage a set of simulation...
Definition phasespace_synthesis.h:325
ReductionKit(int nrdwu_in, RdwuPerSystem rps_in, const int *rdwu_abstracts_in, const int *atom_counts_in)
The constructor takes a straight list of values for all member variables, or a combination of familia...
Definition reduction_abstracts.cpp:11
llint * x_cg_temp
Mixing components for the X-direction conjugate gradient vector.
Definition reduction_abstracts.h:161
llint * xprv
Prior forces acting on all particles in the Cartesian X direction.
Definition reduction_abstracts.h:155
llint * z_cg_temp
Mixing components for the Z-direction conjugate gradient vector.
Definition reduction_abstracts.h:163
llint * zprv
Prior forces acting on all particles in the Cartesian Z direction.
Definition reduction_abstracts.h:157
int * z_cg_temp_ovrf
Overflow for z_cg_temp when using extended precision models.
Definition reduction_abstracts.h:166
llint * yfrc
Forces acting on all particles in the Cartesian Y direction.
Definition reduction_abstracts.h:150
int * zfrc_ovrf
Overflow in Z forces, when using extended precision models.
Definition reduction_abstracts.h:154
ConjGradSubstrate(PsSynthesisWriter poly_psw, ReductionBridge *rbg, HybridTargetLevel tier=HybridTargetLevel::HOST)
The constructor takes a PhaseSpaceSynthesis object and a series of double-precision allocations.
Definition reduction_abstracts.cpp:25
int * xprv_ovrf
Prior overflow in X forces, when using extended precision models.
Definition reduction_abstracts.h:158
int * yprv_ovrf
Prior overflow in Y forces, when using extended precision models.
Definition reduction_abstracts.h:159
int * x_cg_temp_ovrf
Overflow for x_cg_temp when using extended precision models.
Definition reduction_abstracts.h:164
double * dgg_buffer
Gradient evolution partial sums.
Definition reduction_abstracts.h:168
const double inv_frc_scale
Definition reduction_abstracts.h:146
int * y_cg_temp_ovrf
Overflow for y_cg_temp when using extended precision models.
Definition reduction_abstracts.h:165
double * msum_buffer
Squared sums of remixed forces on all atoms.
Definition reduction_abstracts.h:169
llint * zfrc
Forces acting on all particles in the Cartesian Z direction.
Definition reduction_abstracts.h:151
int * zprv_ovrf
Prior overflow in Z forces, when using extended precision models.
Definition reduction_abstracts.h:160
llint * xfrc
Forces acting on all particles in the Cartesian X direction.
Definition reduction_abstracts.h:149
int * xfrc_ovrf
Overflow in X forces, when using extended precision models.
Definition reduction_abstracts.h:152
llint * yprv
Prior forces acting on all particles in the Cartesian Y direction.
Definition reduction_abstracts.h:156
int * yfrc_ovrf
Overflow in Y forces, when using extended precision models.
Definition reduction_abstracts.h:153
llint * y_cg_temp
Mixing components for the Y-direction conjugate gradient vector.
Definition reduction_abstracts.h:162
double * gg_buffer
Squared gradient partial sums.
Definition reduction_abstracts.h:167
const T * y_read
Read-only arrays of reducible data for the 2nd dimension.
Definition reduction_abstracts.h:94
T * x_write
Array accepting results of scattering in the 1st dimension.
Definition reduction_abstracts.h:105
GenericRdSubstrate(const GenericRdSubstrate &original)=default
Take the typical copy and move constructors for an abstract with const elements.
GenericRdSubstrate(const T *x_read_in, double *x_buffer_in, T *x_write_in, const int scale_bits_in=0)
The constructor can take up to three buffers, each with possible overflows to accommodate extended fi...
const double fp_scaling
Scaling factor for fixed-precision data.
Definition reduction_abstracts.h:91
double * y_buffer
Buffer for work unit sums along the 2nd dimension.
Definition reduction_abstracts.h:103
const int dim
Definition reduction_abstracts.h:88
const int * x_read_ovrf
Definition reduction_abstracts.h:96
const T * x_read
Read-only arrays of reducible data for the 1st dimension.
Definition reduction_abstracts.h:93
int * z_write_ovrf
Definition reduction_abstracts.h:112
const T * z_read
Read-only arrays of reducible data for the 3rd dimension.
Definition reduction_abstracts.h:95
const int scale_bits
The number of bits after the decimal in fixed-precision data.
Definition reduction_abstracts.h:90
int * y_write_ovrf
Definition reduction_abstracts.h:110
T * y_write
Array accepting results of scattering in the 2nd dimension.
Definition reduction_abstracts.h:106
double * z_buffer
Buffer for work unit sums along the 3rd dimension.
Definition reduction_abstracts.h:104
int * x_write_ovrf
Definition reduction_abstracts.h:108
double * x_buffer
Buffer for work unit sums along the 1st dimension.
Definition reduction_abstracts.h:102
const double inv_fp_scaling
Inverse of the scaling factor for fixed-precision data.
Definition reduction_abstracts.h:92
const int * z_read_ovrf
Definition reduction_abstracts.h:100
T * z_write
Array accepting results of scattering in the 3rd dimension.
Definition reduction_abstracts.h:107
const int * y_read_ovrf
Definition reduction_abstracts.h:98
const int * rdwu_abstracts
Reduction work unit abstracts (strides of rdwu_abstract_length)
Definition reduction_abstracts.h:48
const int * atom_counts
The number of atoms per system (for normalization purposes)
Definition reduction_abstracts.h:49
const RdwuPerSystem rps
Are there one or multiple work units serving each system?
Definition reduction_abstracts.h:47
ReductionKit(int nrdwu_in, RdwuPerSystem rps_in, const int *rdwu_abstracts_in, const int *atom_counts_in)
The constructor takes a straight list of values for all member variables, or a combination of familia...
Definition reduction_abstracts.cpp:11
const int nrdwu
The number of reduction work units in the synthesis.
Definition reduction_abstracts.h:46
ReductionKit(const ReductionKit &original)=default
Take the typical copy and move constructors for an abstract with constants.
The writer for a PhaseSpaceSynthesis object, containing all of the data relevant for propagating dyna...
Definition phasespace_synthesis.h:87