diff --git a/src/Makefile b/src/Makefile index 2440db1..0770f08 100644 --- a/src/Makefile +++ b/src/Makefile @@ -13,14 +13,25 @@ CUDA_LIB ?= $(CUDA_HOME)/lib64 CUDA_INC ?= $(CUDA_HOME)/include NVCC = $(CUDA_HOME)/bin/nvcc +CUDA_VERSION = $(strip $(shell which $(NVCC) >/dev/null && $(NVCC) --version | grep release | sed 's/.*release //' | sed 's/\,.*//')) +CUDA_MAJOR = $(shell echo $(CUDA_VERSION) | cut -d "." -f 1) + # Better define NVCC_GENCODE in your environment to the minimal set # of archs to reduce compile time. +ifeq ($(shell test "0$(CUDA_MAJOR)" -ge 11; echo $$?),0) +NVCC_GENCODE ?= -gencode=arch=compute_60,code=sm_60 \ + -gencode=arch=compute_61,code=sm_61 \ + -genncode=arch=compute_70,code=sm_70 \ + -gencode=arch=compute_80,code=sm_80 \ + -gencode=arch=compute_80,code=compute_80 +else NVCC_GENCODE ?= -gencode=arch=compute_35,code=sm_35 \ -gencode=arch=compute_50,code=sm_50 \ - -gencode=arch=compute_60,code=sm_60 \ + -gencode=arch=compute_60,code=sm_60 \ -gencode=arch=compute_61,code=sm_61 \ - -gencode=arch=compute_70,code=compute_70 \ - -gencode=arch=compute_70,code=sm_70 + -gencode=arch=compute_70,code=sm_70 \ + -gencode=arch=compute_70,code=compute_70 +endif NVCUFLAGS := -ccbin $(CXX) $(NVCC_GENCODE) -std=c++11