Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
weihuang-jedi committed Jul 29, 2022
1 parent cd108c2 commit 42abc53
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 18 deletions.
18 changes: 12 additions & 6 deletions main_timing.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ def __init__(self, debug=0, corelist=[], casename=None, output=0,

self.shortest_time = 0.1

if(not os.path.exists(casename)):
#mode
#mode = 0o722
#os.makedirs(casename, mode)
os.makedirs(casename)

if(workdir is None):
print('workdir not defined. Exit.')
sys.exit(-1)
Expand Down Expand Up @@ -193,7 +199,7 @@ def plot(self):
pmin = 1.0e20
pmax = 0.0

txtname = 'main_timing_%s.csv' %(self.casename)
txtname = '%s/timing_main.csv' %(self.casename)
OPF = open(txtname, 'w')
header = '%40s' %('Function Name')
for k in range(nl):
Expand Down Expand Up @@ -254,7 +260,7 @@ def plot(self):

#general title
#title = '%s Timing (in minutes), min: %8.2f, max: %8.2f' %(self.casename, pmin, pmax)
title = '%s Timing (in minutes)' %(self.casename)
title = 'main Timing of %s (in minutes)' %(self.casename)
#plt.suptitle(title, fontsize=13, fontweight=0, color='black', style='italic', y=1.02)
plt.suptitle(title, fontsize=16, fontweight=1, color='black')

Expand Down Expand Up @@ -287,9 +293,9 @@ def plot(self):
#(smaller value results in more space being made for the legend)

if(self.linear):
imgname = 'lin_%s_main_timing.png' %(self.casename)
imgname = '%s/lin_timing_main.png' %(self.casename)
else:
imgname = 'log_%s_main_timing.png' %(self.casename)
imgname = '%s/log_timing_main.png' %(self.casename)

if(self.output):
plt.savefig(imgname)
Expand Down Expand Up @@ -334,8 +340,8 @@ def plot(self):
pr.process()
for linear in [1, 0]:
pr.set_linear(linear=linear)
for output in [0, 1]:
#for output in [1]:
#for output in [0, 1]:
for output in [1]:
pr.set_output(output=output)
pr.plot()

24 changes: 14 additions & 10 deletions sum_timing.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,10 @@ def plot(self):
else:
#plt.xscale('log', base=2)
#plt.yscale('log', base=10)
plt.xscale('log', basex=2)
plt.yscale('log', basey=2)
plt.xscale('log', base=2)
plt.yscale('log', base=2)
#plt.xscale('log', basex=2)
#plt.yscale('log', basey=2)
plt.xticks(x, xlabels)
#plt.xticks(x, xlabels, rotation ='vertical')
plt.yticks(yp, ylabels)
Expand Down Expand Up @@ -380,8 +382,10 @@ def plot_obs(self, obsname):
else:
#plt.xscale('log', base=2)
#plt.yscale('log', base=10)
plt.xscale('log', basex=2)
plt.yscale('log', basey=2)
plt.xscale('log', base=2)
plt.yscale('log', base=2)
#plt.xscale('log', basex=2)
#plt.yscale('log', basey=2)
plt.xticks(x, xlabels)
#plt.xticks(x, xlabels, rotation ='vertical')
plt.yticks(yp, ylabels)
Expand Down Expand Up @@ -479,16 +483,16 @@ def plot_obs(self, obsname):
if __name__== '__main__':
debug = 1
casename = 'sondes'
#workdir = '/work2/noaa/gsienkf/weihuang/jedi/case_study'
workdir = '/scratch2/BMC/gsienkf/Wei.Huang/tools/vis_tools'
workdir = '/work2/noaa/gsienkf/weihuang/jedi/case_study'
#workdir = '/scratch2/BMC/gsienkf/Wei.Huang/tools/vis_tools'
corelist = [36, 78, 156, 312]
#corelist = [36, 72, 144, 288]
nodelist = [1, 2, 4, 8]
output = 0
linear = 1

opts, args = getopt.getopt(sys.argv[1:], '', ['debug=', 'workdir=',
'corelist=', 'nodelist=', 'casename='])
'output=', 'corelist=', 'nodelist=', 'casename='])

for o, a in opts:
if o in ('--debug'):
Expand All @@ -502,7 +506,7 @@ def plot_obs(self, obsname):
elif o in ('--casename'):
casename = a
elif o in ('--output'):
output = a
output = int(a)
elif o in ('--linear'):
linear = int(a)
else:
Expand All @@ -513,8 +517,8 @@ def plot_obs(self, obsname):
pr.process()
for linear in [0, 1]:
pr.set_linear(linear=linear)
for output in [0, 1]:
#for output in [1]:
#for output in [0, 1]:
for output in [1]:
pr.set_output(output=output)
pr.plot()

5 changes: 3 additions & 2 deletions timingit
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

for i in ${!caselist[@]}
do
#python main_timing.py --casename=${caselist[$i]}
python obs_timing.py --casename=${caselist[$i]}
python main_timing.py --casename=${caselist[$i]}
#python obs_timing.py --casename=${caselist[$i]}
python sum_timing.py --casename=${caselist[$i]}
done

0 comments on commit 42abc53

Please sign in to comment.