Skip to content

Commit

Permalink
avoid divide by 0 when timing file is bad
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Jun 7, 2019
1 parent f2247cb commit 773e629
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions scripts/lib/CIME/get_timing.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,15 @@ def _getTiming(self, inst=0):
self.write("\n")

self.write(" Overall Metrics: \n")
self.write(" Model Cost: {:10.2f} pe-hrs/simulated_year \n".format((tmax*365.0*pecost)/(3600.0*adays)))
self.write(" Model Throughput: {:10.2f} simulated_years/day \n".format((86400.0*adays)/(tmax*365.0)) )
if adays > 0:
self.write(" Model Cost: {:10.2f} pe-hrs/simulated_year \n".format((tmax*365.0*pecost)/(3600.0*adays)))
if tmax > 0:
self.write(" Model Throughput: {:10.2f} simulated_years/day \n".format((86400.0*adays)/(tmax*365.0)) )
self.write("\n")

self.write(" Init Time : {:10.3f} seconds \n".format(nmax))
self.write(" Run Time : {:10.3f} seconds {:10.3f} seconds/day \n".format(tmax, tmax/adays))
if adays > 0:
self.write(" Run Time : {:10.3f} seconds {:10.3f} seconds/day \n".format(tmax, tmax/adays))
self.write(" Final Time : {:10.3f} seconds \n".format(fmax))

self.write("\n")
Expand All @@ -337,11 +340,12 @@ def _getTiming(self, inst=0):
"with other components \n")
self.write("\n")

self.write(" TOT Run Time: {:10.3f} seconds {:10.3f} seconds/mday {:10.2f} myears/wday \n".format(tmax, tmax/adays, tmaxr))
for k in self.case.get_values("COMP_CLASSES"):
m = self.models[k]
self.write(" {} Run Time: {:10.3f} seconds {:10.3f} seconds/mday {:10.2f} myears/wday \n".format(k, m.tmax, m.tmax/adays, m.tmaxr))
self.write(" CPL COMM Time: {:10.3f} seconds {:10.3f} seconds/mday {:10.2f} myears/wday \n".format(xmax, xmax/adays, xmaxr))
if adays > 0:
self.write(" TOT Run Time: {:10.3f} seconds {:10.3f} seconds/mday {:10.2f} myears/wday \n".format(tmax, tmax/adays, tmaxr))
for k in self.case.get_values("COMP_CLASSES"):
m = self.models[k]
self.write(" {} Run Time: {:10.3f} seconds {:10.3f} seconds/mday {:10.2f} myears/wday \n".format(k, m.tmax, m.tmax/adays, m.tmaxr))
self.write(" CPL COMM Time: {:10.3f} seconds {:10.3f} seconds/mday {:10.2f} myears/wday \n".format(xmax, xmax/adays, xmaxr))

This comment has been minimized.

Copy link
@amametjanov

amametjanov Aug 7, 2019

Member

there's a typo here, line 348 needs to be outside of the loop to avoid multiple writes of identical string.


self.write("\n\n---------------- DRIVER TIMING FLOWCHART "
"--------------------- \n\n")
Expand Down

1 comment on commit 773e629

@jedwards4b
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amametjanov Please open an issue and point to the proper line in the current master, perhaps since it's a one-line change you could even offer a PR to fix the issue. Presenting issues this way is confusing to me.

Please sign in to comment.