forked from cwpearson/cuda-experiments
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
106 lines (86 loc) · 2.21 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
USE_THIRDPARTY=0
NVCC = nvcc -ccbin=$(CXX)
#NVCC_VER_MAJOR := $(shell nvcc -V | grep -oP "release \K([0-9]{1,}\.)+[0-9]{1,}")
NVCC_VER_MAJOR := $(shell nvcc -V | grep -oP "release \K([0-9])")
# DRIVER_VERSION ?= $(shell nvidia-smi | grep -oP "Driver Version: \K([0-9]{1,}\.)+[0-9]{1,}")
$(info $(NVCC_VER_MAJOR).$(NVCC_VER_MINOR))
NVCC_GTE_9 := $(shell echo $(NVCC_VER_MAJOR)\>=9 | bc )
NVCC_GTE_8 := $(shell echo $(NVCC_VER_MAJOR)\>=8 | bc )
NVCC_GTE_7 := $(shell echo $(NVCC_VER_MAJOR)\>=7 | bc )
NVCC_GTE_6 := $(shell echo $(NVCC_VER_MAJOR)\>=6 | bc )
$(info nvcc >= 9: $(NVCC_GTE_9))
$(info nvcc >= 8: $(NVCC_GTE_8))
$(info nvcc >= 7: $(NVCC_GTE_7))
$(info nvcc >= 6: $(NVCC_GTE_6))
MODULES += common \
access-counters \
atomics \
atomics.1 \
contention-pinned \
cpu-cpu \
cpu-cpu-df \
ctx \
direct-peer-srcwr \
direct-peer-dstrd \
memcpy-nopeer \
memcpy-peer \
pageable \
page-to-pin \
pinned \
pinned-df \
std-memcpy \
std-memcpy-df \
um-cc35-bw \
util \
wc
ifeq ($(NVCC_GTE_9),1)
MODULES += \
mgpu-sync \
system-atomics
endif
ifeq ($(NVCC_GTE_8),1)
MODULES += \
coherence-bw \
coherence-latency \
cpu-touch \
prefetch-bw
endif
ifeq ($(NVCC_GTE_7),1)
MODULES += \
stream-thread \
stream-warp
endif
# Look in each module for include files
#NVCCFLAGS += $(patsubst %,-I%,$(MODULES)) -I. -lineinfo
NVCCFLAGS += -I. -lineinfo -Wno-deprecated-gpu-targets
CXXFLAGS += -I.
ifdef HOST_COMPILER
NVCCFLAGS += -ccbin=$(HOST_COMPILER)
endif
ifeq ($(USE_THIRDPARTY),1)
NVCCFLAGS += -Ithirdparty/include
CXXFLAGS += -Ithirdparty/include
endif
NVCC_LD_FLAGS += -lnuma -lnvToolsExt -Lthirdparty/lib -Xcompiler '"-Wl,-rpath=thirdparty/lib"'
#each module will add to this
TARGETS :=
CLEAN_TARGETS :=
COMMON_OBJECTS :=
COMMON_HEADERS :=
#include the description for
#each module
include $(patsubst %,%/module.mk,$(MODULES))
%.o: %.cu $(COMMON_HEADERS)
$(NVCC) $(NVCCFLAGS) $< -std=c++11 -Xcompiler -Wall,-Wextra,-O3,-Wshadow -o $@ -c
%.o: %.cpp $(COMMON_HEADERS)
$(CXX) $(CXXFLAGS) $< -std=c++11 -Wall -Wextra -O3 -Wshadow -fopenmp -c -o $@
.PHONY : all
.DEFAULT_GOAL := all
all: $(TARGETS)
clean:
rm -f $(TARGETS) $(CLEAN_TARGETS)
bench: $(TARGETS)
for m in $(MODULES); do \
echo $$m; \
$$m/main >> $$m.csv; \
done;