Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure: Cleanup CUDA configury #152

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 34 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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([cuMemAlloc], [cuda], [],
[AC_MSG_ERROR([cannot link with -lcuda])])
])

AC_ARG_ENABLE([rocm],
[AS_HELP_STRING([--enable-rocm],
[Enable ROCm benchmarks])
Expand Down Expand Up @@ -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 <infiniband/verbs.h>],
[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"])
Expand Down
2 changes: 1 addition & 1 deletion src/perftest_parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
#endif

#ifdef HAVE_CUDA
#include CUDA_PATH
#include <cuda.h>
#endif

#ifdef HAVE_ROCM
Expand Down