diff --git a/benchmarks/benchmark.sh b/benchmarks/benchmark.sh index 766e1ab..d95f3a4 100755 --- a/benchmarks/benchmark.sh +++ b/benchmarks/benchmark.sh @@ -12,21 +12,7 @@ cd .. || exit # === Build project === echo "Building mandelbrot benchmark" - -source /opt/intel/oneapi/setvars.sh - -if [ ! -d "build" ]; then - mkdir build -fi - -# Change to build directory -cd build || exit - -# Run cmake -cmake .. - -# Compile files -make -j +bash build.sh # run build script # Change back to root directory cd .. || exit diff --git a/benchmarks/generate_plots.py b/benchmarks/generate_plots.py index bdc3d18..12ca507 100755 --- a/benchmarks/generate_plots.py +++ b/benchmarks/generate_plots.py @@ -11,9 +11,8 @@ def read_metrics(filename): return pd.read_csv(filename) -def scatter_algos(data, output_file): - +def scatter_algos(data, output_file): # Create a figure for subplots fig, axs = plt.subplots(1, len(data["algo"].unique()), figsize=(15, 15)) fig.tight_layout(pad=2.0) @@ -22,13 +21,13 @@ def scatter_algos(data, output_file): for i, category in enumerate(data["algo"].unique()): ax = axs[i] for type_ in data["options"].unique(): - + # Filter the data based on category and type filtered_data = data[(data["options"] == type_) & (data["algo"] == category)] - + # Plot the scatter plot for this category and type ax.scatter(filtered_data['threads'], filtered_data['time'], label=f'{type_[1:]}') - + # Set labels and title ax.set_xlabel('Threads') ax.set_ylabel('Time') @@ -39,16 +38,17 @@ def scatter_algos(data, output_file): plt.savefig(output_file) plt.close(fig) + def scatter_options(data, output_file): fig, axs = plt.subplots(1, len(data["options"].unique()), figsize=(15, 15)) fig.tight_layout(pad=2.0) for i, type_ in enumerate(data["options"].unique()): ax = axs[i] for category in data["algo"].unique(): - + # Filter the data based on category and type filtered_data = data[(data["options"] == type_) & (data["algo"] == category)] - + # Plot the scatter plot for this category and type ax.scatter(filtered_data['threads'], filtered_data['time'], label=f'{category}') @@ -61,7 +61,7 @@ def scatter_options(data, output_file): plt.savefig(output_file) plt.close(fig) - + def boxplots(data, output_file): num_threads = data["threads"].unique() @@ -71,7 +71,7 @@ def boxplots(data, output_file): fig.tight_layout(pad=5.0) for x, algo in enumerate(algos): for y, option in enumerate(options): - ax = axs[x,y] + ax = axs[x, y] filtered_data = [] for num_thread in num_threads: filtered_data.append(data[(data["algo"] == algo) & (data["options"] == option) & (data["threads"] == num_thread)]["time"]) @@ -86,7 +86,6 @@ def boxplots(data, output_file): plt.close(fig) - # Plot performance vs threads def plot_performance(data, output_file): plt.figure(figsize=(10, 6)) @@ -179,8 +178,7 @@ def plot_efficiency(data, output_file): if not os.path.exists(args.output_dir): os.makedirs(args.output_dir) - - data[['algo', 'options']] = data['file'].str.rsplit('_', n=1, expand=True) + data[['algo', 'options']] = data['file'].str.rsplit('_', n=1, expand=True) # Create graphs plot_performance( diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..d848704 --- /dev/null +++ b/build.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -e + +# Script to build the project + +source /opt/intel/oneapi/setvars.sh + +# Check if script is run from root directory +if [ ! -f "main.cpp" ]; then + echo "Please run this script from the root directory" + exit 1 +fi + +# Check if build directory exists +if [ -d "build" ]; then + rm -r build +fi + +mkdir build + +# Change to build directory +cd build || exit + +# Run cmake +cmake .. + +# Compile files +make -j