diff --git a/configure.ac b/configure.ac index 90428945..bbcdaf1d 100755 --- a/configure.ac +++ b/configure.ac @@ -39,7 +39,6 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AC_SUBST(MAJOR_VERSION) AC_SUBST(MINOR_VERSION) -AC_ARG_VAR(CUDA_H_PATH, help-string) AC_ARG_VAR(RANLIB, ranlib tool) AC_ARG_ENABLE([ibv_wr_api], @@ -211,6 +210,40 @@ if [test $HAVE_EX = yes]; then AC_DEFINE([HAVE_EX], [1], [Have EX support]) fi + +# Legacy option to build with CUDA support, here for backwards compatibility. +if [test "$CUDA_H_PATH" ]; then + AC_MSG_WARN([You are using a deprecated method to build with CUDA support. Use the --with-cuda configure flag instead.]) + AC_DEFINE([HAVE_CUDA], [1], [Enable CUDA feature]) + AC_DEFINE_UNQUOTED([CUDA_PATH], "$CUDA_H_PATH" , [Enable CUDA feature]) + LIBS=$LIBS" -lcuda" +fi + +AC_ARG_ENABLE([cuda], + [AS_HELP_STRING([--enable-cuda], + [Enable CUDA benchmarks]) + ], + [], + [enable_cuda=no]) + +AC_ARG_WITH([cuda], + [AS_HELP_STRING([--with-cuda=@<:@CUDA installation path@:>@], + [Provide path to CUDA installation]) + ], + [AS_CASE([$with_cuda], + [yes|no], [], + [CPPFLAGS="-I$with_cuda/include $CPPFLAGS" + LDFLAGS="-L$with_cuda/lib64 -Wl,-rpath=$with_cuda/lib64 -L$with_cuda/lib -Wl,-rpath=$with_cuda/lib -lcuda -lcudart $LDFLAGS"]) + ]) + +AS_IF([test "x$enable_cuda" = xyes], [ + AC_DEFINE([HAVE_CUDA], [1], [Enable CUDA benchmarks]) + AC_CHECK_HEADERS([cuda.h], [], + [AC_MSG_ERROR([cannot include cuda.h])]) + AC_SEARCH_LIBS([cuda], [cuMemAlloc], [], + [AC_MSG_ERROR([cannot link with -lcuda])]) + ]) + AC_ARG_ENABLE([rocm], [AS_HELP_STRING([--enable-rocm], [Enable ROCm benchmarks]) @@ -247,12 +280,6 @@ if [test $HAVE_EX_ODP = yes] && [test $HAVE_EX = yes]; then AC_DEFINE([HAVE_EX_ODP], [1], [Have Extended ODP support]) fi -if [test "$CUDA_H_PATH" ]; then - AC_DEFINE([HAVE_CUDA], [1], [Enable CUDA feature]) - AC_DEFINE_UNQUOTED([CUDA_PATH], "$CUDA_H_PATH" , [Enable CUDA feature]) - LIBS=$LIBS" -lcuda" -fi - AC_TRY_LINK([#include ], [struct ibv_qp_attr *attr; int x = attr->rate_limit;],[HAVE_PACKET_PACING=yes], [HAVE_PACKET_PACING=no]) AM_CONDITIONAL([HAVE_PACKET_PACING],[test "x$HAVE_PACKET_PACING" = "xyes"]) diff --git a/src/perftest_parameters.h b/src/perftest_parameters.h index c8fa51f7..71c2cda5 100755 --- a/src/perftest_parameters.h +++ b/src/perftest_parameters.h @@ -67,7 +67,7 @@ #endif #ifdef HAVE_CUDA -#include CUDA_PATH +#include #endif #ifdef HAVE_ROCM