43#include "CellProcessor.h"
50#include "molecules/MoleculeForwardDeclaration.h"
70 FlopCounter(
double cutoffRadius,
double LJcutoffRadius);
107 double getTotalFlopCount()
const {
108 return _totalFlopCount;
111 double getTotalMoleculeDistanceFlopCount()
const {
112 return _currentCounts.getMoleculeDistanceFlops();
115 void resetCounters() {
116 _currentCounts.clear();
118 _totalFlopCount = 0.;
122 double getMyFlopCount()
const {
126 void printStats()
const;
129 template<
class ForcePolicy,
bool CalculateMacroscopic>
131 template<
class ForcePolicy,
bool CalculateMacroscopic>
135 bool addMacro =
true);
138 enum PotentialIndices {
149 class _PotentialCounts {
151 void init(
const std::string& n,
int kM,
int mM,
int sFTM,
int sMM) {
154 _kernelMultiplier = kM;
155 _macroMultiplier = mM;
156 _sumForceTorqueMultiplier = sFTM;
157 _sumMacroMultiplier = sMM;
160 _numKernelCalls = 0.0;
161 _numMacroCalls = 0.0;
163 void addPotentialCounts(
const _PotentialCounts& pc) {
164 _numKernelCalls += pc._numKernelCalls;
165 _numMacroCalls += pc._numMacroCalls;
167 void addKernelAndMacro(
double valueBoth,
bool addMacro) {
168 _numKernelCalls += valueBoth;
170 _numMacroCalls += valueBoth;
172 void collCommAppend();
174 double getKernelAndMacroFlops()
const {
175 return _numKernelCalls * _kernelMultiplier + _numMacroCalls * _macroMultiplier;
177 double getForceTorqueSums()
const {
178 return _numKernelCalls * _sumForceTorqueMultiplier;
180 double getMacroValueSums()
const {
181 return _numMacroCalls * _sumMacroMultiplier;
184 std::ostringstream ostr;
186 if (_numKernelCalls == 0) {
return ostr.str(); }
189 <<
": kernel calls: " << _numKernelCalls
190 <<
" macro calls: " << _numMacroCalls
196 double _numKernelCalls;
197 double _numMacroCalls;
200 int _kernelMultiplier;
201 int _macroMultiplier;
202 int _sumForceTorqueMultiplier;
203 int _sumMacroMultiplier;
213 _moleculeDistances = 0;
215 for (
int i = 0; i < NUM_POTENTIALS; ++i) {
216 _potCounts[i].clear();
219 void addCounts(
const _Counts& c) {
220 _moleculeDistances += c._moleculeDistances;
222 for (
int i = 0; i < NUM_POTENTIALS; ++i) {
223 _potCounts[i].addPotentialCounts(c._potCounts[i]);
227 double sumKernelCalls()
const {
229 for (
int i = 0; i < NUM_POTENTIALS; ++i) {
230 ret += _potCounts[i]._numKernelCalls;
234 double sumMacros()
const {
236 for (
int i = 0; i < NUM_POTENTIALS; ++i) {
237 ret += _potCounts[i]._numMacroCalls;
243 double getMoleculeDistanceFlops()
const {
244 return _moleculeDistances * _distanceMultiplier;
246 double getCenterDistanceFlops()
const {
247 return sumKernelCalls() * _distanceMultiplier;
249 double getForceTorqueSumFlops()
const {
251 for (
int i = 0; i < NUM_POTENTIALS; ++i) {
252 ret += _potCounts[i].getForceTorqueSums();
256 double getMacroValueSumFlops()
const {
258 for (
int i = 0; i < NUM_POTENTIALS; ++i) {
259 ret += _potCounts[i].getMacroValueSums();
263 double getTotalFlops()
const {
264 double ret = getMoleculeDistanceFlops() + getCenterDistanceFlops();
265 for (
int i = 0; i < NUM_POTENTIALS; ++i) {
266 ret += _potCounts[i].getKernelAndMacroFlops();
268 ret += getForceTorqueSumFlops() + getMacroValueSumFlops();
271 void addKernelAndMacro(PotentialIndices i,
double valueBoth,
bool addMacro) {
272 _potCounts[i].addKernelAndMacro(valueBoth, addMacro);
274 void initPotCounter(PotentialIndices i,
const std::string& n,
int kM,
int mM,
int sFTM,
int sMM) {
275 _potCounts[i].init(n, kM, mM, sFTM, sMM);
279 double _moleculeDistances;
280 int _distanceMultiplier;
282 _PotentialCounts _potCounts[NUM_POTENTIALS];
285 std::vector<_Counts *> _threadData;
287 _Counts _currentCounts;
289 double _totalFlopCount;
Structure of Arrays for single-center lennard-Jones molecules for the RMM run.
Definition: CellDataSoARMM.h:16
Structure of Arrays for vectorized force calculation.
Definition: CellDataSoA.h:22
Definition: CellProcessor.h:29
Definition: FlopCounter.h:60
~FlopCounter()
Definition: FlopCounter.cpp:143
void initTraversal()
Initializes the internal counters.
Definition: FlopCounter.cpp:154
void processCell(ParticleCell &cell)
Count flops for this cell.
Definition: FlopCounter.cpp:207
FlopCounter(double cutoffRadius, double LJcutoffRadius)
Set up the counter.
Definition: FlopCounter.cpp:124
void endTraversal()
Print results.
Definition: FlopCounter.cpp:163
void processCellPair(ParticleCell &c1, ParticleCell &c2, bool sumAll=false)
Definition: FlopCounter.cpp:227
void preprocessCell(ParticleCell &cell)
Only pass through to child.
Definition: FlopCounter.h:85
void postprocessCell(ParticleCell &cell)
Only pass through to child.
Definition: FlopCounter.h:100
FullMolecule modeled as LJ sphere with point polarities.
Definition: FullMolecule.h:18
FullParticleCell data structure. Renamed from ParticleCell.
Definition: FullParticleCell.h:49
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
Definition: vtk-punstructured.h:270