-
Notifications
You must be signed in to change notification settings - Fork 11
/
cuda.mk.in
48 lines (38 loc) · 1.4 KB
/
cuda.mk.in
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
# Turn on if outer variable is set. Otherwise, allow user to set explicitly.
CUDA_DEBUG = $(DEBUG)
CUDA_VERBOSE = $(VERBOSE)
cuda_includes := -I@CUDA_DIR@/include
#cuda_srcs := $(srcdir)/src/H5FDsec2.c
cuda_libs := @CUDA_LIBS@
cuda_ldflags += -L@CUDA_DIR@/lib64
cuda_objs := $(patsubst %.cu,%.o,$(subst $(srcdir),$(build_dir),$(cuda_srcs)))
# For more details on the architectures, see
# http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#virtual-architecture-feature-list
nvcc_flags += -arch=compute_@CUDA_LEVEL@ -code=sm_@CUDA_LEVEL@
# nvcc includes are broken when the host compiler is gcc >= 5.0
nvcc_flags += -D_FORCE_INLINES
ifeq (1,$(CUDA_VERBOSE))
nvcc_flags += --ptxas-options=-v
endif
ifeq (1,$(CUDA_DEBUG))
nvcc_flags += --device-debug
else
nvcc_flags += -use_fast_math
endif
.PHONY: show-config
show-config: cuda-show-config
.PHONY: cuda-show-config
cuda-show-config:
@ echo NVCC_FLAGS = $(nvcc_flags)"\n"
@ echo CUDA_DEFINES = $(cuda_defines)"\n"
@ echo CUDA_INCLUDES = $(cuda_includes)"\n"
@ echo CUDA_LDFLAGS = $(cuda_ldflags)"\n"
@ echo CUDA_LIBS = $(cuda_libs)"\n"
.PHONY: dist-clean
dist-clean: cuda-dist-clean
.PHONY: cuda-dist-clean
cuda-dist-clean:
@ $(RM) cuda.mk
$(build_dir)/%.o: $(srcdir)/src/%.cu
@ echo Compiling $<...
$(quiet) @NVCC_PATH@ -std=$(cxx_std) -Xcompiler "$(cxx_flags) $(depend_flags) $(depend_dir)/$*$(depend_suffix)" $(nvcc_flags) -c $< -o $@