STORMM Source Documentation
Loading...
Searching...
No Matches
reduction_workunit.h
1// -*-c++-*-
2#ifndef STORMM_REDUCTION_WORKUNIT_H
3#define STORMM_REDUCTION_WORKUNIT_H
4
5#include <cmath>
6#include <vector>
7#include "copyright.h"
8#include "Accelerator/hybrid.h"
9#include "Accelerator/gpu_details.h"
10#include "DataTypes/common_types.h"
11
12namespace stormm {
13namespace stmath {
14
15using card::GpuDetails;
16using card::Hybrid;
17
20constexpr int maximum_gathering_results = 1024;
21
24constexpr int rdwu_abstract_length = 8;
25
34public:
35
37 ReductionWorkUnit(int atom_start_in, int atom_end_in, int result_index_in,
38 int dependency_start_in, int dependency_end_in, int system_index_in);
39
42 ReductionWorkUnit(const ReductionWorkUnit &original) = default;
43 ReductionWorkUnit(ReductionWorkUnit &&original) = default;
44 ReductionWorkUnit& operator=(const ReductionWorkUnit &other) = default;
45 ReductionWorkUnit& operator=(ReductionWorkUnit &&other) = default;
47
49 int getAtomStart() const;
50
52 int getAtomEnd() const;
53
55 int getResultIndex() const;
56
60 int getDependencyStart() const;
61
64 int getDependencyEnd() const;
65
68 int getSystemIndex() const;
69
73 std::vector<int> getAbstract() const;
74
75private:
76 int atom_start;
78 int atom_end;
80 int result_index;
82 int dependency_start;
84 int dependency_end;
86 int system_index;
89};
90
104int optReductionKernelSubdivision(const int* atom_counts, int n_systems, const GpuDetails &gpu);
105int optReductionKernelSubdivision(const std::vector<int> &atom_counts, const GpuDetails &gpu);
106int optReductionKernelSubdivision(const Hybrid<int> &atom_counts, const GpuDetails &gpu);
108
125std::vector<ReductionWorkUnit> buildReductionWorkUnits(const std::vector<int> &atom_starts,
126 const std::vector<int> &atom_counts,
127 const GpuDetails &gpu,
128 int tasks_per_atom = 1);
129
130} // namespace stmath
131} // namespace stormm
132
133#endif
134
Pertinent aspects of one particular GPU. Condensing the data for each GPU in this manner helps to ens...
Definition gpu_details.h:27
An evolution of GpuBuffer in pmemd.cuda, the Composite array has elements that are accessible from ei...
Definition hybrid.h:202
ReductionWorkUnit(int atom_start_in, int atom_end_in, int result_index_in, int dependency_start_in, int dependency_end_in, int system_index_in)
The constructor takes arguments for all members.
Definition reduction_workunit.cpp:13
int getResultIndex() const
Get the index of whatever result array where this work unit will put its result.
Definition reduction_workunit.cpp:32
int getAtomStart() const
Get the atom starting index.
Definition reduction_workunit.cpp:22
int getDependencyEnd() const
Get the upper limit of dependencies in the result array which pertain to the same system as this redu...
Definition reduction_workunit.cpp:42
int getSystemIndex() const
Get the system to which this reduction work unit pertains (each reduction work unit will serve one an...
Definition reduction_workunit.cpp:47
std::vector< int > getAbstract() const
Produce an abstract containing all of the information, wrapped in a series of eight integers....
Definition reduction_workunit.cpp:52
ReductionWorkUnit(const ReductionWorkUnit &original)=default
Take all copy and move constructors and assignment operators.
int getDependencyStart() const
Get the start of dependencies in the result array which pertain to the same system as this reduction ...
Definition reduction_workunit.cpp:37
int getAtomEnd() const
Get the upper limit of atoms in this work unit.
Definition reduction_workunit.cpp:27