1
1

BTL/OPENIB: remove AC_RUN_IFELSE from configure and check AF_IB support by lib rdmacm during component_init.

This commit was SVN r31194.
Этот коммит содержится в:
Vasily Filipov 2014-03-24 13:36:04 +00:00
родитель 15a8c9d7b8
Коммит c424ad94f3
2 изменённых файлов: 57 добавлений и 39 удалений

Просмотреть файл

@ -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 <stdio.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <sys/types.h>
#include <rdma/rsocket.h>
#include <infiniband/ib.h>
],
[
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 <infiniband/ib.h>
#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 \

Просмотреть файл

@ -59,6 +59,11 @@
#include "btl_openib_ini.h"
#if BTL_OPENIB_RDMACM_IB_ADDR
#include <stdio.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <sys/types.h>
#include <rdma/rsocket.h>
#include <infiniband/ib.h>
#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) {