From 3da88f11f7a4e229ce02168f4397516817776bbc Mon Sep 17 00:00:00 2001 From: Mamzi Bayatpour <77160721+MamziB@users.noreply.github.com> Date: Sun, 20 Aug 2023 23:32:59 -0700 Subject: [PATCH] TL/MLX5: adding with-rdmacm config flag (#824) Co-authored-by: Manjunath Gorentla Venkata --- config/m4/rdmacm.m4 | 92 +++++++++++++++++++++++++++++ configure.ac | 5 ++ src/components/tl/mlx5/configure.m4 | 5 +- 3 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 config/m4/rdmacm.m4 diff --git a/config/m4/rdmacm.m4 b/config/m4/rdmacm.m4 new file mode 100644 index 0000000000..2a010bdc9b --- /dev/null +++ b/config/m4/rdmacm.m4 @@ -0,0 +1,92 @@ +# +# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# See file LICENSE for terms. +# + +AC_DEFUN([CHECK_RDMACM],[ +AS_IF([test "x$rdmacm_checked" != "xyes"],[ + rdmacm_happy="no" + + AC_ARG_WITH([rdmacm], + [AS_HELP_STRING([--with-rdmacm=(DIR)], [Enable the use of rdmacm (default is guess).])], + [], [with_rdmacm=guess]) + + AS_IF([test "x$with_rdmacm" != "xno"], + [ + save_CPPFLAGS="$CPPFLAGS" + save_CFLAGS="$CFLAGS" + save_LDFLAGS="$LDFLAGS" + + AS_IF([test ! -z "$with_rdmacm" -a "x$with_rdmacm" != "xyes" -a "x$with_rdmacm" != "xguess"], + [ + AS_IF([test ! -d $with_rdmacm], + [AC_MSG_ERROR([Provided "--with-rdmacm=${with_rdmacm}" location does not exist])], []) + check_rdmacm_dir="$with_rdmacm" + + ], + [ + check_rdmacm_dir="/usr" + ] + ) + + AS_IF([test -d "$check_rdmacm_dir/lib64"],[libsuff="64"],[libsuff=""]) + + check_rdmacm_libdir="$check_rdmacm_dir/lib$libsuff" + CPPFLAGS="-I$check_rdmacm_dir/include $save_CPPFLAGS" + LDFLAGS="-L$check_rdmacm_libdir $save_LDFLAGS" + + AC_CHECK_HEADER([$check_rdmacm_dir/include/rdma/rdma_cma.h], + [ + AC_CHECK_LIB([rdmacm], [rdma_establish], + [ + rdmacm_happy="yes" + ], + [ + rdmacm_happy="no" + ]) + ], + [ + AC_MSG_WARN([rdmacm header files not found]) + rdmacm_happy=no + ]) + + + AS_IF([test "x$rdmacm_happy" = "xyes"], + [ + AS_IF([test "x$check_rdmacm_dir" != "x"], + [ + AC_MSG_RESULT([rdmacm dir: $check_rdmacm_dir]) + AC_SUBST(RDMACM_CPPFLAGS, "-I$check_rdmacm_dir/include/") + ]) + + AS_IF([test "x$check_rdmacm_libdir" != "x"], + [ + AC_SUBST(RDMACM_LDFLAGS, "-L$check_rdmacm_libdir") + ]) + + AC_SUBST(RDMACM_LIBADD, "-lrdmacm") + AC_DEFINE([HAVE_RDMACM], [1], [rdmacm support]) + ], + [ + AS_IF([test "x$with_rdmacm" != "xguess"], + [ + AC_MSG_ERROR([rdmacm support is requested but rdmacm packages cannot be found $CPPFLAGS $LDFLAGS]) + ], + [ + AC_MSG_WARN([rdmacm not found]) + ]) + ]) + + CFLAGS="$save_CFLAGS" + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + + ], + [ + AC_MSG_WARN([rdmacm was explicitly disabled]) + ]) + + rdmacm_checked=yes + AM_CONDITIONAL([HAVE_RDMACM], [test "x$rdmacm_happy" != xno]) +]) +]) diff --git a/configure.ac b/configure.ac index f67a591f35..11c3e15a1b 100644 --- a/configure.ac +++ b/configure.ac @@ -160,6 +160,7 @@ AS_IF([test "x$with_docs_only" = xyes], AM_CONDITIONAL([HAVE_MPICXX], [false]) AM_CONDITIONAL([HAVE_PROFILING],[false]) AM_CONDITIONAL([HAVE_IBVERBS],[false]) + AM_CONDITIONAL([HAVE_RDMACM],[false]) AM_CONDITIONAL([HAVE_MLX5DV],[false]) ], [ @@ -175,6 +176,7 @@ AS_IF([test "x$with_docs_only" = xyes], m4_include([config/m4/sharp.m4]) m4_include([config/m4/mpi.m4]) m4_include([config/m4/ibverbs.m4]) + m4_include([config/m4/rdmacm.m4]) m4_include([config/m4/configure.m4]) m4_include([config/m4/tl_coll_plugins.m4]) m4_include([config/m4/check_tls.m4]) @@ -208,6 +210,9 @@ AS_IF([test "x$with_docs_only" = xyes], CHECK_IBVERBS AC_MSG_RESULT([IBVERBS support: $ibverbs_happy, MLX5DV support: $mlx5dv_happy]) + + CHECK_RDMACM + AC_MSG_RESULT([RDMACM support: $rdmacm_happy]) ]) # Docs only diff --git a/src/components/tl/mlx5/configure.m4 b/src/components/tl/mlx5/configure.m4 index 569b50e23c..45f0892ad8 100644 --- a/src/components/tl/mlx5/configure.m4 +++ b/src/components/tl/mlx5/configure.m4 @@ -6,8 +6,11 @@ tl_mlx5_enabled=n CHECK_TLS_REQUIRED(["mlx5"]) AS_IF([test "$CHECKED_TL_REQUIRED" = "y"], [ + CHECK_RDMACM + AC_MSG_RESULT([RDMACM support: $rdmacm_happy]) + mlx5_happy=no - if test "x$mlx5dv_happy" = "xyes" -a "x$have_mlx5dv_wr_raw_wqe" = "xyes"; then + if test "x$mlx5dv_happy" = "xyes" -a "x$have_mlx5dv_wr_raw_wqe" = "xyes" -a "x$rdmacm_happy" = "xyes"; then mlx5_happy=yes fi AC_MSG_RESULT([MLX5 support: $mlx5_happy])