This repository has been archived by the owner on Feb 2, 2022. It is now read-only.
forked from sysprog21/compute-pi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (46 loc) · 1.94 KB
/
Makefile
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
CC = gcc
CFLAGS = -O0 -std=gnu99 -Wall -fopenmp -mavx
EXECUTABLE = \
time_test_baseline time_test_baseline_plus time_test_openmp_2 \
time_test_openmp_2_plus time_test_openmp_4 time_test_openmp_4_plus\
time_test_avx time_test_avxunroll \
benchmark_clock_gettime benchmark_error_rate
default: computepi.o
$(CC) $(CFLAGS) computepi.o time_test.c -DBASELINE_PLUS -o time_test_baseline_plus
$(CC) $(CFLAGS) computepi.o time_test.c -DOPENMP_2_PLUS -o time_test_openmp_2_plus
$(CC) $(CFLAGS) computepi.o time_test.c -DOPENMP_4_PLUS -o time_test_openmp_4_plus
$(CC) $(CFLAGS) computepi.o time_test.c -DBASELINE -o time_test_baseline
$(CC) $(CFLAGS) computepi.o time_test.c -DOPENMP_2 -o time_test_openmp_2
$(CC) $(CFLAGS) computepi.o time_test.c -DOPENMP_4 -o time_test_openmp_4
$(CC) $(CFLAGS) computepi.o time_test.c -DAVX -o time_test_avx
$(CC) $(CFLAGS) computepi.o time_test.c -DAVXUNROLL -o time_test_avxunroll
$(CC) $(CFLAGS) computepi.o benchmark_clock_gettime.c -o benchmark_clock_gettime
$(CC) $(CFLAGS) computepi.o benchmark_error_rate.c -o benchmark_error_rate
.PHONY: clean default
%.o: %.c
$(CC) -c $(CFLAGS) $< -o $@
check: default
time ./time_test_baseline
time ./time_test_openmp_2
time ./time_test_openmp_4
time ./time_test_baseline_plus
time ./time_test_openmp_2_plus
time ./time_test_openmp_4_plus
time ./time_test_avx
time ./time_test_avxunroll
gencsv: default
echo "N baseline baselineP OMP2 OMP2P OMP4 OMP4P avx avx_{unroll}" > result_clock_gettime.csv
for i in `seq 5000 5000 200000`; do \
printf "%d " $$i;\
./benchmark_clock_gettime $$i; \
done >> result_clock_gettime.csv
echo "N baseline baselineP OMP2 OMP2P OMP4 OMP4P avx avx_{unroll}" > result_error_rate.csv
for i in `seq 5000 5000 200000`; do \
printf "%d " $$i;\
./benchmark_error_rate $$i; \
done >> result_error_rate.csv
plot: default gencsv
gnuplot runtime.gp
gnuplot errorrate.gp
clean:
rm -f $(EXECUTABLE) *.o *.s result_clock_gettime.csv result_error_rate.csv