1 import matplotlib.pyplot
as plt
4 from fileinput
import filename
8 H = [ 0.5, 0.2, 0.1, 0.05, 0.02, 0.01, 0.005, 0.002, 0.001 ]
9 Flops = [ 1, 100, 10000, 1000000 ]
10 Color = [
"#ff0000",
"#00ff00",
"#0000ff",
"#a0a000",
"#a000a0",
"#00a0a0",
"#998899",
"#aa8888",
"#88aa88",
"#8888aa" ]
11 BenchmarkIterations = 20
16 if os.path.exists( filename ):
17 print(
"found " + filename +
" write " + filename +
".filter" )
18 input_file = open(filename,
"r")
19 output_file = open(filename,
"w")
21 if (
"start parallel traversals" in line)
or (
"local unrefined cells" in line)
or "terminated successfully" in line:
22 output_file.write( line )
26 return "shared-memory-" +
str(cores) +
"-cores-" +
str(d) +
"d-" +
str(h) +
"-" +
str(flops) +
"-flops.out"
30 return "distributed-memory-" +
str(nodes) +
"-nodes-" +
str(d) +
"d-" +
str(h) +
"-" +
str(flops) +
"-flops.out"
37 for cores
in range(1,64):
44 return a tuple of new entry plus max cells. First entry in tuple is 0.0 if no data found
46 file = open(filename,
"r")
51 if "start parallel traversals" in line:
52 start_time =
int( line.split(
" ")[0] )
53 if "local unrefined cells" in line:
54 max_cells =
float( line.split(
"=")[-1] )
55 if "terminated successfully" in line:
56 time =
int( line.split(
" ")[0] )
57 new_entry = (time - start_time)
58 return (new_entry,max_cells)
63 Divides each entry through max number of cells and iterations
65 return [i/BenchmarkIterations/max_cells
for i
in time_data]
72 min_serial_time = 65536.0
79 for cores
in range(1,64):
82 if os.path.exists( filename+
".filter" ):
85 elif os.path.exists( filename ):
89 print(
"found " + filename )
93 max_cells = max(cells,max_cells)
94 max_cores = max(cores,max_cores)
96 ydata.append(new_entry)
98 max_serial_time = max(max_serial_time, new_entry/max_cells)
99 min_serial_time =
min(min_serial_time, new_entry/max_cells)
105 xdata, ydata_calibrated,
106 label=
"h=" +
str(h) +
",#flops/cell=" +
str(flops),
107 color=Color[H.index(h)],
108 marker=Flops.index(flops)+4
117 xdata = range(1,max_cores)
119 xdata, [max_serial_time/i
for i
in xdata],
120 "--", color=
"#000000"
123 xdata, [min_serial_time/i
for i
in xdata],
124 "--", color=
"#000000"
128 plt.xlabel(
"cores" )
129 plt.ylabel(
"time/cell [t]=ms" )
130 plt.xscale(
"log", basex=2 )
131 plt.yscale(
"log", basey=2 )
133 xlabels = [
"serial" ]
134 while xtics[-1] < max_cores:
135 xtics.append( xtics[-1]*2 )
136 xlabels.append(
str(xtics[-1]) )
137 plt.xticks( xtics, xlabels )
138 plt.title(
"shared memory scaling " +
str(d) +
"d" )
139 plt.savefig(
"shared-memory-" +
str(d) +
"d.pdf" )
140 plt.savefig(
"shared-memory-" +
str(d) +
"d.png" )
143 if __name__ ==
"__main__":
145 print(
"Usage: python " + sys.argv[0] +
" [option] [target]")
147 print(
"With option from" )
148 print(
" filter filters out files, i.e. throws away all entries which are not required" )
149 print(
" create-plots generate plots" )
151 print(
"With option from" )
152 print(
" shared-memory process shared memory data" )
153 print(
" distributed-memory process distributed memory data" )
154 elif sys.argv[1]==
"create-plots" and sys.argv[2]==
"shared-memory":
156 elif sys.argv[1]==
"filter" and sys.argv[2]==
"shared-memory":
158 elif sys.argv[1]==
"create-plots" and sys.argv[2]==
"distributed-memory":
159 plot_distributed_memory()
160 elif sys.argv[1]==
"filter" and sys.argv[2]==
"distributed-memory":
161 filter_distributed_memory()
163 print(
"Invalid option. Run without arguments for usage message" )
static double min(double const x, double const y)
def parse_file(filename)
return a tuple of new entry plus max cells.
def normalise_raw_times(time_data, max_cells)
Divides each entry through max number of cells and iterations.
def filter_shared_memory()
def get_distributed_memory_file_name(nodes, d, h, flops)
def filter_file(filename)
def get_shared_memory_file_name(cores, d, h, flops)