From c424ad94f3bb0229491571f1f934b7f186e956af Mon Sep 17 00:00:00 2001 From: Vasily Filipov Date: Mon, 24 Mar 2014 13:36:04 +0000 Subject: [PATCH] BTL/OPENIB: remove AC_RUN_IFELSE from configure and check AF_IB support by lib rdmacm during component_init. This commit was SVN r31194. --- ompi/mca/btl/openib/configure.m4 | 67 ++++++++----------- .../connect/btl_openib_connect_rdmacm.c | 29 ++++++++ 2 files changed, 57 insertions(+), 39 deletions(-) diff --git a/ompi/mca/btl/openib/configure.m4 b/ompi/mca/btl/openib/configure.m4 index 6ffe08d4b3..f2e8814de1 100644 --- a/ompi/mca/btl/openib/configure.m4 +++ b/ompi/mca/btl/openib/configure.m4 @@ -72,46 +72,35 @@ AC_DEFUN([MCA_ompi_btl_openib_CONFIG],[ "$have_threads" != "none"; then cpcs="$cpcs rdmacm" if test "$enable_openib_rdmacm_ibaddr" = "yes"; then - LDFLAGS_save="$LDFLAGS" - LIBS_save="$LIBS" - LDFLAGS="$LDFLAGS $btl_openib_LDFLAGS" - LIBS="$LIBS $btl_openib_LIBS" - AC_LANG(C) - AC_MSG_CHECKING([rsockets keepalive]) - AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [ - #include - #include - #include - #include - #include - #include - ], - [ - int rsock; - rsock = rsocket(AF_IB, SOCK_STREAM, 0); - if (rsock < 0) { - return -1; - } - rclose(rsock); - ] - )], - [ AC_MSG_RESULT([yes]) - AC_DEFINE(BTL_OPENIB_RDMACM_IB_ADDR, 1, rdmacm with rsockets support) - ], - [ AC_MSG_RESULT([no]) - AC_DEFINE(BTL_OPENIB_RDMACM_IB_ADDR, 0, rdmacm without rsockets support) - AC_MSG_WARN([rsockets does not support keepalives. librdmacm 1.0.18 or beyond is needed.]) - ], - [ - AC_MSG_WARN([cross compiling detected - disable IB addressing support in RDMACM openib BTL.]) - ] - ) - LDFLAGS="$LDFLAGS_save" - LIBS="$LIBS_save" + AC_MSG_CHECKING([IB addressing]) + AC_EGREP_CPP( + yes, + [ + #include + #ifdef AF_IB + yes + #endif + ], + [ + AC_CHECK_HEADERS( + [rdma/rsocket.h], + [ + AC_MSG_RESULT([yes]) + AC_DEFINE(BTL_OPENIB_RDMACM_IB_ADDR, 1, rdmacm IB_AF addressing support) + ], + [ + AC_MSG_RESULT([no]) + AC_DEFINE(BTL_OPENIB_RDMACM_IB_ADDR, 0, rdmacm without IB_AF addressing support) + AC_MSG_WARN([There is no IB_AF addressing support by lib rdmacm.]) + ] + )], + [ + AC_MSG_RESULT([no]) + AC_DEFINE(BTL_OPENIB_RDMACM_IB_ADDR, 0, rdmacm without IB_AF addressing support) + AC_MSG_WARN([There is no IB_AF addressing support by lib rdmacm.]) + ]) else - AC_DEFINE(BTL_OPENIB_RDMACM_IB_ADDR, 0, rdmacm without rsockets support) + AC_DEFINE(BTL_OPENIB_RDMACM_IB_ADDR, 0, rdmacm without IB_AF addressing support) fi fi if test "x$btl_openib_have_udcm" = "x1" -a \ diff --git a/ompi/mca/btl/openib/connect/btl_openib_connect_rdmacm.c b/ompi/mca/btl/openib/connect/btl_openib_connect_rdmacm.c index 2dd8e2cffc..7ee82b6846 100644 --- a/ompi/mca/btl/openib/connect/btl_openib_connect_rdmacm.c +++ b/ompi/mca/btl/openib/connect/btl_openib_connect_rdmacm.c @@ -59,6 +59,11 @@ #include "btl_openib_ini.h" #if BTL_OPENIB_RDMACM_IB_ADDR +#include +#include +#include +#include +#include #include #endif @@ -2269,6 +2274,21 @@ static int rdmacm_component_finalize(void) return OMPI_SUCCESS; } +#if BTL_OPENIB_RDMACM_IB_ADDR +static int rdmacm_check_ibaddr_support(void) +{ + int rsock; + rsock = rsocket(AF_IB, SOCK_STREAM, 0); + if (rsock < 0) { + return OMPI_ERROR; + } + + rclose(rsock); + + return OMPI_SUCCESS; +} +#endif + static int rdmacm_component_init(void) { int rc; @@ -2277,12 +2297,21 @@ static int rdmacm_component_init(void) OBJ_CONSTRUCT(&client_list, opal_list_t); OBJ_CONSTRUCT(&client_list_lock, opal_mutex_t); +#if !BTL_OPENIB_RDMACM_IB_ADDR rc = mca_btl_openib_build_rdma_addr_list(); if (OMPI_SUCCESS != rc) { opal_output_verbose(5, ompi_btl_base_framework.framework_output, "openib BTL: rdmacm CPC unable to find any valid IP address"); return OMPI_ERR_NOT_SUPPORTED; } +#else + rc = rdmacm_check_ibaddr_support(); + if (OMPI_SUCCESS != rc) { + opal_output_verbose(5, ompi_btl_base_framework.framework_output, + "There is no IB_AF addressing support by lib rdmacm"); + return OMPI_ERR_NOT_SUPPORTED; + } +#endif event_channel = rdma_create_event_channel(); if (NULL == event_channel) {