@@ -10,6 +10,14 @@ AS_IF([test "x$cuda_checked" != "xyes"],
1010 AC_ARG_WITH ( [ cuda] ,
1111 [ AS_HELP_STRING ( [ --with-cuda=(DIR)] , [ Enable the use of CUDA (default is guess).] ) ] ,
1212 [ ] , [ with_cuda=guess] )
13+ AC_ARG_WITH ( [ nvcc] ,
14+ AS_HELP_STRING ( [ --with-nvcc] , [ Enable NVCC compiler support (default is guess)] ) ,
15+ [ ] ,
16+ [ with_nvcc="guess"] )
17+ AC_ARG_WITH ( [ nvcc-gencode] ,
18+ AS_HELP_STRING ( [ --with-nvcc-gencode=(OPTS)] , [ Build for specific GPU architectures] ) ,
19+ [ ] ,
20+ [ with_nvcc_gencode="-gencode=arch=compute_80,code=sm_80"] )
1321
1422 AS_IF ( [ test "x$with_cuda" = "xno"] ,
1523 [
@@ -97,14 +105,19 @@ AS_IF([test "x$cuda_checked" != "xyes"],
97105
98106 # Check NVCC exists and able to compile
99107 nvcc_happy="no"
100- AC_PATH_PROGS ( NVCC , nvcc , "" , $CUDA_BIN_PATH:$PATH )
108+ AC_ARG_VAR ( [ NVCC] , [ nvcc compiler path] )
109+ AC_ARG_VAR ( [ NVCCFLAGS] , [ nvcc compiler flags] )
110+ AS_IF ( [ test "x$with_nvcc" != "xno"] ,
111+ [ AC_PATH_PROGS ( NVCC , nvcc , "" , $CUDA_BIN_PATH:$PATH ) ] )
112+
101113 AS_IF ( [ test "x$NVCC" != "x"] ,
102114 [ AC_LANG_PUSH ( [ C] )
103115 AC_LANG_CONFTEST ( [ AC_LANG_SOURCE ( [ [ #include <cuda_runtime.h>] ] ) ] )
104116 mv conftest.c conftest.cu
105117 AC_MSG_CHECKING ( [ $NVCC can compile] )
106118 AS_IF ( [ $NVCC -c conftest.cu 2>&AS_MESSAGE_LOG_FD ] ,
107119 [ AC_MSG_RESULT ( [ yes] )
120+ BASE_NVCCFLAGS="$BASE_NVCCFLAGS $with_nvcc_gencode -g -lineinfo"
108121 nvcc_happy="yes"] ,
109122 [ AC_MSG_RESULT ( [ no] )
110123 cat conftest.cu >&AS_MESSAGE_LOG_FD ] )
@@ -116,6 +129,10 @@ AS_IF([test "x$cuda_checked" != "xyes"],
116129 LDFLAGS="$save_LDFLAGS"
117130 LIBS="$save_LIBS"
118131
132+ AS_IF ( [ test "x$with_nvcc" = "xyes" -a "x$nvcc_happy" = "xno"] ,
133+ [ AC_MSG_ERROR ( [ nvcc compiler is not functional] ) ] ,
134+ [ ] )
135+
119136 AS_IF ( [ test "x$cuda_happy" = "xyes"] ,
120137 [ AC_SUBST ( [ CUDA_CPPFLAGS] , [ "$CUDA_CPPFLAGS"] )
121138 AC_SUBST ( [ CUDA_LDFLAGS] , [ "$CUDA_LDFLAGS"] )
0 commit comments