Skip to content

Commit

Permalink
add build script
Browse files Browse the repository at this point in the history
  • Loading branch information
gwauge committed Dec 6, 2024
1 parent c6211ec commit bcd68ef
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 27 deletions.
16 changes: 1 addition & 15 deletions benchmarks/benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 10 additions & 12 deletions benchmarks/generate_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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')
Expand All @@ -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}')

Expand All @@ -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()
Expand All @@ -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"])
Expand All @@ -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))
Expand Down Expand Up @@ -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(
Expand Down
28 changes: 28 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bcd68ef

Please sign in to comment.