diff --git a/util/README.md b/util/README.md index 25f250b..957b6ef 100644 --- a/util/README.md +++ b/util/README.md @@ -10,9 +10,7 @@ The configuration parameters are: - **-ny :** number of unit cells in the y dimension, the default is 4. - **-nz :** number of unit cells in the z dimension, the default is 2. -Notice that these parameters can also be specified as lists, which executes the stubbed force calculation several times varying the specific parameter to each element of the list. -All combinations of parameters are executed! -For example, the following command: +Notice that these parameters can also be specified as lists, which executes the stubbed force calculation several times varying the specific parameter to each element of the list, and hence all combinations of parameters will be executed. For example, the following command: ```bash bash run_stub.sh -a "8 16" -nx "4 8" -ny 8 -nz 4 @@ -33,3 +31,7 @@ The following parameters are also available: - **-r :** number of runs for each configuration (only the values for the best run are displayed), the default is 3. **plot_run_stub_data.py:** Python script to plot the data generated by the *run_stub.sh* script. Just provide the name of the .txt file as a parameter and this script generates a corresponding PDF with the same file name. + +**plot_gather_data.py:** Python script to plot the data generated by the gather benchmark. Just provide the name of the .txt file containing the gather output as a parameter and this script generates a corresponding PDF with the same file name. Multiple outputs with different strides can be included in the text file by concatenating the outputs. The script handles output from both standard simple array case and MD variant. + +**cache.py:** Python script to run the cache simulator with the data obtained from the memory tracer. Just run it with the tracer output file name as a parameter. The cache specifications can be directly adapted in the script to match those of the target processor of interest. diff --git a/util/plot_gather_data.py b/util/plot_gather_data.py index 8e778b7..5744933 100644 --- a/util/plot_gather_data.py +++ b/util/plot_gather_data.py @@ -2,7 +2,8 @@ import matplotlib.pyplot as plt import sys filename = sys.argv[1] -output_file = filename.replace(".txt", ".pdf") +plot_output_file = filename.replace(".txt", ".pdf") +raw_output_file = filename.replace(".txt", ".csv") fig = plt.figure() ax = plt.axes() plot_data = {} @@ -20,7 +21,7 @@ with open(filename, 'r') as fp: for line in fp.readlines(): line = line.strip() - if len(line) <= 0: + if len(line) <= 0 or "likwid-pin" in line: continue if line.startswith("Stride,"): @@ -57,12 +58,43 @@ with open(filename, 'r') as fp: plot_data[stride][size] = cycles if size not in plot_data[stride] \ else min(cycles, plot_data[stride][size]) +all_sizes = set() +all_strides = set() for stride in plot_data: sizes = list(plot_data[stride].keys()) sizes.sort() cycles = [plot_data[stride][size] for size in sizes] ax.plot(sizes, cycles, marker='.', label=str(stride)) + for size in sizes: + all_sizes.add(size) + + all_strides.add(stride) + +all_sizes = list(all_sizes) +all_sizes.sort() +all_strides= list(all_strides) +all_strides.sort() +with open(raw_output_file, 'w') as wp: + wp.write(" size\stride") + + for stride in all_strides: + wp.write(",{0:14}".format(stride)) + + wp.write("\n") + + for size in all_sizes: + wp.write("{:14.6f}".format(size)) + for stride in all_strides: + try: + cycles = plot_data[stride][size] + except: + cycles = '' + + wp.write(",{:14.6f}".format(cycles)) + + wp.write("\n") + cy_label = "Cycles per iteration" if md_case else "Cycles per gather" ax.vlines([32, 1000], 0, 1, transform=ax.get_xaxis_transform(), linestyles='dashed', color=['#444444', '#777777']) #ax.vlines([32, 1000, 28000], 0, 1, transform=ax.get_xaxis_transform(), linestyles='dashed', color=['#444444', '#777777', '#aaaaaa']) @@ -71,4 +103,4 @@ ax.set_xscale('log') #ax.set_xticks([32, 1000, 28000]) #ax.set_xlim(0, 200000) plt.legend(title="Stride") -fig.savefig(output_file, bbox_inches = 'tight', pad_inches = 0) +fig.savefig(plot_output_file, bbox_inches = 'tight', pad_inches = 0)