This repository has been archived by the owner on Apr 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcorrelation.script
42 lines (36 loc) · 1.5 KB
/
correlation.script
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
#!/bin/bash
echo "~~~~ NEW RUN ~~~~"
echo "Compiling the original program - serial version"
gcc -O0 -I include -DPOLYBENCH_TIME -DPOLYBENCH_DUMP_ARRAYS src/polybench.c src/correlation.c -o correlation.serial -lm
echo "Running serial version: $(./correlation.serial 2> correlation.data.serial)"
gcc -O0 -I include -DPOLYBENCH_TIME src/polybench.c src/correlation.c -o correlation.serial -lm
echo "Running 5 times the original correlation program"
for i in {1..5}
do
echo "$i :$(./correlation.serial)"
done
echo "Compiling the parallelized version of program with -fopenmp flag"
gcc -O0 -I include -DPOLYBENCH_TIME -DPOLYBENCH_DUMP_ARRAYS src/polybench.c src/correlation.c -o correlation.serial -lm -fopenmp
echo "Running the parallelized program with DUMP ARRAY to get the output to later compare with the original"
for i in {1,2,4,8}
do
echo "Threads: $i"
OMP_NUM_THREADS="$i" ./correlation.serial 2> correlation.data.serial.fopenmp"$i"
done
echo "Comparing output of threads with output from serial using diff command:"
for i in {1,2,4,8}
do
echo "Serial - OpenMP $i Thread"
diff correlation.data.serial correlation.data.serial.fopenmp"$i"
done
echo "Compile the parallelized version of program with -fopenmp flag"
gcc -O0 -I include -DPOLYBENCH_TIME src/polybench.c src/correlation.c -o correlation.serial -lm -fopenmp
echo "Running the parallelized program to get the execution time report"
for i in {1,2,4,8}
do
for j in {1..5}
do
echo "Thread: $i | Loop: $j"
OMP_NUM_THREADS="$i" ./correlation.serial
done
done