Skip to content

Commit bcd68ef

Browse files
committed
add build script
1 parent c6211ec commit bcd68ef

File tree

3 files changed

+39
-27
lines changed

3 files changed

+39
-27
lines changed

benchmarks/benchmark.sh

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,7 @@ cd .. || exit
1212

1313
# === Build project ===
1414
echo "Building mandelbrot benchmark"
15-
16-
source /opt/intel/oneapi/setvars.sh
17-
18-
if [ ! -d "build" ]; then
19-
mkdir build
20-
fi
21-
22-
# Change to build directory
23-
cd build || exit
24-
25-
# Run cmake
26-
cmake ..
27-
28-
# Compile files
29-
make -j
15+
bash build.sh # run build script
3016

3117
# Change back to root directory
3218
cd .. || exit

benchmarks/generate_plots.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
def read_metrics(filename):
1212
return pd.read_csv(filename)
1313

14-
def scatter_algos(data, output_file):
15-
1614

15+
def scatter_algos(data, output_file):
1716
# Create a figure for subplots
1817
fig, axs = plt.subplots(1, len(data["algo"].unique()), figsize=(15, 15))
1918
fig.tight_layout(pad=2.0)
@@ -22,13 +21,13 @@ def scatter_algos(data, output_file):
2221
for i, category in enumerate(data["algo"].unique()):
2322
ax = axs[i]
2423
for type_ in data["options"].unique():
25-
24+
2625
# Filter the data based on category and type
2726
filtered_data = data[(data["options"] == type_) & (data["algo"] == category)]
28-
27+
2928
# Plot the scatter plot for this category and type
3029
ax.scatter(filtered_data['threads'], filtered_data['time'], label=f'{type_[1:]}')
31-
30+
3231
# Set labels and title
3332
ax.set_xlabel('Threads')
3433
ax.set_ylabel('Time')
@@ -39,16 +38,17 @@ def scatter_algos(data, output_file):
3938
plt.savefig(output_file)
4039
plt.close(fig)
4140

41+
4242
def scatter_options(data, output_file):
4343
fig, axs = plt.subplots(1, len(data["options"].unique()), figsize=(15, 15))
4444
fig.tight_layout(pad=2.0)
4545
for i, type_ in enumerate(data["options"].unique()):
4646
ax = axs[i]
4747
for category in data["algo"].unique():
48-
48+
4949
# Filter the data based on category and type
5050
filtered_data = data[(data["options"] == type_) & (data["algo"] == category)]
51-
51+
5252
# Plot the scatter plot for this category and type
5353
ax.scatter(filtered_data['threads'], filtered_data['time'], label=f'{category}')
5454

@@ -61,7 +61,7 @@ def scatter_options(data, output_file):
6161

6262
plt.savefig(output_file)
6363
plt.close(fig)
64-
64+
6565

6666
def boxplots(data, output_file):
6767
num_threads = data["threads"].unique()
@@ -71,7 +71,7 @@ def boxplots(data, output_file):
7171
fig.tight_layout(pad=5.0)
7272
for x, algo in enumerate(algos):
7373
for y, option in enumerate(options):
74-
ax = axs[x,y]
74+
ax = axs[x, y]
7575
filtered_data = []
7676
for num_thread in num_threads:
7777
filtered_data.append(data[(data["algo"] == algo) & (data["options"] == option) & (data["threads"] == num_thread)]["time"])
@@ -86,7 +86,6 @@ def boxplots(data, output_file):
8686
plt.close(fig)
8787

8888

89-
9089
# Plot performance vs threads
9190
def plot_performance(data, output_file):
9291
plt.figure(figsize=(10, 6))
@@ -179,8 +178,7 @@ def plot_efficiency(data, output_file):
179178
if not os.path.exists(args.output_dir):
180179
os.makedirs(args.output_dir)
181180

182-
183-
data[['algo', 'options']] = data['file'].str.rsplit('_', n=1, expand=True)
181+
data[['algo', 'options']] = data['file'].str.rsplit('_', n=1, expand=True)
184182

185183
# Create graphs
186184
plot_performance(

build.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Script to build the project
5+
6+
source /opt/intel/oneapi/setvars.sh
7+
8+
# Check if script is run from root directory
9+
if [ ! -f "main.cpp" ]; then
10+
echo "Please run this script from the root directory"
11+
exit 1
12+
fi
13+
14+
# Check if build directory exists
15+
if [ -d "build" ]; then
16+
rm -r build
17+
fi
18+
19+
mkdir build
20+
21+
# Change to build directory
22+
cd build || exit
23+
24+
# Run cmake
25+
cmake ..
26+
27+
# Compile files
28+
make -j

0 commit comments

Comments
 (0)