Skip to content

Commit

Permalink
cuda: Tie libcuda check and tests
Browse files Browse the repository at this point in the history
The plugins don't have a link-time dependency on libcuda.so, so
only check for the library if we actually need it (ie, we're building
the functional tests).  This works around a problem building on
containers, where it's likely that the libcuda.so library is either
not there or stubbed out (to be pulled up from the base AMI later).

Signed-off-by: Brian Barrett <bbarrett@amazon.com>
  • Loading branch information
bwbarrett authored and rajachan committed Apr 11, 2024
1 parent d816ab1 commit b9c46d2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion m4/check_pkg_cuda.m4
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ AC_DEFUN([CHECK_PKG_CUDA], [
AS_IF([test "${check_pkg_found}" = "yes"],
[AC_CHECK_HEADERS([cuda.h], [], [check_pkg_found=no])])
AS_IF([test "${check_pkg_found}" = "yes"],
dnl We only need to include libcuda.so for the functional tests, as
dnl the plugins themselves dynamicly load libcuda at runtime. This
dnl is a problem when building in a container on a non-GPU instance,
dnl as frequently libcuda is pulled from the base AMI when using
dnl containers and not there on non-GPU instances, and this check
dnl would break the build in that situation. Since unit tests don't
dnl have to be built, only check for libcuda.so if we're building
dnl the unit tests.
AS_IF([test "${check_pkg_found}" = "yes" -a "${enable_tests}" != "no"],
[AC_SEARCH_LIBS([cuMemHostAlloc], [cuda], [CUDA_LIBS="-lcuda"], [check_pkg_found=no])])
AS_IF([test "${check_pkg_found}" = "yes"],
Expand Down

0 comments on commit b9c46d2

Please sign in to comment.