-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.common
544 lines (453 loc) · 12.1 KB
/
Makefile.common
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
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
################
# 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)
CFLAGS += -g -DDEBUG -O0
endif
ifeq ($(VERSION),SYMBOL)
CFLAGS += -O3 -g
endif
ifeq ($(VERSION),O0)
CFLAGS += -O0
endif
ifeq ($(VERSION),O1)
CFLAGS += -O1
endif
ifeq ($(VERSION),O2)
CFLAGS += -O2
endif
ifeq ($(VERSION),O3)
CFLAGS += -O3
endif
ifeq ($(VERSION),O4)
CFLAGS += -O3 -DNDEBUG
endif
ifeq ($(NDEBUG),TRUE)
CFLAGS += -DNDEBUG
endif
# Compile with compare and echange atomic instruction
CFLAGS += -mcx16
# Compile with global lock
ifeq ($(GRANULARITY),GLOBAL_LOCK)
CFLAGS += -DLL_GLOBAL_LOCK
BIN_SUFFIX = _gl
endif
ifeq ($(G),GL)
CFLAGS += -DLL_GLOBAL_LOCK
BIN_SUFFIX = _gl
endif
CFLAGS += -D_GNU_SOURCE
ROOT ?= ../..
BINDIR ?= $(ROOT)/bin
BUILDIR ?= $(ROOT)/build
$(shell [ -d "$(BUILDIR)" ] || mkdir -p $(BUILDIR))
$(shell [ -d "$(BINDIR)" ] || mkdir -p $(BINDIR))
# 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)/external
ifeq ($(LOCK),)
LOCK ?= TAS
endif
ifeq ($(STM),SEQUENTIAL)
CFLAGS += -DSEQUENTIAL
endif
ifeq ($(STM),LOCKFREE)
CFLAGS += -DLOCKFREE
endif
ifeq ($(CACHE),1)
SSMEM_SUFFIX=_manual
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
CFLAGS += -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
CFLAGS += -DOPTERON -DPLATFORM_MCORE
PLATFORM_NUMA = 1
endif
ifeq ($(PC_NAME), lpdxeon2680)
PLATFORM_KNOWN = 1
CFLAGS += -DLPDXEON -DPLATFORM_MCORE
PLATFORM_NUMA = 1
endif
ifeq ($(PC_NAME), lpdquad)
PLATFORM_KNOWN = 1
CFLAGS += -DLPDQUAD -DPLATFORM_MCORE
PLATFORM_NUMA = 1
endif
ifeq ($(PC_NAME), lpdpc34)
PLATFORM_KNOWN = 1
CFLAGS += -DHASWELL
PLATFORM_NUMA = 0
endif
ifeq ($(PC_NAME), lpdpc4)
PLATFORM_KNOWN = 1
CFLAGS += -DLPDPC4
PLATFORM_NUMA = 0
endif
ifeq ($(PC_NAME), diassrv8)
PLATFORM_KNOWN = 1
CFLAGS += -DXEON -DPLATFORM_MCORE
PLATFORM_NUMA = 1
endif
ifeq ($(PC_NAME), maglite)
PLATFORM_KNOWN = 1
CC = $(SOLARIS_CC1)
CFLAGS += -DMAGLITE
endif
ifeq ($(PC_NAME), ol-collab1)
PLATFORM_KNOWN = 1
ifdef LOCK
LOCK = TICKET
endif
CC = $(SOLARIS_CC2)
CFLAGS += -DT44
endif
ifeq ($(PC_NAME), excess)
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)
OS = Linux
CFLAGS += -DEXCESS
CFLAGS += -no-pie
LDFLAGS += -latomic
PLATFORM_NUMA = 1
CFLAGS += -DCORE_NUM=${CORE_NUM}
CFLAGS += -DFREQ_GHZ=${FREQ_GHZ}
PLATFORM_KNOWN = 1
endif
ifeq ($(PC_NAME), odysseus)
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)
OS = Linux
CFLAGS += -DODYSSEUS
LDFLAGS += -latomic
PLATFORM_NUMA = 0
CFLAGS += -DCORE_NUM=${CORE_NUM}
CFLAGS += -DFREQ_GHZ=${FREQ_GHZ}
PLATFORM_KNOWN = 1
endif
ifeq ($(PC_NAME), ithaca)
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)
OS = Linux
CFLAGS += -DITHACA
LDFLAGS += -latomic
PLATFORM_NUMA = 0
CFLAGS += -DCORE_NUM=${CORE_NUM}
CFLAGS += -DFREQ_GHZ=${FREQ_GHZ}
PLATFORM_KNOWN = 1
endif
ifeq ($(PC_NAME), athena)
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)
OS = Linux
CFLAGS += -DATHENA
LDFLAGS += -latomic
PLATFORM_NUMA = 1
CFLAGS += -DCORE_NUM=${CORE_NUM}
CFLAGS += -DFREQ_GHZ=${FREQ_GHZ}
PLATFORM_KNOWN = 1
endif
ifeq ($(PC_NAME), example-pinning)
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)
OS = Linux
CFLAGS += -DEXAMPLE
LDFLAGS += -latomic
PLATFORM_NUMA = 0
CFLAGS += -DCORE_NUM=${CORE_NUM}
CFLAGS += -DFREQ_GHZ=${FREQ_GHZ}
PLATFORM_KNOWN = 1
endif
ifeq ($(PC_NAME), forsete)
CORE_NUM ?= $(shell nproc)
PLATFORM_NUMA = 0
CFLAGS += -DDEFAULT # Use default configuration
CFLAGS += -no-pie # Disable position-independent code
CFLAGS += -DCORE_NUM=${CORE_NUM} # Cores and freq seldomly used
LDFLAGS += -latomic # To be able to use atomics.h (Strange mix of atomics in this project)
CC := gcc
PLATFORM_KNOWN = 1
endif
ifneq ($(PLATFORM_KNOWN), 1)
CFLAGS += -DDEFAULT
PLATFORM_NUMA = 0
CORE_NUM ?= $(shell nproc)
LDFLAGS += -latomic
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 ********************************** Using as a compiler : $(CC))
$(info ********************************** Using as a machine : $(PC_NAME))
$(info ********************************** If incorrect, create a manual entry in common/Makefile.common)
CFLAGS += -DCORE_NUM=${CORE_NUM}
CFLAGS += -DFREQ_GHZ=${FREQ_GHZ}
endif
#################################
# Architecture dependent settings
#################################
ifndef ARCH
ARCH_NAME = $(shell uname -m)
endif
ifeq ($(ARCH_NAME), i386)
ARCH = x86
CFLAGS += -m32
LDFLAGS += -m32
SSPFD = -lsspfd_x86
LDFLAGS += -L$(LIBSSMEM)/lib -lssmem_x86$(SSMEM_SUFFIX)
endif
ifeq ($(ARCH_NAME), i686)
ARCH = x86
CFLAGS += -m32
LDFLAGS += -m32
SSPFD = -lsspfd_x86
LDFLAGS += -L$(LIBSSMEM)/lib -lssmem_x86$(SSMEM_SUFFIX)
endif
ifeq ($(ARCH_NAME), x86_64)
ARCH = x86_64
CFLAGS += -m64
LDFLAGS += -m64
SSPFD = -lsspfd_x86_64
ifeq ($(GCCLAIM), manual)
CFLAGS += -DGCCLAIM=1
LDFLAGS += -L$(LIBSSMEM)/lib -lssmem_x86_64_manual$(SSMEM_SUFFIX)
else
LDFLAGS += -L$(LIBSSMEM)/lib -lssmem_x86_64$(SSMEM_SUFFIX)
endif
endif
ifeq ($(ARCH_NAME), sun4v)
ARCH = sparc64
CFLAGS += -DSPARC=1 -DINLINED=1 -m64
LDFLAGS += -lrt -m64
SSPFD = -lsspfd_sparc64
LDFLAGS += -L$(LIBSSMEM)/lib -lssmem_sparc64$(SSMEM_SUFFIX)
endif
ifeq ($(ARCH_NAME), tile)
LDFLAGS += -L$(LIBSSMEM)/lib -lssmem_tile$(SSMEM_SUFFIX)
SSPFD = -lsspfd_tile
endif
ifeq ($(PLATFORM_NUMA), 1)
LDFLAGS += -lnuma
endif
#################
# Global settings
#################
# CFLAGS += -Wall -Wextra -Wpedantic
CFLAGS += -fno-strict-aliasing
CFLAGS += -I$(LIBAO_INC) -I$(ROOT)/include -I$(LIBSSMEM)/include
LDFLAGS += -lpthread -lrt -lm
######################
# compilation settings
######################
TEST_FILE = test.c
ifeq ($(TEST),old)
TEST_FILE = test_simple.c
CFLAGS += -DGC=1
else
ifeq ($(TEST),correct)
TEST_FILE=test_correct.c
CFLAGS += -DGC=1
else
ifeq ($(TEST),fail)
TEST_FILE=test_fail.c
endif
ifeq ($(GC),0)
CFLAGS += -DGC=0
else ifeq ($(GC),2)
CFLAGS += -DGC=2
else
CFLAGS += -DGC=1
endif
endif
endif
# Only used for throughput over time measurements
ifdef OPS_PER_TS
CFLAGS += -DOPS_PER_TS=$(OPS_PER_TS)
else
CFLAGS += -DOPS_PER_TS=100000
endif
ifeq ($(LATENCY),1)
CFLAGS += -DCOMPUTE_LATENCY -DDO_TIMINGS
endif
ifeq ($(LATENCY),2)
CFLAGS += -DCOMPUTE_LATENCY -DDO_TIMINGS -DUSE_SSPFD -DLATENCY_ALL_CORES=0
LDFLAGS += $(SSPFD) -lm
endif
ifeq ($(LATENCY),3)
CFLAGS += -DCOMPUTE_LATENCY -DDO_TIMINGS -DUSE_SSPFD -DLATENCY_ALL_CORES=1
LDFLAGS += $(SSPFD) -lm
endif
ifeq ($(LATENCY),4)
CFLAGS += -DCOMPUTE_LATENCY -DDO_TIMINGS -DUSE_SSPFD -DLATENCY_PARSING=1
LDFLAGS += $(SSPFD) -lm
endif
ifeq ($(LATENCY),5)
CFLAGS += -DCOMPUTE_LATENCY -DDO_TIMINGS -DUSE_SSPFD -DLATENCY_PARSING=1 -DLATENCY_ALL_CORES=1
LDFLAGS += $(SSPFD) -lm
endif
ifeq ($(LATENCY),6)
CFLAGS += -DCOMPUTE_LATENCY -DDO_TIMINGS -DPFD_TYPE=2
LDFLAGS += $(SSPFD) -lm
endif
ifeq ($(INIT),one)
CFLAGS += -DINITIALIZE_FROM_ONE=1
else
CFLAGS += -DINITIALIZE_FROM_ONE=0
endif
ifeq ($(SET_CPU),0)
CFLAGS += -DNO_SET_CPU
endif
ifeq ($(POWER),1)
CFLAGS += -DRAPL_READ_ENABLE=1
LDFLAGS += -lraplread -lm
# ifeq ($(PLATFORM_NUMA), 1)
# LDFLAGS += -lraplread -lm
#else
# LDFLAGS += -lraplread1 -lm
#endif
endif
ifeq ($(STATS),1)
CFLAGS += -DRETRY_STATS=1
endif
ifeq ($(STATS),2)
CFLAGS += -DOPS_PER_THREAD=1
endif
ifeq ($(STATS),3)
CFLAGS += -DRETRY_STATS=1 -DOPS_PER_THREAD=1
endif
ifeq ($(PAD),1)
CFLAGS += -DDO_PAD=1
endif
ifeq ($(SEQ_NO_FREE),1)
CFLAGS += -DSEQ_SSMEM_NO_FREE=1
endif
ifneq ($(OPTIK),)
CFLAGS += -DOPTIK_VERSION=$(OPTIK)
endif
ifneq ($(OPTIK_STATS),)
CFLAGS += -DOPTIK_STATS=$(OPTIK_STATS)
endif
##########################
ifneq ($(WORKLOAD),)
CFLAGS += -DWORKLOAD=$(WORKLOAD)
endif
ifneq ($(PRECOMP_DIR),)
ifneq ($(WORKLOAD),)
ifneq ($(WORKLOAD), 4)
$(error Don't specify both WORKLOAD and PRECOMP_DIR!)
endif
endif
CFLAGS += -DWORKLOAD=4
CFLAGS += -DPRECOMP_DIR=\"$(PRECOMP_DIR)\"
endif
ifneq ($(VALIDATESIZE),)
CFLAGS += -DVALIDATESIZE=$(VALIDATESIZE)
else
CFLAGS += -DVALIDATESIZE=1
endif
ifeq ($(VALIDATE_WINDOW),1)
CFLAGS += -DVALIDATE_WINDOW
endif
ifeq ($(RELAXATION_ANALYSIS),LOCK)
CFLAGS += -DRELAXATION_ANALYSIS=1
ifeq ($(SAVE_FULL), 1)
CFLAGS += -DSAVE_FULL
endif
ifneq ($(RELAXATION_SEMANTICS),)
CFLAGS += -DRELAXATION_SEMANTICS=$(RELAXATION_SEMANTICS)
endif
else ifeq ($(RELAXATION_ANALYSIS),TIMER)
CFLAGS += -DRELAXATION_TIMER_ANALYSIS
endif
ifneq ($(RELAXATION),)
CFLAGS += -DRELAXATION=$(RELAXATION)
ifneq ($(RELAXATION_WINDOW),)
CFLAGS += -DRELAXATION_WINDOW=$(RELAXATION_WINDOW)
endif
endif
ifeq ($(MEMORY_SETUP),numa)
CFLAGS += -DMEMORY_SETUP=2
endif
ifeq ($(HYPERTHREAD),1)
CFLAGS += -DHYPERTHREAD=1
endif
ifneq ($(OPTIMIZE_ALGO),)
CFLAGS += -DOPTIMIZE_ALGO=$(OPTIMIZE_ALGO)
endif
ifeq ($(BACKOFF),1)
CFLAGS += -DBACKOFF=1
endif
ifeq ($(WORKLOAD),2)
$(info ***************************************************************)
$(info *** Notice: Skewed workload tests might take long. ***)
$(info *** Initializing tests takes time proportional to the range ***)
$(info *** used for the test. Zipf random numbers are precomputed. ***)
$(info *** However, the generated numbers for each configuration. ***)
$(info *** are cached in a per-thread file for subsequent runs. ***)
$(info ***************************************************************)
endif