MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / CompareTo

Method CompareTo

python/timing.py:69–96  ·  view source on GitHub ↗

Compares the timing with the one saved in folder 'folder' with filename 'name.dat'.

(self,folder)

Source from the content-addressed store, hash-verified

67 pickle.dump(self,open(folder + "/" + self.name + ".dat","wb"))
68
69 def CompareTo(self,folder):
70 """
71Compares the timing with the one saved in folder 'folder' with filename
72'name.dat'.
73"""
74 try:
75 if folder[-1] == "/":
76 other = Timing(filename=folder + self.name + ".dat")
77 else:
78 other = Timing(filename=folder + "/" + self.name + ".dat")
79 except:
80 raise Exception("Other timing couldn't be loaded!")
81 result = []
82 dict_self = { key : value for key,value in self.timings }
83 dict_other = { key : value for key,value in other.timings }
84 for i, val in enumerate(self.timings):
85 try:
86 result.append((val[0], dict_self[val[0]]/dict_other[val[0]]))
87 except KeyError:
88 print("WARNING: No timing for '", val[0], "' in other file!")
89 dict_self_par = { key : value for key,value in self.timings_par }
90 dict_other_par = { key : value for key,value in other.timings_par }
91 for i,val in enumerate(self.timings_par):
92 try:
93 result.append((val[0]+" parallel", dict_self_par[val[0]]/dict_other_par[val[0]]))
94 except KeyError:
95 print("WARNING: No timing for '",val[0],"' with parallel in other file!")
96 return result
97
98 def CompareToBenchmark(self):
99 """ Compares the timing with the one stored as benchmark"""

Callers 1

CompareToBenchmarkMethod · 0.95

Calls 1

TimingClass · 0.70

Tested by

no test coverage detected