QDP++
qdp_flopcount.h
Go to the documentation of this file.
1// -*- C++ -*-
7
8#ifndef QDP_FLOPCOUNT_H
9#define QDP_FLOPCOUNT_H
10
11namespace QDP
12{
13
14 //---------------------------------------------------------------------
25
28 public:
30 FlopCounter(void) : count(0), sitesOnNode((unsigned long long)Layout::sitesOnNode()) {}
31
34
36 FlopCounter(const FlopCounter& c) : count(c.count), sitesOnNode(c.sitesOnNode) {}
37
39 inline void reset(void) {
40 count = 0;
41 }
42
44 inline void addFlops(unsigned long long flops) {
45 count += flops;
46 }
47
49 inline void addSiteFlops(unsigned long long flops) {
50 count += (flops * sitesOnNode);
51 }
52
54 inline void addSiteFlops(unsigned long flops, const Subset& s) {
55 count += (flops * (unsigned long long)(s.numSiteTable()));
56 }
57
59 inline unsigned long long getFlops(void) const {
60 return count;
61 }
62
64 inline void report(const std::string& name,
65 const double& time_in_seconds) {
66
67 double mflops_per_cpu = (double)count/((double)(1000*1000)*time_in_seconds);
68 double mflops_overall = mflops_per_cpu;
69 QDPInternal::globalSum(mflops_overall);
70 double gflops_overall = mflops_overall/(double)(1000);
71 double tflops_overall = gflops_overall/(double)(1000);
72
73 QDPIO::cout <<"QDP:FlopCount:" << name << " Performance/CPU: t=" << time_in_seconds << "(s) Flops=" << (double)count << " => " << mflops_per_cpu << " Mflops/cpu." << std::endl;
74 QDPIO::cout << "QDP:FlopCount:" << name <<" Total performance: " << mflops_overall << " Mflops = " << gflops_overall << " Gflops = " << tflops_overall << " Tflops" << std::endl;
75 }
76
77 private:
78 unsigned long long count;
79 const unsigned long long sitesOnNode;
80 };
81 // end of group
83
84} // namespace QDP
85
86#endif
void reset(void)
Explicit zero method. Clears flopcounts.
void addSiteFlops(unsigned long flops, const Subset &s)
Method to add per site flop count for a subset of sites. Count is multiplied by the site table size o...
FlopCounter(void)
Constructor - zeroes flopcount.
FlopCounter(const FlopCounter &c)
Copy Constructor.
void addSiteFlops(unsigned long long flops)
Method to add per site flop count. Count is multiplied by sitesOnNode().
unsigned long long getFlops(void) const
Method to retrieve accumulated flopcount.
void report(const std::string &name, const double &time_in_seconds)
Report floppage.
~FlopCounter()
Destructor - kills object. No cleanup needed.
void addFlops(unsigned long long flops)
Method to add raw number of flops (eg from Level 3 operators).
Subsets - controls how lattices are looped.
Definition qdp_subset.h:39
int numSiteTable() const
Definition qdp_subset.h:84
Layout namespace holding info on problem size and machine info.
Definition qdp_layout.cc:16
StandardOutputStream cout
Definition qdp_stdio.cc:21
void globalSum(T &dest)
Sum across all nodes.
Yet another random number generator.