Files
hdf5/cuda.mk.in
2020-07-01 05:49:12 -07:00

49 lines
1.4 KiB
Makefile

# 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 $@