From 696e4d2003aee186580f11545d4d25117d6ccaaa Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Fri, 10 Jul 2020 08:59:21 +0200 Subject: [PATCH] Partially revert "Configure: do not include CC for generating CUDA code" This reverts commit 0c4a54cce1159d93752d9f9d01731d73659ce0dc. Only omit CUDA compute flags for nvcc, not clang. --- Makefile.in | 2 +- configure.ac | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index b3d4c6aad..f2e26b059 100644 --- a/Makefile.in +++ b/Makefile.in @@ -11,7 +11,7 @@ CFLAGS = @CFLAGS@ $(COMMON_FLAGS) -Werror=implicit-function-declaration - CPPFLAGS = @CPPFLAGS@ -D_GNU_SOURCE CXXFLAGS = @CXXFLAGS@ $(COMMON_FLAGS) -D_GNU_SOURCE MKDIR_P = mkdir -p -CUDA_FLAGS = @CUDA_FLAGS@ +CUDA_FLAGS = @CUDA_FLAGS@ @CUDA_COMPUTE_ARGS@ LDFLAGS = @LDFLAGS@ LIBS += @LIBS@ @MATHLIBS@ -lm -pthread INC = -Isrc -I$(srcdir) -I$(srcdir)/src -I$(srcdir)/test -Idxt_compress \ diff --git a/configure.ac b/configure.ac index 69db50818..7f6039ebd 100644 --- a/configure.ac +++ b/configure.ac @@ -2071,6 +2071,7 @@ fi # 3) default system path (PATH, LD_LIBRARY_PATH, C_INCLUDE_PATH/CPATH) # 4) default CUDA path +CUDA_COMPUTE_ARGS="" CUDA_COMPILER="" CUDA_INC= @@ -2154,7 +2155,20 @@ AC_ARG_WITH(cuda-compiler, [CUDA_COMPILER="$withval"], []) -HOST_CC_REPORT=" ("$(basename "$CUDA_COMPILER") +HOST_CC_REPORT=" (" +case "$CUDA_COMPILER" in + *nvcc*) + ;; + *clang*) + CUDA_COMPUTE_ARGS="--cuda-gpu-arch=sm_30 --cuda-gpu-arch=sm_35" + ;; + "") + ;; + *) + AC_MSG_WARN([Unsupported cuda compiler $CUDA_COMPILER]) + ;; +esac +HOST_CC_REPORT="$HOST_CC_REPORT"$(basename "$CUDA_COMPILER") # CUDA host compiler AC_ARG_WITH(cuda-host-compiler, @@ -2181,6 +2195,7 @@ AC_SUBST(CUDA_PATH) AC_SUBST(CUDA_LIB) AC_SUBST(CUDA_INC) AC_SUBST(CUDA_COMPILER) +AC_SUBST(CUDA_COMPUTE_ARGS) # ------------------------------------------------------------------------------------------------- # GPUJPEG