forked from sysprog21/compute-pi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (45 loc) · 1.49 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
54
55
56
CC = gcc
CFLAGS = -O0 -std=gnu99 -Wall -fopenmp -mavx
EXECUTABLE = \
time_test_baseline time_test_openmp_2 time_test_openmp_4 \
time_test_avx time_test_avxunroll \
benchmark_clock_gettime
GIT_HOOKS := .git/hooks/pre-commit
$(GIT_HOOKS):
@scripts/install-git-hooks
@echo
default: $(GIT_HOOKS) computepi.o
$(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 -lm -o benchmark_clock_gettime
.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_avx
time ./time_test_avxunroll
gencsv: default
for i in `seq 100 1000 100100`; do \
printf "%d," $$i;\
./benchmark_clock_gettime $$i; \
done > result_clock_gettime.csv
plot: default
for i in `seq 1000 1000 51000`; do \
printf "%d " $$((i/1000));\
./benchmark_clock_gettime $$i; \
done > result_clock_gettime.csv
gnuplot scripts/runtime.gp
astyle:
astyle --style=kr --indent=spaces=4 --indent-switches --suffix=none *.[ch]
testprint:
for i in `seq 1000 1000 100000`; do \
printf "%d," $$((i/1000));\
done
clean:
rm -f $(EXECUTABLE) *.o *.s result_clock_gettime.csv