def main(): # handle CLI options ccbench.controller() #handle default/cli args app app_bin = BASE_DIR + APP input_filename = BASE_DIR + DEFAULT_INPUT_NAME report_filename = REPORT_DIR + DEFAULT_REPORT_NAME # 1. Parse inputs.txt file. if (not ccbench.NORUN): inputs = ccbench.parseInputFile(input_filename, variables, ccbench.INPUT_TYPE) inputs["NumDataPointsPerSet"] = [] inputs["NumDataPointsPerSet"].append(str(len(inputs["AppStride"]))) # Build up the arguments list for each invocation of the benchmark. # This is done here, instead of in ccbench.py, because this is custom to each app. app_args_list = [] for app_size in inputs["AppSize"]: for app_stride in inputs["AppStride"]: app_args_list.append(str(inputs["NumThreads"][0]) + " " + str(app_size) \ + " " + str(app_stride) + " " + str(inputs["NumIterations"][0]) + " ") # 2. Execute the benchmark and write to the report file. if (not ccbench.NORUN): ccbench.runBenchmark(app_bin, app_args_list, inputs, input_variables, report_filename) # 3. Extract Data from the report file. data = ccbench.readReportFile(report_filename, variables) # 4. Plot the Data #print data if NOPLOT: return fig = plt.figure(figsize=(10,5.5)) p1 = fig.add_subplot(1,1,1) print "Plotting time..." num_datapoints = int(data["NumDataPointsPerSet"][0]) # let's convert "appsizearg(#elm)" to "appsize(KB)" for i in range(len(data["AppSize"])): data["AppSize"][i] = str(float(data["AppSize"][i]) * 4 / 1024) # convert stride from Word to Bytes for i in range(len(data["AppStride"])): data["AppStride"][i] = str(float(data["AppStride"][i]) * 4) for i in range(len(data["AppSize"])/num_datapoints): srt_idx = i*num_datapoints end_idx = (i+1)*num_datapoints p1.plot( data["AppStride"][srt_idx:end_idx], data["Time"][srt_idx:end_idx], linestyle='--', marker='.' ) p1.set_xscale('log') plt.ylabel(data["TimeUnits"][0]) plt.xlabel('Stride Size') xmin,ymax=plt.xlim() plt.xlim((xmin, 16384*4)) font = {#'family' : 'normal', # #'weight' : 'bold', 'size' : 12} matplotlib.rc('font', **font) # deal with ticks xtick_range = [4, 16, 64, 256, 1024, 4096, 16386 , 65544, 262176, 1048704, 4194816, 16779264, 67117056] # in Bytes xtick_names = ['4B','16B','64B','256B','1KB','4KB','16KB', '64KB', '256KB', '1MB', '4MB', '16MB', '64MB'] ytick_range = [1,2,4,8,16,32]#,64] #,128,256] # in ns / iteration ytick_names = ['1','2','4','8','16','32']#,'64'] #,'128','256'] p1.xaxis.set_major_locator( plt.NullLocator() ) p1.xaxis.set_minor_locator( plt.NullLocator() ) plt.xticks( xtick_range, xtick_names, rotation='-30', size='small' ) # p1.yaxis.set_major_locator( plt.NullLocator() ) # p1.yaxis.set_minor_locator( plt.NullLocator() ) # plt.yticks(ytick_range,ytick_names) fig.subplots_adjust(top=0.95, bottom=0.12, left=0.06, right=0.90,wspace=0, hspace=0) # legend print "Adding Legend..." colors =('b','g','r','c','m','y','k') legend_sz = len(data["AppSize"])/num_datapoints lines = [] for i in reversed(range(legend_sz)): lines.append(plt.Line2D([0,10], [0,10], linewidth=3, color=colors[i % len(colors)])) args = range(legend_sz) for i in range(legend_sz): args[legend_sz-i-1] = data["AppSize"][(i*num_datapoints)] font = FontProperties(size='small'); plt.legend(lines, args, 'upper right', title="Array \n Size (KB)", prop=font, bbox_to_anchor=(1.12, 0.95) ) # customize figure title and other doodads based on the processor the test was run on if (ccbench.PROCESSOR == "merom"): plt.title("Intel Core 2 Duo T7600 (Merom)" + r'', fontstyle='italic') if (ccbench.PROCESSOR == "tegra2"): plt.title("Tegra 2 (ARM Cortex-A9)" + r'', fontstyle='italic') elif (ccbench.PROCESSOR == "tilera"): plt.title("TilePro64 (Default malloc behavior)" + r'', fontstyle='italic') elif (ccbench.PROCESSOR == "tilera-l3"): plt.title("TilePro64 (using 'Hash-for-Home')" + r'', fontstyle='italic') else: plt.title("Cache Hierarchy" + r'', fontstyle='italic') #plt.title("Intel Core i7 640M (Arrandale)" + r'', fontstyle='italic') #plt.title("Intel Core i7 975 Extreme Edition" + r'', fontstyle='italic') if (ccbench.PLOT_FILENAME == "none"): filename = APP + "_" + ccbench.PROCESSOR else: filename = ccbench.PLOT_FILENAME plt.savefig(PLOT_DIR + filename) print "Finished Plotting, saved as file '" + PLOT_DIR + filename + ".pdf'"
def main(): ccbench.controller() # handle CLI options #handle default/cli args app app_bin = BASE_DIR + APP input_filename = BASE_DIR + DEFAULT_INPUT_NAME report_filename = REPORT_DIR + ccbench.getReportFileName(APP, REPORT_DIR) # 1. Parse inputs.txt file if (not ccbench.NORUN): inputs = ccbench.parseInputFile(input_filename, input_variables, ccbench.INPUT_TYPE) NumDataPointsPerSet = 0 # Build up the arguments list for each invocation of the benchmark. # This is done here, instead of in ccbench.py, because this is custom to each app. app_args_list = [] for num_threads in inputs["NumThreads"]: for num_requests in inputs["NumRequests"]: for app_size in inputs["AppSize"]: NumDataPointsPerSet += num_threads #each thread spawns a new entry in band_req_mc! app_args_list.append(str(num_threads) + " " + str(num_requests) + " " + str(app_size) \ + " " + str(inputs["NumIterations"][0])) inputs["NumDataPointsPerSet"] = [] inputs["NumDataPointsPerSet"].append(str(NumDataPointsPerSet)) # 2. Execute the benchmark and read the report file if (not ccbench.NORUN): ccbench.runBenchmark(app_bin, app_args_list, inputs, input_variables, report_filename) # 3. Extract Data data = ccbench.readReportFile(report_filename, variables) inputs = ccbench.parseReportFileForInputs(report_filename, input_variables) # 4. Plot the Data #print data if NOPLOT: return fig = plt.figure(figsize=(9, 5.5)) p2 = fig.add_subplot(1, 2, 2) p1 = fig.add_subplot(1, 2, 1) print "Plotting time..." num_datapoints = int(data["NumDataPointsPerSet"][0]) # let's convert "appsizearg(#elm)" to "appsize(KB)" for i in range(len(data["AppSize"])): data["AppSize"][i] = str(float(data["AppSize"][i]) * 4 / 1024) # deal with ticks # xtick_range = [1,2,4,8,16,32,64,128,256,512,1024,2048,4096,4096*2,16384] #for KB # xtick_names = ['1 kB','2 kB','4 kB','8 kB','16 kB','32 kB','64 kB','128 kB','256 kB','512 kB','1 MB','2 MB','4 MB','8 MB','16 MB'] #for KB xtick_range = [1, 4, 16, 64, 256, 1024, 4096, 16384] #for KB xtick_names = [ '1 kB', '4 kB', '16 kB', '64 kB', '256 kB', '1 MB', '4 MB', '16 MB' ] xmin, xmax = plt.xlim() print "xmax = %d" % (xmax) # if (xmax >= 1024*32): # xtick_range = [1,2,4,8,16,32,64, 128,256, 512,1024,2048,4096,4096*2, 16384,16384*2,16384*4,1024*128] # xtick_names = ['1 kB','2 kB','4 kB','8 kB','16 kB','32 kB','64 kB','128 kB','256 kB','512 kB','1 MB','2 MB','4 MB','8 MB','16 MB','32 MB','64 MB','128 MB'] #for KB xtick_range = [1, 4, 16, 64, 256, 1024, 4096, 16384, 1024 * 64] #for KB xtick_names = [ '1 kB', '4 kB', '16 kB', '64 kB', '256 kB', '1 MB', '4 MB', '16 MB', '64 MB' ] plt.xlim((0.5, 1024 * 128)) # fig.subplots_adjust(top=0.95, bottom=0.12, left=0.07, right=0.90,wspace=0, hspace=0) fig.subplots_adjust(top=0.95, bottom=0.12, left=0.07, right=0.90, wspace=0.13, hspace=0) c_counter = 0 colors = ('b', 'g', 'r', 'c', 'm', 'y', 'k', 'b', 'g', 'r', 'c', 'm') line_styles = ('-.', ':', '-.', ':') for num_threads in inputs["NumThreads"]: #x_array = [int(s) for s in array ] # print "NumThreads, graphing NumThreads: " + str(num_threads) l_counter = 0 color = colors[c_counter % len(colors)] c_counter += 1 # plot a line for each tid in th eexperiment NumThreads for num_req in inputs["NumRequests"]: line_style = line_styles[l_counter % len(line_styles)] l_counter += 1 for tid in range(num_threads): x_array = [] band_array = [] aggr_array = [] for idx in range(len(data["AppSize"])): # print " looking at idx: " + str(idx) + " in data[apsize]" if (int(data["ThreadID"][idx]) == int(tid)) and (int( data["NumThreads"][idx]) == num_threads) and (int( data["NumRequests"][idx]) == num_req): # print " appending " + data["AppSize"][idx] + " For ThreadID: " + data["ThreadID"][idx] x_array.append(data["AppSize"][idx]) aggr_array.append(data["AggregateBandwidth"][idx]) band_array.append(data["Bandwidth"][idx]) p1.plot( x_array, band_array, # linestyle="--", linestyle=line_style, # linestyle=" ", marker='.', color=color) p2.plot( x_array, aggr_array, # linestyle="--", linestyle=line_style, # linestyle=" ", marker='.', color=color) p1.set_xscale('log') p2.set_xscale('log') plt.ylabel(data["BandwidthUnits"][0]) plt.xlabel('Per Thread Working Set') ymin, ymax = plt.ylim() plt.ylim((0.0, ymax)) plt.xlim((0.5, 16384)) p1.xaxis.set_major_locator(plt.NullLocator()) p1.xaxis.set_minor_locator(plt.NullLocator()) p2.xaxis.set_major_locator(plt.NullLocator()) p2.xaxis.set_minor_locator(plt.NullLocator()) plt.xticks(xtick_range, xtick_names, rotation='-30', size='small') p2 = fig.add_subplot(1, 2, 2) plt.xticks(xtick_range, xtick_names, rotation='-30', size='small') # resize the per thread bandwidth...(to match aggregate bandwidth) #p2 = fig.add_subplot(1,2,2) #(ylow,yhigh) = plt.ylim() #p1 = fig.add_subplot(1,2,1) #plt.ylim((ylow,yhigh)) # plot processor-specific info p1 = fig.add_subplot(1, 2, 1) (ylow, yhigh) = plt.ylim() yhigh = 0.95 * yhigh ylow = 0.95 * yhigh ccprocstats.plotCacheSizeLines(plt, p1, ccbench.PROCESSOR, ylow, yhigh) p2 = fig.add_subplot(1, 2, 2) plt.xlabel('Per Thread Working Set') (ylow, yhigh) = plt.ylim() yhigh = 0.95 * yhigh ylow = 0.95 * yhigh ccprocstats.plotCacheSizeLines(plt, p2, ccbench.PROCESSOR, ylow, yhigh) p2 = fig.add_subplot(1, 2, 2) plt.title("Aggregate Bandwidth" + r'', fontstyle='italic') p1 = fig.add_subplot(1, 2, 1) plt.title("Per Thread Bandwidth" + r'', fontstyle='italic') # legend colors = ('b', 'g', 'r', 'c', 'm', 'y', 'k', 'b', 'g', 'r', 'c', 'm') legend_sz = len(inputs["NumThreads"]) lines = [] for i in (range(legend_sz)): lines.append( plt.Line2D([0, 10], [0, 10], linewidth=3, color=colors[legend_sz - 1 - i], linestyle='-')) args = range(legend_sz) for i in (range(legend_sz)): args[legend_sz - 1 - i] = str(inputs["NumThreads"][i]) + " Threads" # args[legend_sz - 1 - i] = "{Thds:" + str(inputs["NumThreads"][i]) + "}" #+ ", Reqs:" + input["NumRequests"][((i)*num_datapoints)] + "}" p2 = fig.add_subplot(1, 2, 2) plt.legend(lines, args, 'best', title="Num of Threads", bbox_to_anchor=(0.70, 0.9)) (ylow, yhigh) = plt.ylim() (xmin, xmax) = plt.xlim() p2.text(xmax, 0.9 * yhigh, "%d requests / thread" % (inputs["NumRequests"][0]), horizontalalignment='center', verticalalignment='center', size='x-small') if (ccbench.PLOT_FILENAME == "none"): filename = PLOT_DIR + ccbench.generatePlotFileName(APP) else: # Pull out the filename path from the full path. # This allows us to pull out the requested filename from the path presented # (since we always write reports to the report directory, etc.). However, it # allows the user to use tab-completion to specify the exact reportfile he # wants to use. filename = PLOT_DIR + os.path.basename(ccbench.PLOT_FILENAME) filename = os.path.splitext(filename)[0] plt.savefig(filename) print "Used report filename : " + report_filename print "Finished Plotting, saved as file : " + filename + ".pdf"
def main(): # handle CLI options ccbench.controller() #handle default/cli args app app_bin = BASE_DIR + APP input_filename = BASE_DIR + DEFAULT_INPUT_NAME report_filename = REPORT_DIR + ccbench.getReportFileName(APP, REPORT_DIR) # 1. Parse inputs.txt file. if (not ccbench.NORUN): inputs = ccbench.parseInputFile(input_filename, variables, ccbench.INPUT_TYPE) inputs["NumDataPointsPerSet"] = [] inputs["NumDataPointsPerSet"].append(str(len(inputs["AppSize"]))) # Build up the arguments list for each invocation of the benchmark. # This is done here, instead of in ccbench.py, because this is custom to each app. app_args_list = [] for run_type in inputs["RunType"]: for app_size in inputs["AppSize"]: app_args_list.append(str(app_size) + " " \ + str(inputs["NumIterations"][0]) + " " +str(run_type)) # 2. Execute the benchmark and write to the report file. if (not ccbench.NORUN): ccbench.runBenchmark(app_bin, app_args_list, inputs, input_variables, report_filename) # 3. Extract Data from the report file. data = ccbench.readReportFile(report_filename, variables) # 4. Plot the Data #print data if NOPLOT: return if PLOT_POSTER: fig = plt.figure(figsize=(5, 3.5)) font = { #'family' : 'normal', #'weight' : 'bold', 'size': 8 } matplotlib.rc('font', **font) fig.subplots_adjust(top=0.94, bottom=0.14, left=0.1, right=0.96, wspace=0, hspace=0) else: fig = plt.figure(figsize=(9, 5.5)) fig.subplots_adjust(top=0.95, bottom=0.12, left=0.07, right=0.97, wspace=0, hspace=0) p1 = fig.add_subplot(1, 1, 1) print "Plotting time..." num_datapoints = int(data["NumDataPointsPerSet"][0]) # let's convert "appsizearg(#elm)" to "appsize(KB)" for i in range(len(data["AppSize"])): data["AppSize"][i] = str(float(data["AppSize"][i]) * 4 / 1024) for i in range(len(data["AppSize"]) / num_datapoints): srt_idx = i * num_datapoints end_idx = (i + 1) * num_datapoints p1.plot(data["AppSize"][srt_idx:end_idx], data["Time"][srt_idx:end_idx], linestyle='--', marker='.') p1.set_xscale('log') p1.set_yscale('log') plt.ylabel(data["TimeUnits"][0]) plt.xlabel('Array Size') plt.ylim((1, 320)) xmin, xmax = plt.xlim() plt.xlim((0.5, 1024 * 64)) # deal with ticks xtick_range = [ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 4096 * 2, 16384, 16384 * 2, 16384 * 4 ] xtick_names = [ '1 kB', '2 kB', '4 kB', '8 kB', '16 kB', '32 kB', '64 kB', '128 kB', '256 kB', '512 kB', '1 MB', '2 MB', '4 MB', '8 MB', '16 MB', '32 MB', '64 MB' ] #for KB ytick_range = [1, 2, 4, 8, 16, 32, 64, 128, 256] # in ns / iteration ytick_names = ['1', '2', '4', '8', '16', '32', '64', '128', '256'] if (xmax > 1024 * 65): xtick_range = [ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 4096 * 2, 16384, 16384 * 2, 16384 * 4, 1024 * 128 ] xtick_names = [ '1 kB', '2 kB', '4 kB', '8 kB', '16 kB', '32 kB', '64 kB', '128 kB', '256 kB', '512 kB', '1 MB', '2 MB', '4 MB', '8 MB', '16 MB', '32 MB', '64 MB', '128 MB' ] #for KB plt.xlim((0.5, 1024 * 128)) if (xmax > 1024 * 128): xtick_range = [ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 4096 * 2, 16384, 16384 * 2, 16384 * 4, 1024 * 128, 1024 * 256 ] xtick_names = [ '1 kB', '2 kB', '4 kB', '8 kB', '16 kB', '32 kB', '64 kB', '128 kB', '256 kB', '512 kB', '1 MB', '2 MB', '4 MB', '8 MB', '16 MB', '32 MB', '64 MB', '128 MB', '256 MB' ] #for KB plt.xlim((0.5, 1024 * 256)) p1.xaxis.set_major_locator(plt.NullLocator()) p1.xaxis.set_minor_locator(plt.NullLocator()) p1.yaxis.set_major_locator(plt.NullLocator()) p1.yaxis.set_minor_locator(plt.NullLocator()) plt.xticks(xtick_range, xtick_names, rotation='-30', size='small') plt.yticks(ytick_range, ytick_names) # annotate the graph with pretty cache size lines and info! ylow = 160 yhigh = 200 ccprocstats.plotCacheSizeLines(plt, p1, ccbench.PROCESSOR, ylow, yhigh) # customize figure title and other doodads based on the processor the test was run on print " " if (ccbench.PROCESSOR == "merom"): outputAccessLatency(data, 8, "L1 ", 2.33) outputAccessLatency(data, 64, "L2 ", 2.33) outputAccessLatency(data, 16384, "Off-chip", 2.33) if (ccbench.PROCESSOR == "ivybridge"): outputAccessLatency(data, 8, "L1 ", 2.3) outputAccessLatency(data, 128, "L2 ", 2.3) outputAccessLatency(data, 3072, "L3 ", 2.3) outputAccessLatency(data, 16384, "Off-chip", 2.3) elif (ccbench.PROCESSOR == "cuda1"): outputAccessLatency(data, 8, "L1 ", 2.4) outputAccessLatency(data, 64, "L2 ", 2.4) outputAccessLatency(data, 16384, "Off-chip", 2.4) elif (ccbench.PROCESSOR == "tegra2"): outputAccessLatency(data, 8, "L1 ", 0.4) #umnown outputAccessLatency(data, 64, "L2 ", 0.4) outputAccessLatency(data, 16384, "Off-chip", 0.4) elif (ccbench.PROCESSOR == "tilera"): outputAccessLatency(data, 4, "L1 ", 0.7) outputAccessLatency(data, 32, "L2 ", 0.7) outputAccessLatency(data, 1024, "L3* ", 0.7) outputAccessLatency(data, 16384, "Off-chip", 0.7) elif (ccbench.PROCESSOR == "tilera-l3"): #unknown outputAccessLatency(data, 4, "L1 ", 0.7) outputAccessLatency(data, 32, "L2 ", 0.7) outputAccessLatency(data, 1024, "L3 ", 0.7) outputAccessLatency(data, 16384, "Off-chip", 0.7) elif (ccbench.PROCESSOR == "arrandale"): outputAccessLatency(data, 8, "L1 ", 3.0) #unknwno outputAccessLatency(data, 64, "L2 ", 3.0) outputAccessLatency(data, 1024, "L3 ", 3.0) outputAccessLatency(data, 16384, "Off-chip", 3.0) elif (ccbench.PROCESSOR == "bloomfield"): outputAccessLatency(data, 8, "L1 ", 3.4) #unknown outputAccessLatency(data, 64, "L2 ", 3.4) outputAccessLatency(data, 1024, "L3 ", 3.4) outputAccessLatency(data, 16384, "Off-chip", 3.4) elif (ccbench.PROCESSOR == "emerald"): outputAccessLatency(data, 8, "L1 ", 2.27) outputAccessLatency(data, 64, "L2 ", 2.27) outputAccessLatency(data, 1024, "L3 ", 2.27) outputAccessLatency(data, 16384, "L3 ", 2.27) outputAccessLatency(data, 128 * 1024, "Off-chip", 2.27) elif (ccbench.PROCESSOR == "boxboro" ): #boxboro.millennium machine (westmere-ex) outputAccessLatency(data, 8, "L1 ", 2.27) outputAccessLatency(data, 64, "L2 ", 2.27) outputAccessLatency(data, 1024, "L3 ", 2.27) outputAccessLatency(data, 65536, "Off-chip", 2.27) outputAccessLatency(data, 262144, "DRAM ", 2.27) elif (ccbench.PROCESSOR == "bridge"): outputAccessLatency(data, 8, "L1 ", 3.4) outputAccessLatency(data, 64, "L2 ", 3.4) outputAccessLatency(data, 1024, "L3 ", 3.4) outputAccessLatency(data, 262144, "DRAM ", 3.4) else: plt.title("Cache Hierarchy" + r'', fontstyle='italic') print " Unknown processor - cycle count is assuming a 1 GHz clock" outputAccessLatency(data, 8, "", 1.0) outputAccessLatency(data, 64, "", 1.0) outputAccessLatency(data, 1024, "", 1.0) outputAccessLatency(data, 16384, "", 1.0) print " " if (ccbench.PLOT_FILENAME == "none"): filename = PLOT_DIR + ccbench.generatePlotFileName(APP) else: # Pull out the filename path from the full path. # This allows us to pull out the requested filename from the path presented # (since we always write reports to the report directory, etc.). However, it # allows the user to use tab-completion to specify the exact reportfile he # wants to use. filename = PLOT_DIR + os.path.basename(ccbench.PLOT_FILENAME) filename = os.path.splitext(filename)[0] plt.savefig(filename) print "Used report filename : " + report_filename print "Finished Plotting, saved as file : " + filename + ".pdf"
def main(): # handle CLI options ccbench.controller() #handle default/cli args app app_bin = BASE_DIR + APP input_filename = BASE_DIR + DEFAULT_INPUT_NAME report_filename = REPORT_DIR + ccbench.getReportFileName(APP, REPORT_DIR) # 1. Parse inputs.txt file. if (not ccbench.NORUN): inputs = ccbench.parseInputFile(input_filename, variables, ccbench.INPUT_TYPE) inputs["NumDataPointsPerSet"] = [] inputs["NumDataPointsPerSet"].append(str(len(inputs["AppSize"]))) # Build up the arguments list for each invocation of the benchmark. # This is done here, instead of in ccbench.py, because this is custom to each app. app_args_list = [] for app_size in inputs["AppSize"]: app_args_list.append(str(app_size) + " " + str(inputs["NumIterations"][0])) # 2. Execute the benchmark and write to the report file. if (not ccbench.NORUN): ccbench.runBenchmark(app_bin, app_args_list, inputs, input_variables, report_filename) # 3. Extract Data from the report file. data = ccbench.readReportFile(report_filename, variables) # 4. Plot the Data #print data if NOPLOT: return if PLOT_PPT: font = {#'family' : 'normal', #'weight' : 'bold', 'size' : 30} matplotlib.rc('font', **font) fig.subplots_adjust(top=0.90, bottom=0.25, left=0.18, right=0.97,wspace=0, hspace=0) xtick_range = [1,32,256, 4096*2,16384*4] xtick_names = ['1 kB','32 kB','256 kB','8 MB','64 MB'] #for KB elif PLOT_POSTER: fig = plt.figure(figsize=(5,3.5)) font = {#'family' : 'normal', #'weight' : 'bold', 'size' : 8} matplotlib.rc('font', **font) fig.subplots_adjust(top=0.94, bottom=0.14, left=0.1, right=0.96,wspace=0, hspace=0) else: fig = plt.figure(figsize=(9,5.5)) fig.subplots_adjust(top=0.95, bottom=0.12, left=0.07, right=0.97,wspace=0, hspace=0) fig.subplots_adjust(top=0.95, bottom=0.12, left=0.1, right=0.97,wspace=0, hspace=0) p1 = fig.add_subplot(1,1,1) print "Plotting time..." num_datapoints = int(data["NumDataPointsPerSet"][0]) # let's convert "appsizearg(#elm)" to "appsize(KB)" for i in range(len(data["AppSize"])): data["AppSize"][i] = str(float(data["AppSize"][i]) * 4 / 1024) for i in range(len(data["AppSize"])/num_datapoints): srt_idx = i*num_datapoints end_idx = (i+1)*num_datapoints p1.plot( data["AppSize"][srt_idx:end_idx], data["Output"][srt_idx:end_idx], linestyle='--', marker='.'#, # linewidth=2 ) p1.set_xscale('log') p1.set_yscale('log') plt.ylabel(data["Units"][0]) plt.xlabel('Array Size') # plt.ylim((1, 50000)) if (ccbench.PROCESSOR == "tilera-l3"): plt.ylim((100, 10000)) elif (ccbench.PROCESSOR == "tilera"): plt.ylim((100, 10000)) else: plt.ylim((1000, 100000)) plt.xlim((0.5, 16384*4)) if not PLOT_PPT: # deal with ticks xtick_range = [1,2,4,8,16,32,64, 128,256, 512,1024,2048,4096,4096*2, 16384,16384*2,16384*4] xtick_names = ['1 kB','2 kB','4 kB','8 kB','16 kB','32 kB','64 kB','128 kB','256 kB','512 kB','1 MB','2 MB','4 MB','8 MB','16 MB','32 MB','64 MB'] #for KB # ytick_range = [1,10,100,,1000,10000] # ytick_names = ['1','10','100','1e3','10e3'] p1.xaxis.set_major_locator( plt.NullLocator() ) p1.xaxis.set_minor_locator( plt.NullLocator() ) # p1.yaxis.set_major_locator( plt.NullLocator() ) # p1.yaxis.set_minor_locator( plt.NullLocator() ) plt.xticks( xtick_range, xtick_names, rotation='-30', size='small' ) # plt.yticks(ytick_range,ytick_names) (ymin, ymax) = plt.ylim() print "ymax=%d log(ymax) = %f, " % (ymax, np.log(ymax)) # print "log(7) = %f, 2^3 = 8 (%f) " % (np.log(7), np.exp(2)) yvalue_top = np.exp2((np.log2(ymax) + np.log2(ymin))*0.42) yvalue_bot = np.exp2((np.log2(ymax) + np.log2(ymin))*0.40) # yvalue_top = ymax*0.95 #np.exp(np.log(ymax) + np.log(ymin)/(2)) # yvalue_bot = yvalue_top*0.95 #np.exp(np.log(ymax) + np.log(ymin)/(2)) ccprocstats.plotCacheSizeLines(plt, p1, ccbench.PROCESSOR, yvalue_bot, yvalue_top) if (ccbench.PLOT_FILENAME == "none"): filename = ccbench.generatePlotFileName(APP) else: filename = PLOT_DIR + os.path.basename(ccbench.PLOT_FILENAME) filename = os.path.splitext(filename)[0] plt.savefig(filename) print "Used report filename : " + report_filename print "Finished Plotting, saved as file : " + filename + ".pdf"
def main(): # handle CLI options ccbench.controller() #handle default/cli args app app_bin = BASE_DIR + APP input_filename = BASE_DIR + DEFAULT_INPUT_NAME report_filename = REPORT_DIR + ccbench.getReportFileName(APP, REPORT_DIR) # 1. Parse inputs.txt file. if (not ccbench.NORUN): inputs = ccbench.parseInputFile(input_filename, variables, ccbench.INPUT_TYPE) inputs["NumDataPointsPerSet"] = [] inputs["NumDataPointsPerSet"].append(str(len(inputs["AppSize"]))) # Build up the arguments list for each invocation of the benchmark. # This is done here, instead of in ccbench.py, because this is custom to each app. app_args_list = [] for run_type in inputs["RunType"]: for app_size in inputs["AppSize"]: app_args_list.append(str(app_size) + " " \ + str(inputs["NumIterations"][0]) + " " +str(run_type)) # 2. Execute the benchmark and write to the report file. if (not ccbench.NORUN): ccbench.runBenchmark(app_bin, app_args_list, inputs, input_variables, report_filename) # 3. Extract Data from the report file. data = ccbench.readReportFile(report_filename, variables) # 4. Plot the Data #print data if NOPLOT: return if PLOT_POSTER: fig = plt.figure(figsize=(5,3.5)) font = {#'family' : 'normal', #'weight' : 'bold', 'size' : 8} matplotlib.rc('font', **font) fig.subplots_adjust(top=0.94, bottom=0.14, left=0.1, right=0.96,wspace=0, hspace=0) else: fig = plt.figure(figsize=(9,5.5)) fig.subplots_adjust(top=0.95, bottom=0.12, left=0.07, right=0.97,wspace=0, hspace=0) p1 = fig.add_subplot(1,1,1) print "Plotting time..." num_datapoints = int(data["NumDataPointsPerSet"][0]) # let's convert "appsizearg(#elm)" to "appsize(KB)" for i in range(len(data["AppSize"])): data["AppSize"][i] = str(float(data["AppSize"][i]) * 4 / 1024) for i in range(len(data["AppSize"])/num_datapoints): srt_idx = i*num_datapoints end_idx = (i+1)*num_datapoints p1.plot( data["AppSize"][srt_idx:end_idx], data["Time"][srt_idx:end_idx], linestyle='--', marker='.' ) p1.set_xscale('log') p1.set_yscale('log') plt.ylabel(data["TimeUnits"][0]) plt.xlabel('Array Size') plt.ylim((1, 320)) xmin,xmax=plt.xlim() plt.xlim((0.5, 1024*64)) # deal with ticks xtick_range = [1,2,4,8,16,32,64, 128,256, 512,1024,2048,4096,4096*2, 16384,16384*2,16384*4] xtick_names = ['1 kB','2 kB','4 kB','8 kB','16 kB','32 kB','64 kB','128 kB','256 kB','512 kB','1 MB','2 MB','4 MB','8 MB','16 MB','32 MB','64 MB'] #for KB ytick_range = [1,2,4,8,16,32,64,128,256] # in ns / iteration ytick_names = ['1','2','4','8','16','32','64','128','256'] if (xmax > 1024*65): xtick_range = [1,2,4,8,16,32,64, 128,256, 512,1024,2048,4096,4096*2, 16384,16384*2,16384*4,1024*128] xtick_names = ['1 kB','2 kB','4 kB','8 kB','16 kB','32 kB','64 kB','128 kB','256 kB','512 kB','1 MB','2 MB','4 MB','8 MB','16 MB','32 MB','64 MB','128 MB'] #for KB plt.xlim((0.5,1024*128)) if (xmax > 1024*128): xtick_range = [1,2,4,8,16,32,64, 128,256, 512,1024,2048,4096,4096*2, 16384,16384*2,16384*4,1024*128,1024*256] xtick_names = ['1 kB','2 kB','4 kB','8 kB','16 kB','32 kB','64 kB','128 kB','256 kB','512 kB','1 MB','2 MB','4 MB','8 MB','16 MB','32 MB','64 MB','128 MB','256 MB'] #for KB plt.xlim((0.5,1024*256)) p1.xaxis.set_major_locator( plt.NullLocator() ) p1.xaxis.set_minor_locator( plt.NullLocator() ) p1.yaxis.set_major_locator( plt.NullLocator() ) p1.yaxis.set_minor_locator( plt.NullLocator() ) plt.xticks( xtick_range, xtick_names, rotation='-30', size='small' ) plt.yticks(ytick_range,ytick_names) # annotate the graph with pretty cache size lines and info! ylow = 160 yhigh = 200 ccprocstats.plotCacheSizeLines(plt, p1, ccbench.PROCESSOR, ylow, yhigh) # customize figure title and other doodads based on the processor the test was run on print " "; if (ccbench.PROCESSOR == "merom"): outputAccessLatency(data, 8, "L1 ", 2.33); outputAccessLatency(data, 64, "L2 ", 2.33); outputAccessLatency(data, 16384, "Off-chip", 2.33); if (ccbench.PROCESSOR == "ivybridge"): outputAccessLatency(data, 8, "L1 ", 2.3); outputAccessLatency(data, 128, "L2 ", 2.3); outputAccessLatency(data, 3072, "L3 ", 2.3); outputAccessLatency(data, 16384, "Off-chip", 2.3); elif (ccbench.PROCESSOR == "cuda1"): outputAccessLatency(data, 8, "L1 ", 2.4); outputAccessLatency(data, 64, "L2 ", 2.4); outputAccessLatency(data, 16384, "Off-chip", 2.4); elif (ccbench.PROCESSOR == "tegra2"): outputAccessLatency(data, 8, "L1 ", 0.4); #umnown outputAccessLatency(data, 64, "L2 ", 0.4); outputAccessLatency(data, 16384, "Off-chip", 0.4); elif (ccbench.PROCESSOR == "tilera"): outputAccessLatency(data, 4, "L1 ", 0.7); outputAccessLatency(data, 32, "L2 ", 0.7); outputAccessLatency(data, 1024, "L3* ", 0.7); outputAccessLatency(data, 16384, "Off-chip", 0.7); elif (ccbench.PROCESSOR == "tilera-l3"): #unknown outputAccessLatency(data, 4, "L1 ", 0.7); outputAccessLatency(data, 32, "L2 ", 0.7); outputAccessLatency(data, 1024, "L3 ", 0.7); outputAccessLatency(data, 16384, "Off-chip", 0.7); elif (ccbench.PROCESSOR == "arrandale"): outputAccessLatency(data, 8, "L1 ", 3.0); #unknwno outputAccessLatency(data, 64, "L2 ", 3.0); outputAccessLatency(data, 1024, "L3 ", 3.0); outputAccessLatency(data, 16384, "Off-chip", 3.0); elif (ccbench.PROCESSOR == "bloomfield"): outputAccessLatency(data, 8, "L1 ", 3.4); #unknown outputAccessLatency(data, 64, "L2 ", 3.4); outputAccessLatency(data, 1024, "L3 ", 3.4); outputAccessLatency(data, 16384, "Off-chip", 3.4); elif (ccbench.PROCESSOR == "emerald"): outputAccessLatency(data, 8, "L1 ", 2.27); outputAccessLatency(data, 64, "L2 ", 2.27); outputAccessLatency(data, 1024, "L3 ", 2.27); outputAccessLatency(data, 16384, "L3 ", 2.27); outputAccessLatency(data, 128*1024, "Off-chip", 2.27); elif (ccbench.PROCESSOR == "boxboro"): #boxboro.millennium machine (westmere-ex) outputAccessLatency(data, 8, "L1 ", 2.27); outputAccessLatency(data, 64, "L2 ", 2.27); outputAccessLatency(data, 1024, "L3 ", 2.27); outputAccessLatency(data, 65536, "Off-chip", 2.27); outputAccessLatency(data,262144, "DRAM ", 2.27); elif (ccbench.PROCESSOR == "bridge"): outputAccessLatency(data, 8, "L1 ", 3.4); outputAccessLatency(data, 64, "L2 ", 3.4); outputAccessLatency(data, 1024, "L3 ", 3.4); outputAccessLatency(data,262144, "DRAM ", 3.4); else: plt.title("Cache Hierarchy" + r'', fontstyle='italic') print " Unknown processor - cycle count is assuming a 1 GHz clock" outputAccessLatency(data, 8, "", 1.0); outputAccessLatency(data, 64, "", 1.0); outputAccessLatency(data, 1024, "", 1.0); outputAccessLatency(data, 16384, "", 1.0); print " "; if (ccbench.PLOT_FILENAME == "none"): filename = PLOT_DIR + ccbench.generatePlotFileName(APP) else: # Pull out the filename path from the full path. # This allows us to pull out the requested filename from the path presented # (since we always write reports to the report directory, etc.). However, it # allows the user to use tab-completion to specify the exact reportfile he # wants to use. filename = PLOT_DIR + os.path.basename(ccbench.PLOT_FILENAME) filename = os.path.splitext(filename)[0] plt.savefig(filename) print "Used report filename : " + report_filename print "Finished Plotting, saved as file : " + filename + ".pdf"
def main(): # handle CLI options ccbench.controller() #handle default/cli args app app_bin = BASE_DIR + APP input_filename = BASE_DIR + DEFAULT_INPUT_NAME report_filename = REPORT_DIR + DEFAULT_REPORT_NAME # 1. Parse inputs.txt file. if (not ccbench.NORUN): inputs = ccbench.parseInputFile(input_filename, variables, ccbench.INPUT_TYPE) inputs["NumDataPointsPerSet"] = [] inputs["NumDataPointsPerSet"].append(str(len(inputs["AppSize"]))) # Build up the arguments list for each invocation of the benchmark. # This is done here, instead of in ccbench.py, because this is custom to each app. app_args_list = [] for app_num_threads in inputs["NumThreads"]: for app_size in inputs["AppSize"]: app_args_list.append( str(app_num_threads) + " " + str(app_size) + " " + str(inputs["NumIterations"][0])) # 2. Execute the benchmark and write to the report file. if (not ccbench.NORUN): ccbench.runBenchmark(app_bin, app_args_list, inputs, input_variables, report_filename) # 3. Extract Data from the report file. data = ccbench.readReportFile(report_filename, variables) # 4. Plot the Data #print data if NOPLOT: return fig = plt.figure(figsize=(9, 5.5)) p1 = fig.add_subplot(1, 1, 1) print "Plotting time..." num_datapoints = int(data["NumDataPointsPerSet"][0]) # let's convert "appsizearg(#elm)" to "appsize(KB)" for i in range(len(data["AppSize"])): data["AppSize"][i] = str(float(data["AppSize"][i]) * 4 / 1024) for i in range(len(data["AppSize"]) / num_datapoints): srt_idx = i * num_datapoints end_idx = (i + 1) * num_datapoints p1.plot(data["AppSize"][srt_idx:end_idx], data["Time"][srt_idx:end_idx], linestyle='--', marker='.') p1.set_xscale('log') p1.set_yscale('log') plt.ylabel(data["TimeUnits"][0]) plt.xlabel('Array Size') plt.ylim((1, 256)) plt.xlim((0.5, 16384 * 4)) #font = {#'family' : 'normal', # #'weight' : 'bold', # 'size' : 20} #matplotlib.rc('font', **font) # deal with ticks xtick_range = [ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 4096 * 2, 16384, 16384 * 2, 16384 * 4 ] xtick_names = [ '1 kB', '2 kB', '4 kB', '8 kB', '16 kB', '32 kB', '64 kB', '128 kB', '256 kB', '512 kB', '1 MB', '2 MB', '4 MB', '8 MB', '16 MB', '32 MB', '64 MB' ] #for KB ytick_range = [1, 2, 4, 8, 16, 32, 64, 128, 256] # in ns / iteration ytick_names = ['1', '2', '4', '8', '16', '32', '64', '128', '256'] p1.xaxis.set_major_locator(plt.NullLocator()) p1.xaxis.set_minor_locator(plt.NullLocator()) p1.yaxis.set_major_locator(plt.NullLocator()) p1.yaxis.set_minor_locator(plt.NullLocator()) plt.xticks(xtick_range, xtick_names, rotation='-30', size='small') plt.yticks(ytick_range, ytick_names) # fig.subplots_adjust(top=0.95, bottom=0.12, left=0.07, right=0.97,wspace=0, hspace=0) fig.subplots_adjust(top=0.95, bottom=0.12, left=0.07, right=0.95, wspace=0, hspace=0) # customize figure title and other doodads based on the processor the test was run on if (ccbench.PROCESSOR == "merom"): p1.axvline(x=32, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.axvline(x=4096, ymin=0.05, ymax=.9, linestyle='--', color='black') plt.title("Intel Core 2 Duo T7600 (Merom)" + r'', fontstyle='italic') p1.text(4, 160, "32 kB", horizontalalignment='center', verticalalignment='center') p1.text(512, 160, "4 MB", horizontalalignment='center', verticalalignment='center') p1.text(16 * 1024, 160, "off-chip", horizontalalignment='center', verticalalignment='center') elif (ccbench.PROCESSOR == "tilera"): plt.title("TilePro64 (Default malloc behavior)" + r'', fontstyle='italic') p1.axvline(x=8, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.axvline(x=64, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.axvline(x=4096, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.text(4, 160, "8 kB", horizontalalignment='center', verticalalignment='center') p1.text(16, 160, "64 kB", horizontalalignment='center', verticalalignment='center') p1.text(1024, 160, "4 MB", horizontalalignment='center', verticalalignment='center') p1.text(16 * 1024, 160, "off-chip", horizontalalignment='center', verticalalignment='center') elif (ccbench.PROCESSOR == "tilera-l3"): plt.title("TilePro64 (using 'Hash-for-Home')" + r'', fontstyle='italic') p1.axvline(x=8, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.axvline(x=64, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.axvline(x=4096, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.text(4, 160, "8 kB", horizontalalignment='center', verticalalignment='center') p1.text(16, 160, "64 kB", horizontalalignment='center', verticalalignment='center') p1.text(1024, 160, "4 MB", horizontalalignment='center', verticalalignment='center') p1.text(16 * 1024, 160, "off-chip", horizontalalignment='center', verticalalignment='center') else: plt.title("Cache Hierarchy" + r'', fontstyle='italic') # legend colors = ('b', 'g', 'r', 'c', 'm', 'y', 'k', 'b', 'g', 'r', 'c', 'm') legend_sz = len(data["NumThreads"]) / num_datapoints lines = [] #for i in reversed(range(legend_sz)): for i in (range(legend_sz)): lines.append( plt.Line2D([0, 10], [0, 10], linewidth=3, color=colors[legend_sz - 1 - i])) args = range(legend_sz) for i in (range(legend_sz)): args[legend_sz - 1 - i] = data["NumThreads"][((i) * num_datapoints)] #legend_font= FontProperties() #legend_font.set_size('medium') plt.legend(lines, args, 'best', title="Num of\nThreads", bbox_to_anchor=(1.05, 0.40)) if (ccbench.PLOT_FILENAME == "none"): filename = APP else: filename = ccbench.PLOT_FILENAME plt.savefig(PLOT_DIR + filename) print "Finished Plotting, saved as file '" + PLOT_DIR + filename + ".pdf'"
def main(): # handle CLI options ccbench.controller() #handle default/cli args app app_bin = BASE_DIR + APP input_filename = BASE_DIR + DEFAULT_INPUT_NAME report_filename = REPORT_DIR + ccbench.getReportFileName(APP, REPORT_DIR) # 1. Parse inputs.txt file. if (not ccbench.NORUN): inputs = ccbench.parseInputFile(input_filename, variables, ccbench.INPUT_TYPE) inputs["NumDataPointsPerSet"] = [] inputs["NumDataPointsPerSet"].append(str(len(inputs["AppSize"]))) # Build up the arguments list for each invocation of the benchmark. # This is done here, instead of in ccbench.py, because this is custom to each app. app_args_list = [] for app_size in inputs["AppSize"]: app_args_list.append( str(app_size) + " " + str(inputs["NumIterations"][0])) # 2. Execute the benchmark and write to the report file. if (not ccbench.NORUN): ccbench.runBenchmark(app_bin, app_args_list, inputs, input_variables, report_filename) # 3. Extract Data from the report file. data = ccbench.readReportFile(report_filename, variables) # 4. Plot the Data #print data if NOPLOT: return if PLOT_PPT: font = { #'family' : 'normal', #'weight' : 'bold', 'size': 30 } matplotlib.rc('font', **font) fig.subplots_adjust(top=0.90, bottom=0.25, left=0.18, right=0.97, wspace=0, hspace=0) xtick_range = [1, 32, 256, 4096 * 2, 16384 * 4] xtick_names = ['1 kB', '32 kB', '256 kB', '8 MB', '64 MB'] #for KB elif PLOT_POSTER: fig = plt.figure(figsize=(5, 3.5)) font = { #'family' : 'normal', #'weight' : 'bold', 'size': 8 } matplotlib.rc('font', **font) fig.subplots_adjust(top=0.94, bottom=0.14, left=0.1, right=0.96, wspace=0, hspace=0) else: fig = plt.figure(figsize=(9, 5.5)) fig.subplots_adjust(top=0.95, bottom=0.12, left=0.07, right=0.97, wspace=0, hspace=0) fig.subplots_adjust(top=0.95, bottom=0.12, left=0.1, right=0.97, wspace=0, hspace=0) p1 = fig.add_subplot(1, 1, 1) print "Plotting time..." num_datapoints = int(data["NumDataPointsPerSet"][0]) # let's convert "appsizearg(#elm)" to "appsize(KB)" for i in range(len(data["AppSize"])): data["AppSize"][i] = str(float(data["AppSize"][i]) * 4 / 1024) for i in range(len(data["AppSize"]) / num_datapoints): srt_idx = i * num_datapoints end_idx = (i + 1) * num_datapoints p1.plot( data["AppSize"][srt_idx:end_idx], data["Output"][srt_idx:end_idx], linestyle='--', marker='.' #, # linewidth=2 ) p1.set_xscale('log') p1.set_yscale('log') plt.ylabel(data["Units"][0]) plt.xlabel('Array Size') # plt.ylim((1, 50000)) if (ccbench.PROCESSOR == "tilera-l3"): plt.ylim((100, 10000)) elif (ccbench.PROCESSOR == "tilera"): plt.ylim((100, 10000)) else: plt.ylim((1000, 100000)) plt.xlim((0.5, 16384 * 4)) if not PLOT_PPT: # deal with ticks xtick_range = [ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 4096 * 2, 16384, 16384 * 2, 16384 * 4 ] xtick_names = [ '1 kB', '2 kB', '4 kB', '8 kB', '16 kB', '32 kB', '64 kB', '128 kB', '256 kB', '512 kB', '1 MB', '2 MB', '4 MB', '8 MB', '16 MB', '32 MB', '64 MB' ] #for KB # ytick_range = [1,10,100,,1000,10000] # ytick_names = ['1','10','100','1e3','10e3'] p1.xaxis.set_major_locator(plt.NullLocator()) p1.xaxis.set_minor_locator(plt.NullLocator()) # p1.yaxis.set_major_locator( plt.NullLocator() ) # p1.yaxis.set_minor_locator( plt.NullLocator() ) plt.xticks(xtick_range, xtick_names, rotation='-30', size='small') # plt.yticks(ytick_range,ytick_names) (ymin, ymax) = plt.ylim() print "ymax=%d log(ymax) = %f, " % (ymax, np.log(ymax)) # print "log(7) = %f, 2^3 = 8 (%f) " % (np.log(7), np.exp(2)) yvalue_top = np.exp2((np.log2(ymax) + np.log2(ymin)) * 0.42) yvalue_bot = np.exp2((np.log2(ymax) + np.log2(ymin)) * 0.40) # yvalue_top = ymax*0.95 #np.exp(np.log(ymax) + np.log(ymin)/(2)) # yvalue_bot = yvalue_top*0.95 #np.exp(np.log(ymax) + np.log(ymin)/(2)) ccprocstats.plotCacheSizeLines(plt, p1, ccbench.PROCESSOR, yvalue_bot, yvalue_top) if (ccbench.PLOT_FILENAME == "none"): filename = ccbench.generatePlotFileName(APP) else: filename = PLOT_DIR + os.path.basename(ccbench.PLOT_FILENAME) filename = os.path.splitext(filename)[0] plt.savefig(filename) print "Used report filename : " + report_filename print "Finished Plotting, saved as file : " + filename + ".pdf"
def main(): ccbench.controller() # handle CLI options #handle default/cli args app app_bin = BASE_DIR + APP input_filename = BASE_DIR + DEFAULT_INPUT_NAME report_filename = REPORT_DIR + ccbench.getReportFileName(APP, REPORT_DIR) # 1. Parse inputs.txt file if (not ccbench.NORUN): inputs = ccbench.parseInputFile(input_filename, input_variables, ccbench.INPUT_TYPE) NumDataPointsPerSet = 0 # Build up the arguments list for each invocation of the benchmark. # This is done here, instead of in ccbench.py, because this is custom to each app. app_args_list = [] for num_threads in inputs["NumThreads"]: for num_requests in inputs["NumRequests"]: for app_size in inputs["AppSize"]: NumDataPointsPerSet += num_threads #each thread spawns a new entry in band_req_mc! app_args_list.append(str(num_threads) + " " + str(num_requests) + " " + str(app_size) \ + " " + str(inputs["NumIterations"][0])) inputs["NumDataPointsPerSet"] = [] inputs["NumDataPointsPerSet"].append(str(NumDataPointsPerSet)) # 2. Execute the benchmark and read the report file if (not ccbench.NORUN): ccbench.runBenchmark(app_bin, app_args_list, inputs, input_variables, report_filename) # 3. Extract Data data = ccbench.readReportFile(report_filename, variables) inputs = ccbench.parseReportFileForInputs(report_filename, input_variables) # 4. Plot the Data #print data if NOPLOT: return fig = plt.figure(figsize=(9,5.5)) p2 = fig.add_subplot(1,2,2) p1 = fig.add_subplot(1,2,1) print "Plotting time..." num_datapoints = int(data["NumDataPointsPerSet"][0]) # let's convert "appsizearg(#elm)" to "appsize(KB)" for i in range(len(data["AppSize"])): data["AppSize"][i] = str(float(data["AppSize"][i]) * 4 / 1024) # deal with ticks # xtick_range = [1,2,4,8,16,32,64,128,256,512,1024,2048,4096,4096*2,16384] #for KB # xtick_names = ['1 kB','2 kB','4 kB','8 kB','16 kB','32 kB','64 kB','128 kB','256 kB','512 kB','1 MB','2 MB','4 MB','8 MB','16 MB'] #for KB xtick_range = [1,4,16,64,256,1024,4096,16384] #for KB xtick_names = ['1 kB','4 kB','16 kB','64 kB','256 kB','1 MB','4 MB','16 MB'] xmin,xmax = plt.xlim() print "xmax = %d" % (xmax) # if (xmax >= 1024*32): # xtick_range = [1,2,4,8,16,32,64, 128,256, 512,1024,2048,4096,4096*2, 16384,16384*2,16384*4,1024*128] # xtick_names = ['1 kB','2 kB','4 kB','8 kB','16 kB','32 kB','64 kB','128 kB','256 kB','512 kB','1 MB','2 MB','4 MB','8 MB','16 MB','32 MB','64 MB','128 MB'] #for KB xtick_range = [1,4,16,64,256,1024,4096,16384, 1024*64] #for KB xtick_names = ['1 kB','4 kB','16 kB','64 kB','256 kB','1 MB','4 MB','16 MB', '64 MB'] plt.xlim((0.5,1024*128)) # fig.subplots_adjust(top=0.95, bottom=0.12, left=0.07, right=0.90,wspace=0, hspace=0) fig.subplots_adjust(top=0.95, bottom=0.12, left=0.07, right=0.90,wspace=0.13, hspace=0) c_counter = 0 colors =('b','g','r','c','m','y','k','b','g','r','c','m') line_styles=('-.',':','-.',':') for num_threads in inputs["NumThreads"]: #x_array = [int(s) for s in array ] # print "NumThreads, graphing NumThreads: " + str(num_threads) l_counter = 0 color = colors [c_counter % len(colors)] c_counter +=1 # plot a line for each tid in th eexperiment NumThreads for num_req in inputs["NumRequests"]: line_style = line_styles[l_counter % len(line_styles)] l_counter += 1 for tid in range(num_threads): x_array = [] band_array = [] aggr_array = [] for idx in range(len(data["AppSize"])): # print " looking at idx: " + str(idx) + " in data[apsize]" if (int(data["ThreadID"][idx]) == int(tid)) and (int(data["NumThreads"][idx]) == num_threads) and (int(data["NumRequests"][idx]) == num_req): # print " appending " + data["AppSize"][idx] + " For ThreadID: " + data["ThreadID"][idx] x_array.append(data["AppSize"][idx]) aggr_array.append(data["AggregateBandwidth"][idx]) band_array.append(data["Bandwidth"][idx]) p1.plot( x_array, band_array, # linestyle="--", linestyle=line_style, # linestyle=" ", marker='.', color = color ) p2.plot( x_array, aggr_array, # linestyle="--", linestyle=line_style, # linestyle=" ", marker='.', color = color ) p1.set_xscale('log') p2.set_xscale('log') plt.ylabel(data["BandwidthUnits"][0]) plt.xlabel('Per Thread Working Set') ymin, ymax = plt.ylim() plt.ylim((0.0, ymax)) plt.xlim((0.5, 16384)) p1.xaxis.set_major_locator( plt.NullLocator() ) p1.xaxis.set_minor_locator( plt.NullLocator() ) p2.xaxis.set_major_locator( plt.NullLocator() ) p2.xaxis.set_minor_locator( plt.NullLocator() ) plt.xticks( xtick_range, xtick_names, rotation='-30', size='small' ) p2 = fig.add_subplot(1,2,2) plt.xticks( xtick_range, xtick_names, rotation='-30', size='small' ) # resize the per thread bandwidth...(to match aggregate bandwidth) #p2 = fig.add_subplot(1,2,2) #(ylow,yhigh) = plt.ylim() #p1 = fig.add_subplot(1,2,1) #plt.ylim((ylow,yhigh)) # plot processor-specific info p1 = fig.add_subplot(1,2,1) (ylow,yhigh) = plt.ylim() yhigh = 0.95*yhigh ylow = 0.95*yhigh ccprocstats.plotCacheSizeLines(plt, p1, ccbench.PROCESSOR, ylow, yhigh) p2 = fig.add_subplot(1,2,2) plt.xlabel('Per Thread Working Set') (ylow,yhigh) = plt.ylim() yhigh = 0.95*yhigh ylow = 0.95*yhigh ccprocstats.plotCacheSizeLines(plt, p2, ccbench.PROCESSOR, ylow, yhigh) p2 = fig.add_subplot(1,2,2) plt.title("Aggregate Bandwidth" + r'', fontstyle='italic') p1 = fig.add_subplot(1,2,1) plt.title("Per Thread Bandwidth" + r'', fontstyle='italic') # legend colors =('b','g','r','c','m','y','k','b','g','r','c','m') legend_sz = len(inputs["NumThreads"]) lines = [] for i in (range(legend_sz)): lines.append(plt.Line2D([0,10], [0,10], linewidth=3, color=colors[legend_sz-1-i], linestyle='-')) args = range(legend_sz) for i in (range(legend_sz)): args[legend_sz - 1 - i] = str(inputs["NumThreads"][i]) + " Threads" # args[legend_sz - 1 - i] = "{Thds:" + str(inputs["NumThreads"][i]) + "}" #+ ", Reqs:" + input["NumRequests"][((i)*num_datapoints)] + "}" p2 = fig.add_subplot(1,2,2) plt.legend(lines, args, 'best', title="Num of Threads", bbox_to_anchor=(0.70, 0.9)) (ylow,yhigh) = plt.ylim() (xmin,xmax) = plt.xlim() p2.text(xmax, 0.9*yhigh, "%d requests / thread" % (inputs["NumRequests"][0]), horizontalalignment='center',verticalalignment='center', size='x-small') if (ccbench.PLOT_FILENAME == "none"): filename = PLOT_DIR + ccbench.generatePlotFileName(APP) else: # Pull out the filename path from the full path. # This allows us to pull out the requested filename from the path presented # (since we always write reports to the report directory, etc.). However, it # allows the user to use tab-completion to specify the exact reportfile he # wants to use. filename = PLOT_DIR + os.path.basename(ccbench.PLOT_FILENAME) filename = os.path.splitext(filename)[0] plt.savefig(filename) print "Used report filename : " + report_filename print "Finished Plotting, saved as file : " + filename + ".pdf"
def main(): # handle CLI options ccbench.controller() #handle default/cli args app app_bin = BASE_DIR + APP input_filename = BASE_DIR + DEFAULT_INPUT_NAME report_filename = REPORT_DIR + DEFAULT_REPORT_NAME # 1. Parse inputs.txt file. if (not ccbench.NORUN): inputs = ccbench.parseInputFile(input_filename, variables, ccbench.INPUT_TYPE) inputs["NumDataPointsPerSet"] = [] inputs["NumDataPointsPerSet"].append(str(len(inputs["AppSize"]))) # Build up the arguments list for each invocation of the benchmark. # This is done here, instead of in ccbench.py, because this is custom to each app. app_args_list = [] for app_num_threads in inputs["NumThreads"]: for app_size in inputs["AppSize"]: app_args_list.append(str(app_num_threads) +" " + str(app_size) + " " + str(inputs["NumIterations"][0])) # 2. Execute the benchmark and write to the report file. if (not ccbench.NORUN): ccbench.runBenchmark(app_bin, app_args_list, inputs, input_variables, report_filename) # 3. Extract Data from the report file. data = ccbench.readReportFile(report_filename, variables) # 4. Plot the Data #print data if NOPLOT: return fig = plt.figure(figsize=(9,5.5)) p1 = fig.add_subplot(1,1,1) print "Plotting time..." num_datapoints = int(data["NumDataPointsPerSet"][0]) # let's convert "appsizearg(#elm)" to "appsize(KB)" for i in range(len(data["AppSize"])): data["AppSize"][i] = str(float(data["AppSize"][i]) * 4 / 1024) for i in range(len(data["AppSize"])/num_datapoints): srt_idx = i*num_datapoints end_idx = (i+1)*num_datapoints p1.plot( data["AppSize"][srt_idx:end_idx], data["Time"][srt_idx:end_idx], linestyle='--', marker='.' ) p1.set_xscale('log') p1.set_yscale('log') plt.ylabel(data["TimeUnits"][0]) plt.xlabel('Array Size') plt.ylim((1, 256)) plt.xlim((0.5, 16384*4)) #font = {#'family' : 'normal', # #'weight' : 'bold', # 'size' : 20} #matplotlib.rc('font', **font) # deal with ticks xtick_range = [1,2,4,8,16,32,64, 128,256, 512,1024,2048,4096,4096*2, 16384,16384*2,16384*4] xtick_names = ['1 kB','2 kB','4 kB','8 kB','16 kB','32 kB','64 kB','128 kB','256 kB','512 kB','1 MB','2 MB','4 MB','8 MB','16 MB','32 MB','64 MB'] #for KB ytick_range = [1,2,4,8,16,32,64,128,256] # in ns / iteration ytick_names = ['1','2','4','8','16','32','64','128','256'] p1.xaxis.set_major_locator( plt.NullLocator() ) p1.xaxis.set_minor_locator( plt.NullLocator() ) p1.yaxis.set_major_locator( plt.NullLocator() ) p1.yaxis.set_minor_locator( plt.NullLocator() ) plt.xticks( xtick_range, xtick_names, rotation='-30', size='small' ) plt.yticks(ytick_range,ytick_names) # fig.subplots_adjust(top=0.95, bottom=0.12, left=0.07, right=0.97,wspace=0, hspace=0) fig.subplots_adjust(top=0.95, bottom=0.12, left=0.07, right=0.95,wspace=0, hspace=0) # customize figure title and other doodads based on the processor the test was run on if (ccbench.PROCESSOR == "merom"): p1.axvline(x=32, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.axvline(x=4096, ymin=0.05, ymax=.9, linestyle='--', color='black') plt.title("Intel Core 2 Duo T7600 (Merom)" + r'', fontstyle='italic') p1.text(4, 160,"32 kB", horizontalalignment='center',verticalalignment='center') p1.text(512, 160,"4 MB", horizontalalignment='center',verticalalignment='center') p1.text(16*1024, 160,"off-chip", horizontalalignment='center',verticalalignment='center') elif (ccbench.PROCESSOR == "tilera"): plt.title("TilePro64 (Default malloc behavior)" + r'', fontstyle='italic') p1.axvline(x=8, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.axvline(x=64, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.axvline(x=4096, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.text(4, 160,"8 kB", horizontalalignment='center',verticalalignment='center') p1.text(16, 160,"64 kB", horizontalalignment='center',verticalalignment='center') p1.text(1024, 160,"4 MB", horizontalalignment='center',verticalalignment='center') p1.text(16*1024, 160,"off-chip", horizontalalignment='center',verticalalignment='center') elif (ccbench.PROCESSOR == "tilera-l3"): plt.title("TilePro64 (using 'Hash-for-Home')" + r'', fontstyle='italic') p1.axvline(x=8, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.axvline(x=64, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.axvline(x=4096, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.text(4, 160,"8 kB", horizontalalignment='center',verticalalignment='center') p1.text(16, 160,"64 kB", horizontalalignment='center',verticalalignment='center') p1.text(1024, 160,"4 MB", horizontalalignment='center',verticalalignment='center') p1.text(16*1024, 160,"off-chip", horizontalalignment='center',verticalalignment='center') else: plt.title("Cache Hierarchy" + r'', fontstyle='italic') # legend colors =('b','g','r','c','m','y','k','b','g','r','c','m') legend_sz = len(data["NumThreads"])/num_datapoints lines = [] #for i in reversed(range(legend_sz)): for i in (range(legend_sz)): lines.append(plt.Line2D([0,10], [0,10], linewidth=3, color=colors[legend_sz-1-i])) args = range(legend_sz) for i in (range(legend_sz)): args[legend_sz - 1 - i] = data["NumThreads"][((i)*num_datapoints)] #legend_font= FontProperties() #legend_font.set_size('medium') plt.legend(lines, args, 'best', title="Num of\nThreads", bbox_to_anchor=(1.05, 0.40)) if (ccbench.PLOT_FILENAME == "none"): filename = APP else: filename = ccbench.PLOT_FILENAME plt.savefig(PLOT_DIR + filename) print "Finished Plotting, saved as file '" + PLOT_DIR + filename + ".pdf'"
def main(): # handle CLI options ccbench.controller() #handle default/cli args app app_bin = BASE_DIR + APP input_filename = BASE_DIR + DEFAULT_INPUT_NAME report_filename = REPORT_DIR + DEFAULT_REPORT_NAME # 1. Parse inputs.txt file. if (not ccbench.NORUN): inputs = ccbench.parseInputFile(input_filename, variables, ccbench.INPUT_TYPE) inputs["NumDataPointsPerSet"] = [] inputs["NumDataPointsPerSet"].append(str(len(inputs["AppStride"]))) # Build up the arguments list for each invocation of the benchmark. # This is done here, instead of in ccbench.py, because this is custom to each app. app_args_list = [] for app_size in inputs["AppSize"]: for app_stride in inputs["AppStride"]: app_args_list.append(str(inputs["NumThreads"][0]) + " " + str(app_size) \ + " " + str(app_stride) + " " + str(inputs["NumIterations"][0]) + " ") # 2. Execute the benchmark and write to the report file. if (not ccbench.NORUN): ccbench.runBenchmark(app_bin, app_args_list, inputs, input_variables, report_filename) # 3. Extract Data from the report file. data = ccbench.readReportFile(report_filename, variables) # 4. Plot the Data #print data if NOPLOT: return fig = plt.figure(figsize=(10, 5.5)) p1 = fig.add_subplot(1, 1, 1) print "Plotting time..." num_datapoints = int(data["NumDataPointsPerSet"][0]) # let's convert "appsizearg(#elm)" to "appsize(KB)" for i in range(len(data["AppSize"])): data["AppSize"][i] = str(float(data["AppSize"][i]) * 4 / 1024) # convert stride from Word to Bytes for i in range(len(data["AppStride"])): data["AppStride"][i] = str(float(data["AppStride"][i]) * 4) for i in range(len(data["AppSize"]) / num_datapoints): srt_idx = i * num_datapoints end_idx = (i + 1) * num_datapoints p1.plot(data["AppStride"][srt_idx:end_idx], data["Time"][srt_idx:end_idx], linestyle='--', marker='.') p1.set_xscale('log') plt.ylabel(data["TimeUnits"][0]) plt.xlabel('Stride Size') xmin, ymax = plt.xlim() plt.xlim((xmin, 16384 * 4)) font = { #'family' : 'normal', # #'weight' : 'bold', 'size': 12 } matplotlib.rc('font', **font) # deal with ticks xtick_range = [ 4, 16, 64, 256, 1024, 4096, 16386, 65544, 262176, 1048704, 4194816, 16779264, 67117056 ] # in Bytes xtick_names = [ '4B', '16B', '64B', '256B', '1KB', '4KB', '16KB', '64KB', '256KB', '1MB', '4MB', '16MB', '64MB' ] ytick_range = [1, 2, 4, 8, 16, 32] #,64] #,128,256] # in ns / iteration ytick_names = ['1', '2', '4', '8', '16', '32'] #,'64'] #,'128','256'] p1.xaxis.set_major_locator(plt.NullLocator()) p1.xaxis.set_minor_locator(plt.NullLocator()) plt.xticks(xtick_range, xtick_names, rotation='-30', size='small') # p1.yaxis.set_major_locator( plt.NullLocator() ) # p1.yaxis.set_minor_locator( plt.NullLocator() ) # plt.yticks(ytick_range,ytick_names) fig.subplots_adjust(top=0.95, bottom=0.12, left=0.06, right=0.90, wspace=0, hspace=0) # legend print "Adding Legend..." colors = ('b', 'g', 'r', 'c', 'm', 'y', 'k') legend_sz = len(data["AppSize"]) / num_datapoints lines = [] for i in reversed(range(legend_sz)): lines.append( plt.Line2D([0, 10], [0, 10], linewidth=3, color=colors[i % len(colors)])) args = range(legend_sz) for i in range(legend_sz): args[legend_sz - i - 1] = data["AppSize"][(i * num_datapoints)] font = FontProperties(size='small') plt.legend(lines, args, 'upper right', title="Array \n Size (KB)", prop=font, bbox_to_anchor=(1.12, 0.95)) # customize figure title and other doodads based on the processor the test was run on if (ccbench.PROCESSOR == "merom"): plt.title("Intel Core 2 Duo T7600 (Merom)" + r'', fontstyle='italic') if (ccbench.PROCESSOR == "tegra2"): plt.title("Tegra 2 (ARM Cortex-A9)" + r'', fontstyle='italic') elif (ccbench.PROCESSOR == "tilera"): plt.title("TilePro64 (Default malloc behavior)" + r'', fontstyle='italic') elif (ccbench.PROCESSOR == "tilera-l3"): plt.title("TilePro64 (using 'Hash-for-Home')" + r'', fontstyle='italic') else: plt.title("Cache Hierarchy" + r'', fontstyle='italic') #plt.title("Intel Core i7 640M (Arrandale)" + r'', fontstyle='italic') #plt.title("Intel Core i7 975 Extreme Edition" + r'', fontstyle='italic') if (ccbench.PLOT_FILENAME == "none"): filename = APP + "_" + ccbench.PROCESSOR else: filename = ccbench.PLOT_FILENAME plt.savefig(PLOT_DIR + filename) print "Finished Plotting, saved as file '" + PLOT_DIR + filename + ".pdf'"
def main(): ccbench.controller() # handle CLI options #handle default/cli args app app_bin = BASE_DIR + APP input_filename = BASE_DIR + DEFAULT_INPUT_NAME report_filename = REPORT_DIR + DEFAULT_REPORT_NAME # 1. Parse inputs.txt file if (not ccbench.NORUN): inputs = ccbench.parseInputFile(input_filename, input_variables, ccbench.INPUT_TYPE) inputs["NumDataPointsPerSet"] = [] inputs["NumDataPointsPerSet"].append(str(len(inputs["AppSize"]))) # Build up the arguments list for each invocation of the benchmark. # This is done here, instead of in ccbench.py, because this is custom to each app. app_args_list = [] for num_requests in inputs["NumRequests"]: for app_size in inputs["AppSize"]: app_args_list.append(str(num_requests) + " " + str(app_size) \ + " " + str(inputs["NumIterations"][0])) # 2. Execute the benchmark and read the report file if (not ccbench.NORUN): ccbench.runBenchmark(app_bin, app_args_list, inputs, input_variables, report_filename) # 3. Extract Data data = ccbench.readReportFile(report_filename, variables) # 4. Plot the Data #print data if NOPLOT: return fig = plt.figure(figsize=(9, 5.5)) p1 = fig.add_subplot(1, 1, 1) print "Plotting time..." num_datapoints = int(data["NumDataPointsPerSet"][0]) # let's convert "appsizearg(#elm)" to "appsize(KB)" for i in range(len(data["AppSize"])): data["AppSize"][i] = str(float(data["AppSize"][i]) * 4 / 1024) # deal with ticks xtick_range = [ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 4096 * 2, 16384 ] #for KB xtick_names = [ '1 kB', '2 kB', '4 kB', '8 kB', '16 kB', '32 kB', '64 kB', '128 kB', '256 kB', '512 kB', '1 MB', '2 MB', '4 MB', '8 MB', '16 MB' ] #for KB xmin, xmax = plt.xlim() print "xmax = %d" % (xmax) # if (xmax >= 1024*32): xtick_range = [ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 4096 * 2, 16384, 16384 * 2, 16384 * 4, 1024 * 128 ] xtick_names = [ '1 kB', '2 kB', '4 kB', '8 kB', '16 kB', '32 kB', '64 kB', '128 kB', '256 kB', '512 kB', '1 MB', '2 MB', '4 MB', '8 MB', '16 MB', '32 MB', '64 MB', '128 MB' ] #for KB plt.xlim((0.5, 1024 * 128)) fig.subplots_adjust(top=0.95, bottom=0.12, left=0.07, right=0.90, wspace=0, hspace=0) for i in range(len(data["AppSize"]) / num_datapoints): srt_idx = i * num_datapoints end_idx = (i + 1) * num_datapoints p1.plot( data["AppSize"][srt_idx:end_idx - 1], # data["Time"][srt_idx:end_idx-1], data["Bandwidth"][srt_idx:end_idx - 1], linestyle='--', marker='.') p1.set_xscale('log') # plt.ylabel(data["TimeUnits"][0]) plt.ylabel(data["BandwidthUnits"][0]) plt.xlabel('Array Size') ymin, ymax = plt.ylim() plt.ylim((0.0, ymax)) plt.xlim((0.5, 16384)) p1.xaxis.set_major_locator(plt.NullLocator()) p1.xaxis.set_minor_locator(plt.NullLocator()) plt.xticks(xtick_range, xtick_names, rotation='-30', size='small') # figure out y location of text labels normally you can use normalize # coords, except i want to specify the x location exactly :/ ylabel = 0 # for datum in data["Time"]: for datum in data["Bandwidth"]: if (ylabel < 1.02 * float(datum)): ylabel = 1.02 * float(datum) # customize figure title and other doodads based on the processor the test was run on if (ccbench.PROCESSOR == "merom"): p1.axvline(x=32, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.axvline(x=4196, ymin=0.05, ymax=.9, linestyle='--', color='black') plt.title("Intel Core 2 Duo T7600 (Merom)" + r'', fontstyle='italic') p1.text(4, ylabel, "32 kB", horizontalalignment='center') p1.text(512, ylabel, "4 MB", horizontalalignment='center') p1.text(8 * 1024, ylabel, "off-chip", horizontalalignment='center') if (ccbench.PROCESSOR == "tegra2"): p1.axvline(x=32, ymin=0.05, ymax=.9, linestyle='--', color='black') plt.title("Tegra 2 (ARM Cortex-A9) Dual-core" + r'', fontstyle='italic') p1.text(4, ylabel, "32 kB", horizontalalignment='center') p1.text(8 * 1024, ylabel, "off-chip", horizontalalignment='center') elif (ccbench.PROCESSOR == "tilera"): plt.title("TilePro64 (Default malloc behavior)" + r'', fontstyle='italic') p1.text(4, ylabel, "8 kB", horizontalalignment='center', verticalalignment='center') p1.text(512, ylabel, "64 MB", horizontalalignment='center', verticalalignment='center') p1.text(16 * 1024, ylabel, "off-chip", horizontalalignment='center', verticalalignment='center') elif (ccbench.PROCESSOR == "tilera-l3"): plt.title("TilePro64 (using 'Hash-for-Home')" + r'', fontstyle='italic') p1.text(4, ylabel, "8 kB", horizontalalignment='center', verticalalignment='center') p1.text(32, ylabel, "64 kB", horizontalalignment='center', verticalalignment='center') p1.text(2048, ylabel, "4 MB", horizontalalignment='center', verticalalignment='center') p1.text(16 * 1024, ylabel, "off-chip", horizontalalignment='center', verticalalignment='center') elif (ccbench.PROCESSOR == "boxboro"): plt.title("Intel Xeon E7 -x8xx-series (Westmere-EX), 10 core" + r'', fontstyle='italic') p1.axvline(x=32, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.axvline(x=256, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.axvline(x=1024 * 24, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.axvline(x=1024 * 96, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.text(8, 1.15e9, "L1 D-Cache", horizontalalignment='center', verticalalignment='center') p1.text(8, 1.1e9, "(32 kB)", horizontalalignment='center', verticalalignment='center') p1.text(90, 1.15e9, "L2 Cache", horizontalalignment='center', verticalalignment='center') p1.text(90, 1.1e9, "(256 kB)", horizontalalignment='center', verticalalignment='center') p1.text(1024 * 9 / 2, 1.15e9, "L3 Cache", horizontalalignment='center', verticalalignment='center') p1.text(1024 * 9 / 2, 1.1e9, "(24 MB)", horizontalalignment='center', verticalalignment='center') p1.text(1024 * 50, 1.15e9, "Socket", horizontalalignment='center', verticalalignment='center') p1.text(1024 * 50, 1.1e9, "(96 MB)", horizontalalignment='center', verticalalignment='center') p1.text(1024 * 228, 1.15e9, "Off-chip", horizontalalignment='center', verticalalignment='center') else: plt.title("Cache Hierarchy" + r'', fontstyle='italic') # legend colors = ('b', 'g', 'r', 'c', 'm', 'y', 'k', 'b', 'g', 'r', 'c', 'm') legend_sz = len(data["NumRequests"]) / num_datapoints lines = [] #for i in reversed(range(legend_sz)): for i in (range(legend_sz)): lines.append( plt.Line2D([0, 10], [0, 10], linewidth=3, color=colors[legend_sz - 1 - i])) args = range(legend_sz) for i in (range(legend_sz)): args[legend_sz - 1 - i] = data["NumRequests"][((i) * num_datapoints)] #legend_font= FontProperties() #legend_font.set_size('medium') #plt.legend(lines, args, 'best', title="Num of\nRequests", prop=legend_font) plt.legend(lines, args, 'best', title="Num of\nRequests", bbox_to_anchor=(1.12, 0.9)) if (ccbench.PLOT_FILENAME == "none"): filename = APP + "_" + ccbench.PROCESSOR else: filename = ccbench.PLOT_FILENAME plt.savefig(PLOT_DIR + filename) print "Finished Plotting, saved as file '" + PLOT_DIR + filename + ".pdf'"
def main(): ccbench.controller() # handle CLI options #handle default/cli args app app_bin = BASE_DIR + APP input_filename = BASE_DIR + DEFAULT_INPUT_NAME report_filename = REPORT_DIR + DEFAULT_REPORT_NAME # 1. Parse inputs.txt file if (not ccbench.NORUN): inputs = ccbench.parseInputFile(input_filename, input_variables, ccbench.INPUT_TYPE) inputs["NumDataPointsPerSet"] = [] inputs["NumDataPointsPerSet"].append(str(len(inputs["AppSize"]))) # Build up the arguments list for each invocation of the benchmark. # This is done here, instead of in ccbench.py, because this is custom to each app. app_args_list = [] for num_requests in inputs["NumRequests"]: for app_size in inputs["AppSize"]: app_args_list.append(str(num_requests) + " " + str(app_size) \ + " " + str(inputs["NumIterations"][0])) # 2. Execute the benchmark and read the report file if (not ccbench.NORUN): ccbench.runBenchmark(app_bin, app_args_list, inputs, input_variables, report_filename) # 3. Extract Data data = ccbench.readReportFile(report_filename, variables) # 4. Plot the Data #print data if NOPLOT: return fig = plt.figure(figsize=(9,5.5)) p1 = fig.add_subplot(1,1,1) print "Plotting time..." num_datapoints = int(data["NumDataPointsPerSet"][0]) # let's convert "appsizearg(#elm)" to "appsize(KB)" for i in range(len(data["AppSize"])): data["AppSize"][i] = str(float(data["AppSize"][i]) * 4 / 1024) # deal with ticks xtick_range = [1,2,4,8,16,32,64,128,256,512,1024,2048,4096,4096*2,16384] #for KB xtick_names = ['1 kB','2 kB','4 kB','8 kB','16 kB','32 kB','64 kB','128 kB','256 kB','512 kB','1 MB','2 MB','4 MB','8 MB','16 MB'] #for KB xmin,xmax = plt.xlim() print "xmax = %d" % (xmax) # if (xmax >= 1024*32): xtick_range = [1,2,4,8,16,32,64, 128,256, 512,1024,2048,4096,4096*2, 16384,16384*2,16384*4,1024*128] xtick_names = ['1 kB','2 kB','4 kB','8 kB','16 kB','32 kB','64 kB','128 kB','256 kB','512 kB','1 MB','2 MB','4 MB','8 MB','16 MB','32 MB','64 MB','128 MB'] #for KB plt.xlim((0.5,1024*128)) fig.subplots_adjust(top=0.95, bottom=0.12, left=0.07, right=0.90,wspace=0, hspace=0) for i in range(len(data["AppSize"])/num_datapoints): srt_idx = i*num_datapoints end_idx = (i+1)*num_datapoints p1.plot( data["AppSize"][srt_idx:end_idx-1], # data["Time"][srt_idx:end_idx-1], data["Bandwidth"][srt_idx:end_idx-1], linestyle='--', marker='.' ) p1.set_xscale('log') # plt.ylabel(data["TimeUnits"][0]) plt.ylabel(data["BandwidthUnits"][0]) plt.xlabel('Array Size') ymin, ymax = plt.ylim() plt.ylim((0.0, ymax)) plt.xlim((0.5, 16384)) p1.xaxis.set_major_locator( plt.NullLocator() ) p1.xaxis.set_minor_locator( plt.NullLocator() ) plt.xticks( xtick_range, xtick_names, rotation='-30', size='small' ) # figure out y location of text labels normally you can use normalize # coords, except i want to specify the x location exactly :/ ylabel = 0 # for datum in data["Time"]: for datum in data["Bandwidth"]: if (ylabel < 1.02*float(datum)): ylabel = 1.02*float(datum) # customize figure title and other doodads based on the processor the test was run on if (ccbench.PROCESSOR == "merom"): p1.axvline(x=32, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.axvline(x=4196, ymin=0.05, ymax=.9, linestyle='--', color='black') plt.title("Intel Core 2 Duo T7600 (Merom)" + r'', fontstyle='italic') p1.text(4, ylabel,"32 kB", horizontalalignment='center') p1.text(512, ylabel,"4 MB", horizontalalignment='center') p1.text(8*1024, ylabel,"off-chip", horizontalalignment='center') if (ccbench.PROCESSOR == "tegra2"): p1.axvline(x=32, ymin=0.05, ymax=.9, linestyle='--', color='black') plt.title("Tegra 2 (ARM Cortex-A9) Dual-core" + r'', fontstyle='italic') p1.text(4, ylabel,"32 kB", horizontalalignment='center') p1.text(8*1024, ylabel,"off-chip", horizontalalignment='center') elif (ccbench.PROCESSOR == "tilera"): plt.title("TilePro64 (Default malloc behavior)" + r'', fontstyle='italic') p1.text(4, ylabel,"8 kB", horizontalalignment='center',verticalalignment='center') p1.text(512, ylabel,"64 MB", horizontalalignment='center',verticalalignment='center') p1.text(16*1024, ylabel,"off-chip", horizontalalignment='center',verticalalignment='center') elif (ccbench.PROCESSOR == "tilera-l3"): plt.title("TilePro64 (using 'Hash-for-Home')" + r'', fontstyle='italic') p1.text(4, ylabel,"8 kB", horizontalalignment='center',verticalalignment='center') p1.text(32, ylabel,"64 kB", horizontalalignment='center',verticalalignment='center') p1.text(2048, ylabel,"4 MB", horizontalalignment='center',verticalalignment='center') p1.text(16*1024, ylabel,"off-chip", horizontalalignment='center',verticalalignment='center') elif (ccbench.PROCESSOR == "boxboro"): plt.title("Intel Xeon E7 -x8xx-series (Westmere-EX), 10 core" + r'', fontstyle='italic') p1.axvline(x=32, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.axvline(x=256, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.axvline(x=1024*24, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.axvline(x=1024*96, ymin=0.05, ymax=.9, linestyle='--', color='black') p1.text(8, 1.15e9,"L1 D-Cache", horizontalalignment='center',verticalalignment='center') p1.text(8, 1.1e9,"(32 kB)", horizontalalignment='center',verticalalignment='center') p1.text(90, 1.15e9,"L2 Cache", horizontalalignment='center',verticalalignment='center') p1.text(90, 1.1e9,"(256 kB)", horizontalalignment='center',verticalalignment='center') p1.text(1024*9/2,1.15e9,"L3 Cache", horizontalalignment='center',verticalalignment='center') p1.text(1024*9/2,1.1e9,"(24 MB)", horizontalalignment='center',verticalalignment='center') p1.text(1024*50, 1.15e9,"Socket", horizontalalignment='center',verticalalignment='center') p1.text(1024*50, 1.1e9,"(96 MB)", horizontalalignment='center',verticalalignment='center') p1.text(1024*228,1.15e9,"Off-chip", horizontalalignment='center',verticalalignment='center') else: plt.title("Cache Hierarchy" + r'', fontstyle='italic') # legend colors =('b','g','r','c','m','y','k','b','g','r','c','m') legend_sz = len(data["NumRequests"])/num_datapoints lines = [] #for i in reversed(range(legend_sz)): for i in (range(legend_sz)): lines.append(plt.Line2D([0,10], [0,10], linewidth=3, color=colors[legend_sz-1-i])) args = range(legend_sz) for i in (range(legend_sz)): args[legend_sz - 1 - i] = data["NumRequests"][((i)*num_datapoints)] #legend_font= FontProperties() #legend_font.set_size('medium') #plt.legend(lines, args, 'best', title="Num of\nRequests", prop=legend_font) plt.legend(lines, args, 'best', title="Num of\nRequests", bbox_to_anchor=(1.12, 0.9)) if (ccbench.PLOT_FILENAME == "none"): filename = APP + "_" + ccbench.PROCESSOR else: filename = ccbench.PLOT_FILENAME plt.savefig(PLOT_DIR + filename) print "Finished Plotting, saved as file '" + PLOT_DIR + filename + ".pdf'"
def main(): ccbench.controller() # handle CLI options #handle default/cli args app app_bin = BASE_DIR + APP input_filename = BASE_DIR + DEFAULT_INPUT_NAME report_filename = REPORT_DIR + ccbench.getReportFileName(APP, REPORT_DIR) # 1. Parse inputs.txt file if (not ccbench.NORUN): inputs = ccbench.parseInputFile(input_filename, input_variables, ccbench.INPUT_TYPE) inputs["NumDataPointsPerSet"] = [] inputs["NumDataPointsPerSet"].append(str(len(inputs["AppSize"]))) # Build up the arguments list for each invocation of the benchmark. # This is done here, instead of in ccbench.py, because this is custom to each app. app_args_list = [] for num_requests in inputs["NumRequests"]: for app_size in inputs["AppSize"]: app_args_list.append(str(num_requests) + " " + str(app_size) \ + " " + str(inputs["NumIterations"][0])) # 2. Execute the benchmark and read the report file if (not ccbench.NORUN): ccbench.runBenchmark(app_bin, app_args_list, inputs, input_variables, report_filename) # 3. Extract Data data = ccbench.readReportFile(report_filename, variables) # 4. Plot the Data #print data if NOPLOT: return if PLOT_POSTER: fig = plt.figure(figsize=(5,3.5)) font = {#'family' : 'normal', #'weight' : 'bold', 'size' : 8} matplotlib.rc('font', **font) fig.subplots_adjust(top=0.94, bottom=0.14, left=0.09, right=0.91,wspace=0, hspace=0) else: fig = plt.figure(figsize=(9,5.5)) fig.subplots_adjust(top=0.95, bottom=0.12, left=0.07, right=0.90,wspace=0, hspace=0) p1 = fig.add_subplot(1,1,1) print "Plotting time..." num_datapoints = int(data["NumDataPointsPerSet"][0]) # let's convert "appsizearg(#elm)" to "appsize(KB)" for i in range(len(data["AppSize"])): data["AppSize"][i] = str(float(data["AppSize"][i]) * 4 / 1024) # deal with ticks xtick_range = [1,2,4,8,16,32,64,128,256,512,1024,2048,4096,4096*2,16384] #for KB xtick_names = ['1 kB','2 kB','4 kB','8 kB','16 kB','32 kB','64 kB','128 kB','256 kB','512 kB','1 MB','2 MB','4 MB','8 MB','16 MB'] #for KB xmin,xmax = plt.xlim() # print "xmax = %d" % (xmax) # if (xmax >= 1024*32): xtick_range = [1,2,4,8,16,32,64, 128,256, 512,1024,2048,4096,4096*2, 16384,16384*2,16384*4,1024*128] xtick_names = ['1 kB','2 kB','4 kB','8 kB','16 kB','32 kB','64 kB','128 kB','256 kB','512 kB','1 MB','2 MB','4 MB','8 MB','16 MB','32 MB','64 MB','128 MB'] #for KB plt.xlim((0.5,1024*128)) for i in range(len(data["AppSize"])/num_datapoints): srt_idx = i*num_datapoints end_idx = (i+1)*num_datapoints p1.plot( data["AppSize"][srt_idx:end_idx-1], data["Bandwidth"][srt_idx:end_idx-1], linestyle='--', marker='.' ) p1.set_xscale('log') plt.ylabel(data["BandwidthUnits"][0]) plt.xlabel('Array Size') ymin, ymax = plt.ylim() print "ymax = %f" % ymax if (ccbench.PROCESSOR == "tegra2" or ccbench.ARCHITECTURE == "arm" or ccbench.ARCHITECTURE == "riscv"): plt.ylim((0.0, ymax)) else: plt.ylim((0.0, 2.5e9)) plt.xlim((0.5, 16384)) p1.xaxis.set_major_locator( plt.NullLocator() ) p1.xaxis.set_minor_locator( plt.NullLocator() ) plt.xticks( xtick_range, xtick_names, rotation='-30', size='small' ) # figure out y location of text labels normally you can use normalize # coords, except i want to specify the x location exactly :/ ylow = 0 for datum in data["Bandwidth"]: if (ylow < 1.02*float(datum)): ylow = 1.02*float(datum) (ylow,yhigh) = plt.ylim() yhigh = 0.95*yhigh ylow = 0.95*yhigh ccprocstats.plotCacheSizeLines(plt, p1, ccbench.PROCESSOR, ylow, yhigh) # legend colors =('b','g','r','c','m','y','k','b','g','r','c','m') legend_sz = len(data["NumRequests"])/num_datapoints lines = [] #for i in reversed(range(legend_sz)): for i in (range(legend_sz)): lines.append(plt.Line2D([0,10], [0,10], linewidth=3, color=colors[legend_sz-1-i])) args = range(legend_sz) for i in (range(legend_sz)): args[legend_sz - 1 - i] = data["NumRequests"][((i)*num_datapoints)] #legend_font= FontProperties() #legend_font.set_size('medium') #plt.legend(lines, args, 'best', title="Num of\nRequests", prop=legend_font) plt.legend(lines, args, 'best', title="Num of\nRequests", bbox_to_anchor=(1.12, 0.9)) if (ccbench.PLOT_FILENAME == "none"): filename = PLOT_DIR + ccbench.generatePlotFileName(APP) else: # Pull out the filename path from the full path. # This allows us to pull out the requested filename from the path presented # (since we always write reports to the report directory, etc.). However, it # allows the user to use tab-completion to specify the exact reportfile he # wants to use. filename = PLOT_DIR + os.path.basename(ccbench.PLOT_FILENAME) filename = os.path.splitext(filename)[0] plt.savefig(filename) print "Used report filename : " + report_filename print "Finished Plotting, saved as file : " + filename + ".pdf"