-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
148 lines (101 loc) · 3.01 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
CFLAGS=-Wall# -Werror
CFLAGS+=-DDSFMT_MEXP=521
CFLAGS+=${EXTRA_CFLAGS}
dSFMT_SRC=dSFMT-src-2.2.1
include cpu.mk
ifdef AVX
CFLAGS+= -march=corei7-avx -mavx
else
ifdef SSE2
CFLAGS+= -msse2
endif
endif
LDFLAGS=-lpthread
ifdef DEBUG
CFLAGS+= -g
else
CFLAGS+= -g -O3 -DNDEBUG -ffast-math
endif
ifdef CAP_BENCH
CFLAGS+= -DCAP_BENCH
endif
DEBUG_EXECUTABLES= test_sparse test_hist
EXECUTABLES=speed_sparse channel_matrix analyse capacity analyse_mat \
mult stride extract_plot sample_error channel_hist \
summarise filter_samples drop_samples row_average \
smooth
ifdef DEBUG
EXECUTABLES+= $(DEBUG_EXECUTABLES)
endif
SPARSE_OBJS= sparse.o
ifdef AVX
SPARSE_OBJS+= sparse_avx.o
EXECUTABLES+= mvec
endif
TESTS=test/matrix1
.PHONY: default test clean
default: ${EXECUTABLES}
cpu.mk:
./cpu_probe.sh
sparse.o: sparse.c sparse.h
testlib.o: testlib.c testlib.h
channel_algorithms.o: channel_algorithms.c channel_algorithms.h
test_sparse: test_sparse.o ${SPARSE_OBJS} testlib.o
test_sparse: LDFLAGS += -lrt
test_sparse.o: CFLAGS= -Wall -g -DDEBUG
speed_sparse: speed_sparse.o ${SPARSE_OBJS} testlib.o
speed_sparse: LDFLAGS += -lrt
channel_matrix: channel_matrix.o ${SPARSE_OBJS}
analyse: analyse.o ${SPARSE_OBJS}
analyse_mat: analyse_mat.o ${SPARSE_OBJS}
capacity: capacity.o channel_algorithms.o ${SPARSE_OBJS} log.o
capacity: LDFLAGS += -lm -lrt -lpthread
mvec: mvec.o
mvec: LDFLAGS+= -lrt
mult: mult.o ${SPARSE_OBJS}
mult: LDFLAGS+= -lrt
log_bench: log_bench.o log.o
log_bench: LDFLAGS+= -lrt -lm
sparse_linear.o: sparse_linear.c sparse_linear.h
mult_lin: mult_lin.o ${SPARSE_OBJS} sparse_linear.o
mult_lin: LDFLAGS+= -lrt
extract_plot: extract_plot.o ${SPARSE_OBJS}
stride: stride.o ${SPARSE_OBJS}
sample_error: LDFLAGS+= -lm -lrt -lpthread
sample_error: sample_error.o ${SPARSE_OBJS} channel_algorithms.o \
log.o ${dSFMT_SRC}/dSFMT.o
channel_hist: channel_hist.o ${SPARSE_OBJS}
test_hist: test_hist.o ${SPARSE_OBJS}
test_hist.o: CFLAGS= -Wall -g -DDEBUG
row_average: row_average.o ${SPARSE_OBJS}
### Tests
TEST_MATRICES=matrix1
HIST_TEST=matrix1
ifdef BIGMEM
# This matrix requires 2.5GB of memory to build, and roughly 2*ncores GB
# to simulate
TEST_MATRICES+= matrix2
endif
TEST_TARGETS= \
$(patsubst %,test/%.cm,${TEST_MATRICES}) \
$(patsubst %,test/%.plot,${TEST_MATRICES}) \
$(patsubst %,test/%.capacity,${TEST_MATRICES}) \
$(patsubst %,test/%.sim,${TEST_MATRICES})
HIST_TEST_TARGETS= \
$(patsubst %,test/%.hist_test,${HIST_TEST})
%.cm: %.samples.xz channel_matrix
xzcat $< | ./channel_matrix $@
%.plot: %.cm extract_plot
./extract_plot $< 1024 1024 > $@
%.capacity: %.cm capacity
./capacity $< 1e-3 > $@
%.sim: %.cm sample_error
./sample_error $< 10 10 1e-3 1 0 1 > $@
%.hist_test: %.samples.xz test_hist
xzcat $< | ./test_hist > $@
test: ${TEST_TARGETS} ${HIST_TEST_TARGETS} test_sparse
./test_sparse
###
clean:
rm -f *.o ${dSFMT_SRC}/*.o ${EXECUTABLES} ${DEBUG_EXECUTABLES} \
cpu.mk ${TEST_TARGETS}