diff options
| author | Willem Jan Palenstijn <wjp@usecode.org> | 2015-02-25 17:28:47 +0100 | 
|---|---|---|
| committer | Willem Jan Palenstijn <wjp@usecode.org> | 2015-02-25 17:28:47 +0100 | 
| commit | 51a1313422e22dbb6a5ca8f780a39561fc737403 (patch) | |
| tree | 3aa78132720d217f5bd3a6965b92c9ffb651a5c2 | |
| parent | 214a5429db07e3e18af5856e164f850fbabca427 (diff) | |
| parent | c2005e33b2152ca7cd306590ea22fe1c1bd68c29 (diff) | |
| download | astra-51a1313422e22dbb6a5ca8f780a39561fc737403.tar.gz astra-51a1313422e22dbb6a5ca8f780a39561fc737403.tar.bz2 astra-51a1313422e22dbb6a5ca8f780a39561fc737403.tar.xz astra-51a1313422e22dbb6a5ca8f780a39561fc737403.zip | |
Merge pull request #17 from wjp/nvcc_config
Clean up and improve nvcc/cuda configure checks
| -rw-r--r-- | build/linux/acinclude.m4 | 15 | ||||
| -rw-r--r-- | build/linux/configure.ac | 59 | 
2 files changed, 40 insertions, 34 deletions
| diff --git a/build/linux/acinclude.m4 b/build/linux/acinclude.m4 index 4ff9e4b..713b5d3 100644 --- a/build/linux/acinclude.m4 +++ b/build/linux/acinclude.m4 @@ -60,8 +60,14 @@ AC_DEFUN([ASTRA_RUN_STOREOUTPUT],[{    test $ac_status = 0;   }]) -dnl ASTRA_RUN(command) -AC_DEFUN([ASTRA_RUN],[ASTRA_RUN_STOREOUTPUT($1,/dev/null)]) +dnl ASTRA_RUN_LOGOUTPUT(command) +AC_DEFUN([ASTRA_RUN_LOGOUTPUT],[{ +  AS_ECHO(["$as_me:${as_lineno-$LINENO}: $1"]) >&AS_MESSAGE_LOG_FD +  ( $1 ) >&AS_MESSAGE_LOG_FD 2>&1 +  ac_status=$? +  AS_ECHO(["$as_me:${as_lineno-$LINENO}: \$? = $ac_status"]) >&AS_MESSAGE_LOG_FD +  test $ac_status = 0; + }]) @@ -79,9 +85,9 @@ ASTRA_RUN_STOREOUTPUT([$NVCC -c -o conftest.o conftest.cu $$2],conftest.nvcc.out    $1="no"    # Check if hack for gcc 4.4 helps    if grep -q __builtin_stdarg_start conftest.nvcc.out; then +    AS_ECHO(["$as_me:${as_lineno-$LINENO}: Trying CUDA hack for gcc 4.4"]) >&AS_MESSAGE_LOG_FD      NVCC_OPT="-Xcompiler -D__builtin_stdarg_start=__builtin_va_start" - -    ASTRA_RUN([$NVCC -c -o conftest.o conftest.cu $$2 $NVCC_OPT]) && { +    ASTRA_RUN_LOGOUTPUT([$NVCC -c -o conftest.o conftest.cu $$2 $NVCC_OPT]) && {        $1="yes"        $2="$$2 $NVCC_OPT"      } @@ -94,6 +100,7 @@ fi  rm -f conftest.cu conftest.o conftest.nvcc.out  ]) +  dnl ASTRA_FIND_NVCC_ARCHS(archs-to-try,cppflags-to-extend,output-list)  dnl Architectures should be of the form 10,20,30,35,  dnl and should be in order. The last accepted one will be used for PTX output. diff --git a/build/linux/configure.ac b/build/linux/configure.ac index 24f0124..7397986 100644 --- a/build/linux/configure.ac +++ b/build/linux/configure.ac @@ -55,7 +55,7 @@ AC_MSG_CHECKING([for boost-unit-test-framework])  ASTRA_CHECK_BOOST_UNIT_TEST_FRAMEWORK(-lboost_unit_test_framework-mt, BOOSTUTF=yes_mt, BOOSTUTF=no)  if test x$BOOSTUTF = xno; then    ASTRA_CHECK_BOOST_UNIT_TEST_FRAMEWORK(-lboost_unit_test_framework, BOOSTUTF=yes, BOOSTUTF=no) -  if test x$BOOSTTHREAD = xno; then +  if test x$BOOSTUTF = xno; then      AC_MSG_RESULT(no)      AC_MSG_ERROR([No boost-unit-test-framework library found])    else @@ -66,48 +66,41 @@ else    AC_MSG_RESULT([yes, libboost_unit_test_framework-mt])    LIBS_BOOSTUTF="-lboost_unit_test_framework-mt"  fi -# TODO: do something with the result  # nvcc, cuda  AC_ARG_WITH(cuda, [[  --with-cuda=path        path of CUDA SDK (optional)]],,) -NVCC_PATH=$PATH -if test x"$with_cuda" != x; then -  NVCC_PATH="$with_cuda/bin:$NVCC_PATH" +if test x"$with_cuda" != xno; then +  NVCC_PATH=$PATH +  if test x"$with_cuda" != x -a x"$with_cuda" != xyes; then +    NVCC_PATH="$with_cuda/bin:$NVCC_PATH" +  fi +  AC_PATH_PROG([NVCC], [nvcc], [no], [$NVCC_PATH]) +else +  NVCC=no  fi -AC_PATH_PROG([NVCC], [nvcc], [no], [$NVCC_PATH]) -# TODO: do something with the result  HAVECUDA=no  if test x"$NVCC" != xno; then    HAVECUDA=yes    BACKUP_CUDA_LDFLAGS="$LDFLAGS" -  if test x"$with_cuda" != x; then -    LDFLAGS_CUDA="-L$with_cuda/lib" +  if test x"$with_cuda" != x -a x"$with_cuda" != xyes; then +    case $host_cpu in +    x86_64) +      LDFLAGS_CUDA="-L$with_cuda/lib64" +      ;; +    *) +      LDFLAGS_CUDA="-L$with_cuda/lib" +      ;; +    esac      CPPFLAGS_CUDA="-I$with_cuda/include"      LDFLAGS="$LDFLAGS $LDFLAGS_CUDA"    fi    AC_CHECK_LIB(cudart,cudaMalloc, ,HAVECUDA=no)    AC_CHECK_LIB(cufft,cufftPlan1d, ,HAVECUDA=no) -  if test x"$HAVECUDA" = xno; then -    # try lib64 instead of lib - -    HAVECUDA=yes -    LDFLAGS="$BACKUP_CUDA_LDFLAGS" - -    # prevent cached values from being used -    unset ac_cv_lib_cudart_cudaMalloc -    unset ac_cv_lib_cufft_cufftPlan1d - -    LDFLAGS_CUDA="-L$with_cuda/lib64" -    LDFLAGS="$LDFLAGS $LDFLAGS_CUDA" -    AC_CHECK_LIB(cudart,cudaMalloc, ,HAVECUDA=no) -    AC_CHECK_LIB(cufft,cufftPlan1d, ,HAVECUDA=no) -  fi -    LDFLAGS="$BACKUP_CUDA_LDFLAGS"    unset BACKUP_CUDA_LDFLAGS    # TODO: check for cuda headers? @@ -116,11 +109,11 @@ if test x"$NVCC" != xno; then  fi  NVCCFLAGS="" -AC_MSG_CHECKING([if nvcc works])  if test x"$HAVECUDA" = xyes; then +  AC_MSG_CHECKING([if nvcc works])    ASTRA_CHECK_NVCC(HAVECUDA,NVCCFLAGS) +  AC_MSG_RESULT($HAVECUDA)  fi -AC_MSG_RESULT($HAVECUDA)  AC_ARG_WITH(cuda_compute, [[  --with-cuda-compute=archs  comma separated list of CUDA compute models (optional)]],,)  if test x"$HAVECUDA" = xyes; then @@ -155,7 +148,7 @@ if test x"$with_matlab" != x; then      AC_SUBST(MEX)      MATLAB_ROOT="$with_matlab"      AC_SUBST(MATLAB_ROOT) - +    # TODO: maybe catch mex warnings      ASTRA_CHECK_MEX_SUFFIX([mexa64 mexglx mexmaci64 mexmaci],[MEXSUFFIX])      if test x$MEXSUFFIX = x; then        AC_MSG_FAILURE([Unable to determine matlab mex suffix]) @@ -181,7 +174,13 @@ AC_SUBST(SAVED_CPPFLAGS)  AC_SUBST(SAVED_CXXFLAGS)  AC_SUBST(SAVED_LDFLAGS)  AC_SUBST(SAVED_LIBS) - -  AC_CONFIG_FILES([Makefile])  AC_OUTPUT + +echo +echo "Summary of ASTRA Toolbox build options:" +echo "  CUDA   : $HAVECUDA" +echo "  Matlab : $HAVEMATLAB" +echo +echo "  prefix : $prefix" +echo | 
