Parcourir la source

configure.ac: check if CUDA is working properly before enabling it

Nathalie Furmento il y a 13 ans
Parent
commit
1f89f72a89
1 fichiers modifiés avec 18 ajouts et 1 suppressions
  1. 18 1
      configure.ac

+ 18 - 1
configure.ac

@@ -414,6 +414,19 @@ if test x$enable_cuda = xyes -o x$enable_cuda = xmaybe; then
         fi
     fi
 
+    # Check cuda is compatible with the C compiler
+    AC_MSG_CHECKING(whether CUDA is working)
+    if test "$have_valid_cuda" = "yes" ; then
+	AC_COMPILE_IFELSE(AC_LANG_PROGRAM(
+		[[#include <cuda.h>]],
+		[[]]
+		),
+	    [have_valid_cuda="yes"],
+	    [have_valid_cuda="no"],
+	)
+    fi
+    AC_MSG_RESULT($have_valid_cuda)
+
     # in case CUDA was explicitely required, but is not available, this is an error
     if test x$enable_cuda = xyes -a x$have_valid_cuda = xno; then
 	AC_MSG_ERROR([cannot find CUDA])
@@ -1518,16 +1531,20 @@ AC_CHECK_PROGS([ICC], [icc])
 # If cuda and icc are both available, check they are compatible
 if test "$enable_cuda" = "yes" -a "$ICC" != ""; then
    AC_MSG_CHECKING(whether CUDA and ICC are compatible)
+   OLD_CC=$CC
+   CC=$ICC
    AC_COMPILE_IFELSE(
        AC_LANG_PROGRAM(
 	   [[#include <cuda.h>]],
 	   [[]]
 	   ),
        AC_MSG_RESULT(yes),
-       [ICC="" 
+       [ICC=""
            AC_MSG_RESULT(no)]
    )
+   CC=$OLD_ICC
 fi
+
 # Disable ICC on windows
 if test "x$ICC" != "x" -a "$starpu_windows" = "yes" ; then
     ICC=""