14 test_command = sys.argv[2]
15 max_nb_procs = int(sys.argv[3])
19 while 2*nb_procs_lst[-1] <= max_nb_procs:
20 nb_procs_lst.append(2*nb_procs_lst[-1])
22 search_str =
'time" type="numeric/double">'
26 for nb_procs
in nb_procs_lst:
29 cmd.append(str(nb_procs))
30 cmd.append(test_command)
31 for extra_arg
in sys.argv[4:len(sys.argv)]:
39 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
46 raise RuntimeError(
"Test exited with error")
49 idx = line.find(search_str)
51 testname = line[0:idx].split(
'"')[-1].strip()
52 timing = float(line[idx+len(search_str):-1].split(
'<')[0])
53 if not testmap.has_key(testname):
54 testmap[testname] = []
55 testmap[testname].append(timing)
57 nb_procs_arr = np.array(nb_procs_lst)
58 for testname
in testmap:
59 timing_arr = np.array(testmap[testname])
60 pylab.plot(nb_procs_arr, timing_arr)
61 pylab.plot(nb_procs_arr, timing_arr,
'ko')
63 pylab.xlabel(
'Number of processes')
64 pylab.ylabel(
'Time (s)')
67 pylab.axis([0, max_nb_procs+1, 0,
max(timing_arr)*1.05])
69 fig_filename = testname +
'-timing.png'
70 pylab.savefig(fig_filename)
71 print '<DartMeasurementFile name="' + testname +
' scaling graph" type="image/png">' + os.path.join(os.path.dirname(test_command), fig_filename) +
'</DartMeasurementFile>'
Real max(const Real a, const Real b)
Maximum between two scalars.