-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile.common.ascylib
431 lines (349 loc) · 8.15 KB
/
Makefile.common.ascylib
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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
################
# Local settings
################
# Settings for TBB and URCU
TBB_LIBS ?= /home/trigonak/code/tbb42_20140122oss/build/linux_intel64_gcc_cc4.8_libc2.17_kernel3.11.0_release
TBB_INCLUDES ?= /home/trigonak/code/tbb42_20140122oss/include
URCU_PATH ?= /home/trigonak/code/urcu/ #path to the URCU installation
# Compiler
# SOLARIS_CC1 ?= /opt/csw/bin/gcc
# SOLARIS_CC2 ?= /usr/sfw/bin/gcc
# TILERA_CC ?= tile-gcc
# CC ?= gcc
VERSION ?= O3
ifeq ($(VERSION),DEBUG)
CXXFLAGS += -g -DDEBUG -O0
endif
ifeq ($(VERSION),SYMBOL)
CXXFLAGS += -O3 -g
endif
ifeq ($(VERSION),O0)
CXXFLAGS += -O0
endif
ifeq ($(VERSION),O1)
CXXFLAGS += -O1
endif
ifeq ($(VERSION),O2)
CXXFLAGS += -O2
endif
ifeq ($(VERSION),O3)
CXXFLAGS += -O3
endif
# Compile with global lock
ifeq ($(GRANULARITY),GLOBAL_LOCK)
CXXFLAGS += -DLL_GLOBAL_LOCK
BIN_SUFFIX = _gl
endif
ifeq ($(G),GL)
CXXFLAGS += -DLL_GLOBAL_LOCK
BIN_SUFFIX = _gl
endif
CXXFLAGS += -D_GNU_SOURCE
ROOT ?= .
BINDIR ?= $(ROOT)/bin
BUILDIR ?= $(ROOT)/build
# Path to LIBATOMIC_OPS (or to gcc-specific libatomic_ops)
ifdef LIBAO_HOME
LIBAO_INC = $(LIBAO_HOME)/include
else
LIBAO_INC = $(ROOT)/src/atomic_ops
endif
LIBSSMEM = $(ROOT)/db/ascylib_external
ifeq ($(LOCK),)
LOCK ?= TAS
endif
ifeq ($(STM),SEQUENTIAL)
CXXFLAGS += -DSEQUENTIAL
endif
ifeq ($(STM),LOCKFREE)
CXXFLAGS += -DLOCKFREE
endif
#############################
# Platform dependent settings
#############################
#
# GCC thread-local storage requires "significant
# support from the linker (ld), dynamic linker
# (ld.so), and system libraries (libc.so and libpthread.so), so it is
# not available everywhere." source: GCC-doc.
#
# pthread_spinlock is replaced by pthread_mutex
# on MacOS X, as it might not be supported.
# Comment LOCK = MUTEX below to enable.
ifndef OS_NAME
OS_NAME = $(shell uname -s)
endif
ifeq ($(OS_NAME), Darwin)
OS = MacOS
DEFINES += -UTLS
LOCK = MUTEX
endif
ifeq ($(OS_NAME), Linux)
OS = Linux
DEFINES += -DTLS
endif
ifeq ($(OS_NAME), SunOS)
OS = Solaris
CC = $(SOLARIS_CC1)
DEFINES += -DTLS
endif
ifndef STM
CXXFLAGS += -D$(LOCK)
endif
#################################
# Management PC specific settings
#################################
ifndef PC_NAME
PC_NAME = $(shell uname -n)
endif
ifeq ($(PC_NAME), parsasrv1.epfl.ch)
PLATFORM_KNOWN = 1
OS = Linux
CC = $(TILERA_CC)
LDFLAGS += -ltmc
PLATFORM_NUMA = 1
ARCH = tile
ARCH_NAME = tile
endif
ifeq ($(PC_NAME), lpd48core)
PLATFORM_KNOWN = 1
CC = gcc-4.8
CXXFLAGS += -DOPTERON -DPLATFORM_MCORE
PLATFORM_NUMA = 1
endif
ifeq ($(PC_NAME), lpdxeon2680)
PLATFORM_KNOWN = 1
CXXFLAGS += -DLPDXEON -DPLATFORM_MCORE
PLATFORM_NUMA = 1
endif
ifeq ($(PC_NAME), lpdquad)
PLATFORM_KNOWN = 1
CXXFLAGS += -DLPDQUAD -DPLATFORM_MCORE
PLATFORM_NUMA = 1
endif
ifeq ($(PC_NAME), lpdpc34)
PLATFORM_KNOWN = 1
CXXFLAGS += -DHASWELL
PLATFORM_NUMA = 0
endif
ifeq ($(PC_NAME), lpdpc4)
PLATFORM_KNOWN = 1
CXXFLAGS += -DLPDPC4
PLATFORM_NUMA = 0
endif
ifeq ($(PC_NAME), diassrv8)
PLATFORM_KNOWN = 1
CXXFLAGS += -DXEON -DPLATFORM_MCORE
PLATFORM_NUMA = 1
endif
ifeq ($(PC_NAME), maglite)
PLATFORM_KNOWN = 1
CC = $(SOLARIS_CC1)
CXXFLAGS += -DMAGLITE
endif
ifeq ($(PC_NAME), ol-collab1)
PLATFORM_KNOWN = 1
ifdef LOCK
LOCK = TICKET
endif
CC = $(SOLARIS_CC2)
CXXFLAGS += -DT44
endif
ifeq ($(PC_NAME), iccluster033)
PLATFORM_KNOWN = 1
CXXFLAGS += -DICCLUSTER -DPLATFORM_MCORE
PLATFORM_NUMA = 0
endif
ifneq ($(PLATFORM_KNOWN), 1)
CXXFLAGS += -DDEFAULT
PLATFORM_NUMA = 0
CORE_NUM ?= $(shell nproc)
CORE_SPEED_KHz := $(shell cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq)
FREQ_GHZ := $(shell echo "scale=3; ${CORE_SPEED_KHz}/1000000" | bc -l)
$(info ********************************** Using as a default number of cores: $(CORE_NUM) on 1 socket)
$(info ********************************** Using as a default frequency : $(FREQ_GHZ) GHz)
$(info ********************************** If incorrect, create a manual entry in common/Makefile.common)
CXXFLAGS += -DCORE_NUM=${CORE_NUM}
CXXFLAGS += -DFREQ_GHZ=${FREQ_GHZ}
endif
#################################
# Architecture dependent settings
#################################
ifndef ARCH
ARCH_NAME = $(shell uname -m)
endif
ifeq ($(ARCH_NAME), i386)
ARCH = x86
CXXFLAGS += -m32
LDFLAGS += -m32
SSPFD = -lsspfd_x86
LDFLAGS += -L$(LIBSSMEM)/lib -lssmem_x86
endif
ifeq ($(ARCH_NAME), i686)
ARCH = x86
CXXFLAGS += -m32
LDFLAGS += -m32
SSPFD = -lsspfd_x86
LDFLAGS += -L$(LIBSSMEM)/lib -lssmem_x86
endif
ifeq ($(ARCH_NAME), x86_64)
ARCH = x86_64
CXXFLAGS += -m64
LDFLAGS += -m64
SSPFD = -lsspfd_x86_64
# LDFLAGS += -L$(LIBSSMEM)/lib -lssmem_x86_64
endif
ifeq ($(ARCH_NAME), sun4v)
ARCH = sparc64
CXXFLAGS += -DSPARC=1 -DINLINED=1 -m64
LDFLAGS += -lrt -m64
SSPFD = -lsspfd_sparc64
LDFLAGS += -L$(LIBSSMEM)/lib -lssmem_sparc64
endif
ifeq ($(ARCH_NAME), tile)
LDFLAGS += -L$(LIBSSMEM)/lib -lssmem_tile
SSPFD = -lsspfd_tile
endif
ifeq ($(PLATFORM_NUMA), 1)
LDFLAGS += -lnuma
endif
#################
# Global settings
#################
CXXFLAGS += -Wall
CXXFLAGS += -fno-strict-aliasing -Wno-sign-compare
# CXXFLAGS += -I$(LIBAO_INC) -I$(ROOT)/include -I$(LIBSSMEM)/include
LDFLAGS += -lpthread -lrt -lm
######################
# compilation settings
######################
TEST_FILE = test_simple.c
ifeq ($(TEST),old)
TEST_FILE = test.c
CXXFLAGS += -DGC=0
else
ifeq ($(TEST),correct)
TEST_FILE=test_correct.c
CXXFLAGS += -DGC=1
else
ifeq ($(TEST),fail)
TEST_FILE=test_fail.c
endif
ifeq ($(GC),0)
CXXFLAGS += -DGC=0
else
CXXFLAGS += -DGC=1
endif
endif
endif
ifeq ($(LATENCY),1)
CXXFLAGS += -DCOMPUTE_LATENCY -DDO_TIMINGS
endif
ifeq ($(LATENCY),2)
CXXFLAGS += -DCOMPUTE_LATENCY -DDO_TIMINGS -DUSE_SSPFD -DLATENCY_ALL_CORES=0
LDFLAGS += $(SSPFD) -lm
endif
ifeq ($(LATENCY),3)
CXXFLAGS += -DCOMPUTE_LATENCY -DDO_TIMINGS -DUSE_SSPFD -DLATENCY_ALL_CORES=1
LDFLAGS += $(SSPFD) -lm
endif
ifeq ($(LATENCY),4)
CXXFLAGS += -DCOMPUTE_LATENCY -DDO_TIMINGS -DUSE_SSPFD -DLATENCY_PARSING=1
LDFLAGS += $(SSPFD) -lm
endif
ifeq ($(LATENCY),5)
CXXFLAGS += -DCOMPUTE_LATENCY -DDO_TIMINGS -DUSE_SSPFD -DLATENCY_PARSING=1 -DLATENCY_ALL_CORES=1
LDFLAGS += $(SSPFD) -lm
endif
ifeq ($(INIT),all)
CXXFLAGS += -DINITIALIZE_FROM_ONE=0
else
CXXFLAGS += -DINITIALIZE_FROM_ONE=1
endif
ifeq ($(COLLECT_STATS),1)
CXXFLAGS += -DCOLLECT_STATS
endif
ifeq ($(INIT),seq)
CXXFLAGS += -DINIT_SEQ
else
ifeq ($(INIT), random)
CXXFLAGS += -DINIT_UNIQUE_RANDOM
else
# ifeq ($(INIT), compact)
# CXXFLAGS += -DINIT_COMPACT
# else
CXXFLAGS += -DNO_INIT_FILL
# endif
endif
endif
ifdef N_DRAINING_THREADS
CXXFLAGS += -DDRAINING_THREADS=$(N_DRAINING_THREADS)
endif
ifeq ($(SKEW9010),1)
CXXFLAGS += -DSKEW9010
endif
ifdef SKEW
CXXFLAGS += -DSKEW=$(SKEW)
endif
ifeq ($(MEM),big)
CXXFLAGS += -DBIGMEM
endif
ifeq ($(MEM),medium)
CXXFLAGS += -DMEDMEM
endif
ifdef MSL
CXXFLAGS += -DMSL=$(MSL)
endif
ifdef MHT
CXXFLAGS += -DMHT=$(MHT)
endif
ifeq ($(ONEWRITER),1)
CXXFLAGS += -DONEWRITER
endif
ifeq ($(TIME_TEST),1)
CXXFLAGS += -DTIME_TEST
endif
ifeq ($(SCANS),1)
CXXFLAGS += -DSCANS
endif
ifneq ($(TIGHT_ALLOC),0)
CXXFLAGS += -DTIGHT_ALLOC
endif
ifeq ($(DUMMY_PERSIST),1)
CXXFLAGS += -DDUMMY_PERSIST
endif
ifneq ($(USE_HT),0)
CXXFLAGS += -DUSE_HT
endif
ifdef CLHT_K
CXXFLAGS += -DCLHT_K=$(CLHT_K)
endif
ifeq ($(ASCY_MEMTABLE),1)
CXXFLAGS += -DASCY_MEMTABLE=1
endif
ifeq ($(ASCY_MEMTABLE),2)
CXXFLAGS += -DASCY_MEMTABLE=2
endif
ifeq ($(ASCY_MEMTABLE),3)
CXXFLAGS += -DASCY_MEMTABLE=3
endif
ifeq ($(SET_CPU),0)
CXXFLAGS += -DNO_SET_CPU
endif
ifeq ($(POWER),1)
CXXFLAGS += -DRAPL_READ_ENABLE=1
ifeq ($(PLATFORM_NUMA), 1)
LDFLAGS += -lraplread -lm
else
LDFLAGS += -lraplread1 -lm
endif
endif
ifeq ($(STATS),1)
CXXFLAGS += -DRETRY_STATS=1
endif
ifeq ($(PAD),1)
CXXFLAGS += -DDO_PAD=1
endif
ifeq ($(SEQ_NO_FREE),1)
CXXFLAGS += -DSEQ_SSMEM_NO_FREE=1
endif