-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
324 lines (253 loc) · 7.5 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
#################################
# Architecture dependent settings
#################################
CFLAGS = -D_GNU_SOURCE
ifeq ($(DEBUG),1)
DEBUG_FLAGS=-Wall -ggdb -g -DDEBUG
CFLAGS += -O0 -DADD_PADDING -fno-inline
else ifeq ($(DEBUG),2)
DEBUG_FLAGS=-Wall
CFLAGS += -O0 -DADD_PADDING -fno-inline
else ifeq ($(DEBUG),3)
DEBUG_FLAGS=-Wall -g -ggdb
CFLAGS += -O3 -DADD_PADDING -fno-inline
else
DEBUG_FLAGS=-Wall
CFLAGS += -O3 -DADD_PADDING
endif
ifeq ($(SET_CPU),0)
CFLAGS += -DNO_SET_CPU
endif
ifeq ($(LATENCY),1)
CFLAGS += -DCOMPUTE_LATENCY -DDO_TIMINGS
endif
ifeq ($(LATENCY),2)
CFLAGS += -DCOMPUTE_LATENCY -DDO_TIMINGS -DUSE_SSPFD -DLATENCY_ALL_CORES=0
LIBS += $(SSPFD) -lm
endif
ifeq ($(LATENCY),3)
CFLAGS += -DCOMPUTE_LATENCY -DDO_TIMINGS -DUSE_SSPFD -DLATENCY_ALL_CORES=1
LIBS += $(SSPFD) -lm
endif
ifeq ($(LATENCY),4)
CFLAGS += -DCOMPUTE_LATENCY -DDO_TIMINGS -DUSE_SSPFD -DLATENCY_PARSING=1
LIBS += $(SSPFD) -lm
endif
ifeq ($(LATENCY),5)
CFLAGS += -DCOMPUTE_LATENCY -DDO_TIMINGS -DUSE_SSPFD -DLATENCY_PARSING=1 -DLATENCY_ALL_CORES=1
LIBS += $(SSPFD) -lm
endif
TOP := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
LIBS+=-L$(TOP)/external/lib -L$(TOP)
SRCPATH := $(TOP)/src
MAININCLUDE := $(TOP)/include
ifeq ($(M),1)
LIBS += -lsspfd
CFLAGS += -DUSE_SSPFD
endif
# default setings
PLATFORM=-DDEFAULT
GCC=gcc
PLATFORM_NUMA=0
OPTIMIZE=
LIBS += -lrt -lpthread -lm -lclht -lssmem
UNAME := $(shell uname -n)
ifeq ($(UNAME), lpd48core)
PLATFORM=-DOPTERON
GCC=gcc-4.8
PLATFORM_NUMA=1
OPTIMIZE=-DOPTERON_OPTIMIZE
PLATFORM_NUMA=1
endif
ifeq ($(UNAME), lpdxeon2680)
PLATFORM=-DXEON2
GCC=gcc
PLATFORM_NUMA=1
OPTIMIZE=
endif
ifeq ($(UNAME), lpdpc4)
PLATFORM=-DCOREi7
GCC=gcc
PLATFORM_NUMA=0
OPTIMIZE=
endif
ifeq ($(UNAME), lpdpc34)
PLATFORM=-DCOREi7 -DRTM
GCC=gcc-4.8
PLATFORM_NUMA=0
OPTIMIZE=
LIBS += -mrtm
endif
ifeq ($(UNAME), diascld9)
PLATFORM=-DOPTERON2
GCC=gcc
LIBS +=
endif
ifeq ($(UNAME), diassrv8)
PLATFORM=-DXEON
GCC=gcc
PLATFORM_NUMA=1
LIBS += -lnuma
endif
ifeq ($(UNAME), diascld19)
PLATFORM=-DXEON2
GCC=gcc
LIBS +=
endif
ifeq ($(UNAME), maglite)
PLATFORM=-DSPARC
GCC:=/opt/csw/bin/gcc
LIBS+=
CFLAGS += -m64 -mcpu=v9 -mtune=v9
endif
ifeq ($(UNAME), parsasrv1.epfl.ch)
PLATFORM=-DTILERA
GCC=tile-gcc
LIBS += -ltmc
endif
ifeq ($(UNAME), smal1.sics.se)
PLATFORM=-DTILERA
GCC=tile-gcc
LIBS += -ltmc
endif
ifeq ($(UNAME), ol-collab1)
PLATFORM=-DT44
GCC=/usr/sfw/bin/gcc
CFLAGS += -m64
LIBS+=
endif
ifeq ($(PLATFORM_NUMA), 1)
CFLAGS += -DNUMA
LIBS += -lnuma
endif
CFLAGS += $(PLATFORM)
CFLAGS += $(OPTIMIZE)
CFLAGS += $(DEBUG_FLAGS)
INCLUDES := -I$(MAININCLUDE) -I$(TOP)/external/include
OBJ_FILES := clht_gc.o
SRC := src
BMARKS := bmarks
#MAIN_BMARK := $(BMARKS)/test.c # no memory allocation
#MAIN_BMARK := $(BMARKS)/test_ro.c # read-only benchmark
MAIN_BMARK := $(BMARKS)/test_mem.c # memory allocation
ALL = clht_lb clht_lb_res clht_lb_res_no_next clht_lb_ro clht_lb_linked clht_lb_packed \
clht_lf clht_lf_res clht_lf_only_map_rem
REST = math_cache_lb math_cache_lf \
snap_stress noise
default: normal
dependencies:
./scripts/make_dependencies.sh
rest: $(REST)
all: $(ALL)
.PHONY: $(ALL) \
libclht_lb.a libclht_lb_res.a libclht_lb_res_no_next.a \
libclht_lb_linked.a libclht_lb_packed.a libclht_lb_lock_ins.a \
libclht_lf.a libclht_lf_res.a libclht_lf_only_map_rem.a
normal: clht_lb_res clht_lf_res
%.o:: $(SRC)/%.c
$(GCC) $(CFLAGS) $(INCLUDES) -o $@ -c $<
clht_gc_linked.o: $(SRC)/clht_gc.c
$(GCC) -DCLHT_LINKED $(CFLAGS) $(INCLUDES) -o clht_gc_linked.o -c $(SRC)/clht_gc.c
################################################################################
# library
################################################################################
TYPE = clht_lb
OBJ = $(TYPE).o
lib$(TYPE).a: $(OBJ_FILES) $(OBJ)
@echo Archive name = libclht.a
ar -d libclht.a *
ar -r libclht.a clht_lb.o $(OBJ_FILES)
TYPE = clht_lb_res
OBJ = $(TYPE).o
lib$(TYPE).a: $(OBJ_FILES) $(OBJ)
@echo Archive name = libclht.a
ar -d libclht.a *
ar -r libclht.a clht_lb_res.o $(OBJ_FILES)
TYPE = clht_lb_res_no_next
OBJ = $(TYPE).o
lib$(TYPE).a: $(OBJ_FILES) $(OBJ)
@echo Archive name = libclht.a
ar -d libclht.a *
ar -r libclht.a clht_lb_res_no_next.o $(OBJ_FILES)
TYPE = clht_lb_linked
OBJ = $(TYPE).o
lib$(TYPE).a: clht_gc_linked.o $(OBJ)
@echo Archive name = libclht.a
ar -d libclht.a *
ar -r libclht.a clht_lb_linked.o clht_gc_linked.o
TYPE = clht_lb_packed
OBJ = $(TYPE).o
lib$(TYPE).a: $(OBJ_FILES) $(OBJ)
@echo Archive name = libclht.a
ar -d libclht.a *
ar -r libclht.a clht_lb_packed.o $(OBJ_FILES)
TYPE = clht_lb_lock_ins
OBJ = $(TYPE).o
lib$(TYPE).a: $(OBJ_FILES) $(OBJ)
@echo Archive name = libclht.a
ar -d libclht.a *
ar -r libclht.a clht_lb_lock_ins.o $(OBJ_FILES)
TYPE = clht_lf
OBJ = $(TYPE).o
lib$(TYPE).a: $(OBJ_FILES) $(OBJ)
@echo Archive name = libclht.a
ar -d libclht.a *
ar -r libclht.a clht_lf.o $(OBJ_FILES)
TYPE = clht_lf_res
OBJ = $(TYPE).o
lib$(TYPE).a: $(OBJ_FILES) $(OBJ)
@echo Archive name = libclht.a
ar -d libclht.a *
ar -r libclht.a clht_lf_res.o $(OBJ_FILES)
TYPE = clht_lf_only_map_rem
OBJ = $(TYPE).o
lib$(TYPE).a: $(OBJ_FILES) $(OBJ)
@echo Archive name = libclht.a
ar -d libclht.a *
ar -r libclht.a clht_lf_only_map_rem.o $(OBJ_FILES)
################################################################################
# lock-based targets
################################################################################
TYPE = clht_lb
$(TYPE): $(MAIN_BMARK) lib$(TYPE).a
$(GCC) -DNO_RESIZE $(CFLAGS) $(INCLUDES) $(MAIN_BMARK) -o clht_lb $(LIBS) -lclht
TYPE = clht_lb_res
$(TYPE): $(MAIN_BMARK) lib$(TYPE).a
$(GCC) $(INCLUDES) $(CFLAGS) $(MAIN_BMARK) $(SRC)/clht_lb_res.c -o clht_lb_res $(LIBS)
TYPE = clht_lb_res_no_next
$(TYPE): $(MAIN_BMARK) lib$(TYPE).a
$(GCC) $(CFLAGS) $(INCLUDES) $(MAIN_BMARK) -o clht_lb_nn $(LIBS)
TYPE = clht_lb_linked
$(TYPE): $(MAIN_BMARK) lib$(TYPE).a
$(GCC) $(CFLAGS) $(INCLUDES) $(MAIN_BMARK) -o clht_lb_linked $(LIBS)
TYPE = clht_lb_packed
$(TYPE): $(MAIN_BMARK) lib$(TYPE).a
$(GCC) $(CFLAGS) $(INCLUDES) $(MAIN_BMARK) $(SRC)/clht_lb_packed.c -o clht_lb_packed $(LIBS)
TYPE = clht_lb_lock_ins
$(TYPE): $(MAIN_BMARK) lib$(TYPE).a
$(GCC) -DLOCK_INS $(CFLAGS) $(INCLUDES) $(MAIN_BMARK) -o clht_lb_lock_ins $(LIBS)
################################################################################
# lock-free targets
################################################################################
TYPE = clht_lf
$(TYPE): $(MAIN_BMARK) lib$(TYPE).a
$(GCC) -DLOCKFREE $(CFLAGS) $(INCLUDES) $(MAIN_BMARK) -o clht_lf $(LIBS)
TYPE = clht_lf_res
$(TYPE): $(MAIN_BMARK) lib$(TYPE).a
$(GCC) -DLOCKFREE_RES $(CFLAGS) $(INCLUDES) $(MAIN_BMARK) -o clht_lf_res $(LIBS)
TYPE = clht_lf_only_map_rem
$(TYPE): $(MAIN_BMARK) lib$(TYPE).a
$(GCC) -DLOCKFREE $(CFLAGS) $(INCLUDES) $(MAIN_BMARK) -o clht_lf_only_map_rem $(LIBS)
################################################################################
# other tests
################################################################################
math_cache_lb: $(BMARKS)/math_cache.c libclht_lb_res.a
$(GCC) $(CFLAGS) $(INCLUDES) $(BMARKS)/math_cache.c -o math_cache_lb $(LIBS)
math_cache_lf: $(BMARKS)/math_cache.c libclht_lf_res.a
$(GCC) -DLOCKFREE $(CFLAGS) $(INCLUDES) $(BMARKS)/math_cache.c -o math_cache_lf $(LIBS)
snap_stress: $(BMARKS)/snap_stress.c libclht_lf_res.a
$(GCC) -DLOCKFREE $(CFLAGS) $(INCLUDES) $(BMARKS)/snap_stress.c -o snap_stress $(LIBS)
noise: $(BMARKS)/noise.c $(OBJ_FILES)
$(GCC) $(CFLAGS) $(INCLUDES) $(OBJ_FILES) $(BMARKS)/noise.c -o noise $(LIBS)
clean:
rm -f *.o *.a clht_* math_cache* snap_stress