|
27 | 27 | dnl $HEADER$ |
28 | 28 | dnl |
29 | 29 |
|
| 30 | + |
| 31 | +# OPAL_CHECK_CUDA(prefix, [action-if-found], [action-if-not-found]) |
| 32 | +# -------------------------------------------------------- |
| 33 | +# check if CUDA support can be found. sets prefix_{CPPFLAGS, |
| 34 | +# LDFLAGS, LIBS} as needed and runs action-if-found if there is |
| 35 | +# support, otherwise executes action-if-not-found |
| 36 | + |
| 37 | +# |
| 38 | +# Check for CUDA support |
| 39 | +# |
30 | 40 | AC_DEFUN([OPAL_CHECK_CUDA],[ |
| 41 | +OPAL_VAR_SCOPE_PUSH([cuda_save_CPPFLAGS cuda_save_LDFLAGS cuda_save_LIBS]) |
| 42 | +
|
| 43 | +cuda_save_CPPFLAGS="$CPPFLAGS" |
| 44 | +cuda_save_LDFLAGS="$LDFLAGS" |
| 45 | +cuda_save_LIBS="$LIBS" |
31 | 46 | # |
32 | 47 | # Check to see if user wants CUDA support |
33 | 48 | # |
@@ -72,12 +87,15 @@ AS_IF([test "$with_cuda" = "no" || test "x$with_cuda" = "x"], |
72 | 87 | opal_cuda_incdir="$with_cuda/include" |
73 | 88 | AC_MSG_RESULT([found ($opal_cuda_incdir/cuda.h)])])])])]) |
74 | 89 |
|
75 | | -dnl We cannot have CUDA support without dlopen support. HOWEVER, at |
76 | | -dnl this point in configure, we can't know whether the DL framework |
77 | | -dnl has been configured or not yet (it likely hasn't, since CUDA is a |
78 | | -dnl common framework, and likely configured first). So we have to |
79 | | -dnl defer this check until later (see the OPAL_CHECK_CUDA_AFTER_OPAL_DL m4 |
80 | | -dnl macro, below). :-( |
| 90 | +AS_IF([test "$opal_check_cuda_happy" = "yes"], |
| 91 | + [OAC_CHECK_PACKAGE([cuda], |
| 92 | + [$1], |
| 93 | + [cuda.h], |
| 94 | + [cuda], |
| 95 | + [cuMemFree], |
| 96 | + [opal_check_cuda_happy="yes"], |
| 97 | + [opal_check_cuda_happy="no"])], |
| 98 | + []) |
81 | 99 |
|
82 | 100 | # We require CUDA IPC support which started in CUDA 4.1. Error |
83 | 101 | # out if the support is not there. |
@@ -144,22 +162,9 @@ AM_CONDITIONAL([OPAL_cuda_gdr_support], [test "x$CUDA_VERSION_60_OR_GREATER" = " |
144 | 162 | AC_DEFINE_UNQUOTED([OPAL_CUDA_GDR_SUPPORT],$CUDA_VERSION_60_OR_GREATER, |
145 | 163 | [Whether we have CUDA GDR support available]) |
146 | 164 |
|
| 165 | +CPPFLAGS=${cuda_save_CPPFLAGS} |
| 166 | +LDFLAGS=${cuda_save_LDFLAGS} |
| 167 | +LIBS=${cuda_save_LIBS} |
| 168 | +OPAL_VAR_SCOPE_POP |
147 | 169 | ]) |
148 | 170 |
|
149 | | -dnl |
150 | | -dnl CUDA support requires DL support (it dynamically opens the CUDA |
151 | | -dnl library at run time). But we do not check for OPAL DL support |
152 | | -dnl until lafter the initial OPAL_CHECK_CUDA is called. So put the |
153 | | -dnl CUDA+DL check in a separate macro that can be called after the DL MCA |
154 | | -dnl framework checks in the top-level configure.ac. |
155 | | -dnl |
156 | | -AC_DEFUN([OPAL_CHECK_CUDA_AFTER_OPAL_DL],[ |
157 | | -
|
158 | | - # We cannot have CUDA support without OPAL DL support. Error out |
159 | | - # if the user wants CUDA but we do not have OPAL DL support. |
160 | | - AS_IF([test $OPAL_HAVE_DL_SUPPORT -eq 0 && \ |
161 | | - test "$opal_check_cuda_happy" = "yes"], |
162 | | - [AC_MSG_WARN([--with-cuda was specified, but dlopen support is disabled.]) |
163 | | - AC_MSG_WARN([You must reconfigure Open MPI with dlopen ("dl") support.]) |
164 | | - AC_MSG_ERROR([Cannot continue.])]) |
165 | | -]) |
|
0 commit comments