1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 package ffx.potential.nonbonded.pme;
39
40 import static ffx.utilities.Constants.NS2SEC;
41 import static java.lang.String.format;
42 import static org.apache.commons.math3.util.FastMath.max;
43 import static org.apache.commons.math3.util.FastMath.min;
44
45 import java.util.logging.Logger;
46
47 public class PMETimings {
48
49 private static final Logger logger = Logger.getLogger(PMETimings.class.getName());
50
51 public final long[] realSpacePermTime;
52 public final long[] realSpaceEnergyTime;
53 public final long[] realSpaceSCFTime;
54
55 private final int numThreads;
56
57 public long realSpacePermTotal, realSpaceEnergyTotal, realSpaceSCFTotal;
58 public long bornRadiiTotal, gkEnergyTotal;
59
60 public PMETimings(int numThreads) {
61 this.numThreads = numThreads;
62 realSpacePermTime = new long[numThreads];
63 realSpaceEnergyTime = new long[numThreads];
64 realSpaceSCFTime = new long[numThreads];
65 }
66
67 public void init() {
68 for (int i = 0; i < numThreads; i++) {
69 realSpacePermTime[i] = 0;
70 realSpaceEnergyTime[i] = 0;
71 realSpaceSCFTime[i] = 0;
72 }
73 realSpacePermTotal = 0;
74 realSpaceEnergyTotal = 0;
75 realSpaceSCFTotal = 0;
76 bornRadiiTotal = 0;
77 gkEnergyTotal = 0;
78 }
79
80 public void printRealSpaceTimings(int maxThreads, RealSpaceEnergyRegion realSpaceEnergyRegion) {
81 double total = (realSpacePermTotal + realSpaceSCFTotal + realSpaceEnergyTotal) * NS2SEC;
82 logger.info(format("\n Real Space: %7.4f (sec)", total));
83 logger.info(" Electric Field");
84 logger.info(" Thread Direct SCF Energy Counts");
85 long minPerm = Long.MAX_VALUE;
86 long maxPerm = 0;
87 long minSCF = Long.MAX_VALUE;
88 long maxSCF = 0;
89 long minEnergy = Long.MAX_VALUE;
90 long maxEnergy = 0;
91 int minCount = Integer.MAX_VALUE;
92 int maxCount = Integer.MIN_VALUE;
93
94 for (int i = 0; i < maxThreads; i++) {
95 int count = realSpaceEnergyRegion.getCount(i);
96 logger.info(format(" %3d %7.4f %7.4f %7.4f %10d",
97 i, realSpacePermTime[i] * NS2SEC, realSpaceSCFTime[i] * NS2SEC,
98 realSpaceEnergyTime[i] * NS2SEC, count));
99 minPerm = min(realSpacePermTime[i], minPerm);
100 maxPerm = max(realSpacePermTime[i], maxPerm);
101 minSCF = min(realSpaceSCFTime[i], minSCF);
102 maxSCF = max(realSpaceSCFTime[i], maxSCF);
103 minEnergy = min(realSpaceEnergyTime[i], minEnergy);
104 maxEnergy = max(realSpaceEnergyTime[i], maxEnergy);
105 minCount = min(count, minCount);
106 maxCount = max(count, maxCount);
107 }
108 logger.info(format(" Min %7.4f %7.4f %7.4f %10d",
109 minPerm * NS2SEC, minSCF * NS2SEC, minEnergy * NS2SEC, minCount));
110 logger.info(format(" Max %7.4f %7.4f %7.4f %10d",
111 maxPerm * NS2SEC, maxSCF * NS2SEC, maxEnergy * NS2SEC, maxCount));
112 logger.info(format(" Delta %7.4f %7.4f %7.4f %10d",
113 (maxPerm - minPerm) * NS2SEC,
114 (maxSCF - minSCF) * NS2SEC,
115 (maxEnergy - minEnergy) * NS2SEC,
116 (maxCount - minCount)));
117 logger.info(format(" Actual %7.4f %7.4f %7.4f %10d",
118 realSpacePermTotal * NS2SEC,
119 realSpaceSCFTotal * NS2SEC,
120 realSpaceEnergyTotal * NS2SEC,
121 realSpaceEnergyRegion.getInteractions()));
122 }
123 }