-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.sh
executable file
·65 lines (58 loc) · 2.29 KB
/
script.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
ITERATIONS=5
seq_file_output="seq_results.txt"
par_naive_file_output="par_naive_results.txt"
par_optim_file_output="par_optim_results.txt"
num_threads=4
# Run the Makefile to compile everything
make
# Run sequential algorithm, print info to file
# Clear the results file first, if it exists
rm -f ${seq_file_output}
# "echo" commands print some text to the screen, and
# the ">>" redirects the output to a file and appends the text
# A plain "echo" command with no text will just print a new line
echo "===== Sequential =====" >> ${seq_file_output}
# Vary the number of vertices --> add more data points here
for num_vertices in 256 512 1024
do
echo >> ${seq_file_output}
# Run multiple iterations for each experiment, so we can take the average
for it in $(seq 1 $ITERATIONS)
do
echo "N_V = ${num_vertices} ITERATION${it}" >> ${seq_file_output}
echo "Command: ./seq ${num_vertices}" >> ${seq_file_output}
./seq ${num_vertices} >> ${seq_file_output}
done
done
# Run naive parallel algorithm, print info to file
# Clear the results file first, if it exists
rm -f ${par_naive_file_output}
echo "===== Naive parallel =====" >> ${par_naive_file_output}
# Vary the number of vertices --> add more data points here
for num_vertices in 256 512 1024
do
echo >> ${par_naive_file_output}
# Run multiple iterations for each experiment, so we can take the average
for it in $(seq 1 $ITERATIONS)
do
echo "N_V = ${num_vertices} ITERATION${it}" >> ${par_naive_file_output}
echo "Command: ./par-naive ${num_vertices} ${num_threads}" >> ${par_naive_file_output}
./par-naive ${num_vertices} ${num_threads} >> ${par_naive_file_output}
done
done
# Run optimized parallel algorithm, print info to file
# Clear the results file first, if it exists
rm -f ${par_optim_file_output}
echo "===== Optimized parallel =====" >> ${par_optim_file_output}
# Vary the number of vertices --> add more data points here
for num_vertices in 256 512 1024
do
echo >> ${par_optim_file_output}
# Run multiple iterations for each experiment, so we can take the average
for it in $(seq 1 $ITERATIONS)
do
echo "N_V = ${num_vertices} ITERATION${it}" >> ${par_optim_file_output}
echo "Command: ./par-optim ${num_vertices} ${num_threads}" >> ${par_optim_file_output}
./par-optim ${num_vertices} ${num_threads} >> ${par_optim_file_output}
done
done