-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (55 loc) · 1.29 KB
/
Makefile
File metadata and controls
70 lines (55 loc) · 1.29 KB
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
# ========================
# Compilers
# ========================
CXX := g++
NVCC := nvcc
# ========================
# Flags
# ========================
CXXFLAGS := -O2 -std=c++17 -Wall -Wextra -pedantic -DUSE_CDSB=1
NVCCFLAGS := -O2 -std=c++17 \
--use_fast_math \
--expt-relaxed-constexpr
# 如果你需要指定架构(推荐)
NVCCFLAGS += -gencode arch=compute_90,code=sm_90
NVCCFLAGS += -gencode arch=compute_90,code=compute_90
# 或者(较通用)
# NVCCFLAGS += -arch=sm_90
# ========================
# Paths
# ========================
EIGEN_INC ?= /usr/include/eigen3
CUDA_HOME ?= /usr/local/cuda
INCLUDES := \
-I. \
-Isrc \
-I$(EIGEN_INC) \
-I$(CUDA_HOME)/include
LDFLAGS := -L$(CUDA_HOME)/lib64 -lcudart
# ========================
# Sources
# ========================
CPP_SRCS := \
cdsb_fasthare_qplib.cpp \
fasthare_api.cpp \
src/fasthare.cpp \
src/graph.cpp
CU_SRCS := \
cdsb_fastshare.cu
OBJS := \
$(CPP_SRCS:.cpp=.o) \
$(CU_SRCS:.cu=.o)
BIN := app
# ========================
# Rules
# ========================
.PHONY: all clean
all: $(BIN)
$(BIN): $(OBJS)
$(CXX) $(CXXFLAGS) $(OBJS) -o $@ $(LDFLAGS)
%.o: %.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
%.o: %.cu
$(NVCC) $(NVCCFLAGS) $(INCLUDES) -c $< -o $@
clean:
rm -f $(OBJS) $(BIN)