1
1
openmpi/config/ompi_check_openib.m4

224 строки
9.6 KiB
Plaintext
Исходник Обычный вид История

# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2006-2008 Mellanox Technologies. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# OMPI_CHECK_OPENIB(prefix, [action-if-found], [action-if-not-found])
# --------------------------------------------------------
# check if OPENIB support can be found. sets prefix_{CPPFLAGS,
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
# support, otherwise executes action-if-not-found
AC_DEFUN([OMPI_CHECK_OPENIB],[
OMPI_VAR_SCOPE_PUSH([$1_msg])
#
# Openfabrics support
#
AC_ARG_WITH([openib],
[AC_HELP_STRING([--with-openib(=DIR)],
[Build OpenFabrics support, searching for libraries in DIR])])
AC_ARG_WITH([openib-libdir],
[AC_HELP_STRING([--with-openib-libdir=DIR],
[Search for OpenFabrics libraries in DIR])])
#
# ConnectX XRC support
#
AC_ARG_ENABLE([connectx-xrc],
[AC_HELP_STRING([--enable-openib-connectx-xrc],
[Enable ConnectX XRC support. If you do not have InfiniBand ConnectX adapters, you may disable the ConnectX XRC support. If you do not know which InfiniBand adapter is installed on your cluster, leave this option enabled (default: enabled)])],
[enable_connectx_xrc="$enableval"], [enable_connectx_xrc="yes"])
#
# Openfabrics IBCM
#
AC_ARG_ENABLE([openib-ibcm],
[AC_HELP_STRING([--enable-openib-ibcm],
[Enable Open Fabrics IBCM support in openib BTL (default: enabled)])],
[enable_openib_ibcm="$enableval"], [enable_openib_ibcm="yes"])
#
# Openfabrics RDMACM
#
AC_ARG_ENABLE([openib-rdmacm],
[AC_HELP_STRING([--enable-openib-rdmacm],
[Enable Open Fabrics RDMACM support in openib BTL (default: enabled)])],
[enable_openib_rdmacm="$enableval"], [enable_openib_rdmacm="yes"])
2005-11-28 23:44:53 +03:00
AS_IF([test ! -z "$with_openib" -a "$with_openib" != "yes"],
[ompi_check_openib_dir="$with_openib"])
AS_IF([test ! -z "$with_openib_libdir" -a "$with_openib_libdir" != "yes"],
[ompi_check_openib_libdir="$with_openib_libdir"])
AS_IF([test "$with_openib" = "no"],
[ompi_check_openib_happy="no"],
[ompi_check_openib_happy="yes"])
ompi_check_openib_$1_save_CPPFLAGS="$CPPFLAGS"
ompi_check_openib_$1_save_LDFLAGS="$LDFLAGS"
ompi_check_openib_$1_save_LIBS="$LIBS"
AS_IF([test "$ompi_check_openib_happy" = "yes"],
[AS_IF([test "$THREAD_TYPE" != "posix" -a "$memory_ptmalloc2_happy" = "yes"],
[AC_MSG_WARN([POSIX Threads disabled but PTMalloc2 enabled.])
AC_MSG_WARN([This will cause memory corruption with OpenFabrics.])
AC_MSG_WARN([Not building component.])
ompi_check_openib_happy="no"])])
This commit brings in two major things: 1. Galen's fine-grain control of queue pair resources in the openib BTL. 1. Pasha's new implementation of asychronous HCA event handling. Pasha's new implementation doesn't take much explanation, but the new "multifrag" stuff does. Note that "svn merge" was not used to bring this new code from the /tmp/ib_multifrag branch -- something Bad happened in the periodic trunk pulls on that branch making an actual merge back to the trunk effectively impossible (i.e., lots and lots of arbitrary conflicts and artifical changes). :-( == Fine-grain control of queue pair resources == Galen's fine-grain control of queue pair resources to the OpenIB BTL (thanks to Gleb for fixing broken code and providing additional functionality, Pasha for finding broken code, and Jeff for doing all the svn work and regression testing). Prior to this commit, the OpenIB BTL created two queue pairs: one for eager size fragments and one for max send size fragments. When the use of the shared receive queue (SRQ) was specified (via "-mca btl_openib_use_srq 1"), these QPs would use a shared receive queue for receive buffers instead of the default per-peer (PP) receive queues and buffers. One consequence of this design is that receive buffer utilization (the size of the data received as a percentage of the receive buffer used for the data) was quite poor for a number of applications. The new design allows multiple QPs to be specified at runtime. Each QP can be setup to use PP or SRQ receive buffers as well as giving fine-grained control over receive buffer size, number of receive buffers to post, when to replenish the receive queue (low water mark) and for SRQ QPs, the number of outstanding sends can also be specified. The following is an example of the syntax to describe QPs to the OpenIB BTL using the new MCA parameter btl_openib_receive_queues: {{{ -mca btl_openib_receive_queues \ "P,128,16,4;S,1024,256,128,32;S,4096,256,128,32;S,65536,256,128,32" }}} Each QP description is delimited by ";" (semicolon) with individual fields of the QP description delimited by "," (comma). The above example therefore describes 4 QPs. The first QP is: P,128,16,4 Meaning: per-peer receive buffer QPs are indicated by a starting field of "P"; the first QP (shown above) is therefore a per-peer based QP. The second field indicates the size of the receive buffer in bytes (128 bytes). The third field indicates the number of receive buffers to allocate to the QP (16). The fourth field indicates the low watermark for receive buffers at which time the BTL will repost receive buffers to the QP (4). The second QP is: S,1024,256,128,32 Shared receive queue based QPs are indicated by a starting field of "S"; the second QP (shown above) is therefore a shared receive queue based QP. The second, third and fourth fields are the same as in the per-peer based QP. The fifth field is the number of outstanding sends that are allowed at a given time on the QP (32). This provides a "good enough" mechanism of flow control for some regular communication patterns. QPs MUST be specified in ascending receive buffer size order. This requirement may be removed prior to 1.3 release. This commit was SVN r15474.
2007-07-18 05:15:59 +04:00
AS_IF([test "$ompi_check_openib_happy" = "yes"],
[AC_CHECK_HEADERS(
fcntl.h sys/poll.h,
[],
[AC_MSG_WARN([fcntl.h sys/poll.h not found. Can not build component.])
ompi_check_openib_happy="no"])])
AS_IF([test "$ompi_check_openib_happy" = "yes"],
[OMPI_CHECK_PACKAGE([$1],
[infiniband/verbs.h],
[ibverbs],
[ibv_open_device],
[],
[$ompi_check_openib_dir],
[$ompi_check_openib_libdir],
[ompi_check_openib_happy="yes"],
[ompi_check_openib_happy="no"])])
CPPFLAGS="$CPPFLAGS $$1_CPPFLAGS"
LDFLAGS="$LDFLAGS $$1_LDFLAGS"
LIBS="$LIBS $$1_LIBS"
AS_IF([test "$ompi_check_openib_happy" = "yes"],
[AC_CACHE_CHECK(
[number of arguments to ibv_create_cq],
[ompi_cv_func_ibv_create_cq_args],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <infiniband/verbs.h> ]],
[[ibv_create_cq(NULL, 0, NULL, NULL, 0);]])],
[ompi_cv_func_ibv_create_cq_args=5],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <infiniband/verbs.h> ]],
[[ibv_create_cq(NULL, 0, NULL);]])],
[ompi_cv_func_ibv_create_cq_args=3],
[ompi_cv_func_ibv_create_cq_args="unknown"])])])
AS_IF([test "$ompi_cv_func_ibv_create_cq_args" = "unknown"],
[AC_MSG_WARN([Can not determine number of args to ibv_create_cq.])
AC_MSG_WARN([Not building component.])
ompi_check_openib_happy="no"],
[AC_DEFINE_UNQUOTED([OMPI_IBV_CREATE_CQ_ARGS],
[$ompi_cv_func_ibv_create_cq_args],
[Number of arguments to ibv_create_cq])])])
# Set these up so that we can do an AC_DEFINE below
# (unconditionally)
$1_have_xrc=0
$1_have_rdmacm=0
$1_have_ibcm=0
# If we have the openib stuff available, find out what we've got
AS_IF([test "$ompi_check_openib_happy" = "yes"],
[AC_CHECK_DECLS([IBV_EVENT_CLIENT_REREGISTER], [], [],
[#include <infiniband/verbs.h>])
AC_CHECK_FUNCS([ibv_get_device_list ibv_resize_cq])
# struct ibv_device.transport_type was added in OFED v1.2
AC_CHECK_MEMBERS([struct ibv_device.transport_type], [], [],
[#include <infiniband/verbs.h>])
# ibv_create_xrc_rcv_qp was added in OFED 1.3
if test "$enable_connectx_xrc" = "yes"; then
AC_CHECK_FUNCS([ibv_create_xrc_rcv_qp], [$1_have_xrc=1])
fi
# Do we have a recent enough RDMA CM? Need to have the
# rdma_get_peer_addr (inline) function (originally appeared
# in OFED v1.3).
if test "$enable_openib_rdmacm" = "yes"; then
AC_CHECK_HEADERS([rdma/rdma_cma.h],
[AC_CHECK_LIB([rdmacm], [rdma_create_id],
[AC_MSG_CHECKING([for rdma_get_peer_addr])
$1_msg=no
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "rdma/rdma_cma.h"
]], [[void *ret = (void*) rdma_get_peer_addr((struct rdma_cm_id*)0);]])],
[$1_have_rdmacm=1
$1_msg=yes])
AC_MSG_RESULT([$$1_msg])])])
if test "1" = "$$1_have_rdmacm"; then
$1_LIBS="-lrdmacm $$1_LIBS"
fi
fi
# Do we have IB CM? (note that OFED IB CM depends on RDMA
# CM, so no need to add it into the other-libraries
# argument to AC_CHECK_ LIB). Note that we only want IBCM
# starting with OFED 1.2 or so, so check for
# ib_cm_open_device (introduced in libibcm 1.0/OFED 1.2).
if test "$enable_openib_ibcm" = "yes"; then
AC_CHECK_HEADERS([infiniband/cm.h asm/byteorder.h],
[AC_CHECK_LIB([ibcm], [ib_cm_open_device],
[$1_have_ibcm=1
$1_LIBS="-libcm $$1_LIBS"])])
fi
])
AC_MSG_CHECKING([if ConnectX XRC support is enabled])
AC_DEFINE_UNQUOTED([OMPI_HAVE_CONNECTX_XRC], [$$1_have_xrc],
[Enable features required for ConnectX XRC support])
if test "1" = "$$1_have_xrc"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_MSG_CHECKING([if OpenFabrics RDMACM support is enabled])
AC_DEFINE_UNQUOTED([OMPI_HAVE_RDMACM], [$$1_have_rdmacm],
[Whether RDMA CM is available or not])
if test "1" = "$$1_have_rdmacm"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_MSG_CHECKING([if OpenFabrics IBCM support is enabled])
AC_DEFINE_UNQUOTED([OMPI_HAVE_IBCM], [$$1_have_ibcm],
[Whether IB CM is available or not])
if test "1" = "$$1_have_ibcm"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
CPPFLAGS="$ompi_check_openib_$1_save_CPPFLAGS"
LDFLAGS="$ompi_check_openib_$1_save_LDFLAGS"
LIBS="$ompi_check_openib_$1_save_LIBS"
AS_IF([test "$ompi_check_openib_happy" = "yes"],
[$2],
2005-11-28 23:44:53 +03:00
[AS_IF([test ! -z "$with_openib" -a "$with_openib" != "no"],
Fixes trac:1045. libsysfs headers are required for libibverbs v1.0 (i.e., OFED 1.0 and OFED 1.1), meaning that <infiniband/verbs.h> would #include <sysfs/libsysfs.h>. Hence, if the libsysfs headers did not exist on a system, including <verbs.h> would fail. With older versions of Autoconf, we would simply test for the ''presence'' of the <infinband/verbs.h> and not actually try to ''use'' it. This could leave OMPI in a weird situation on systems that did not have the sysfs headers installed: configure would complete successfully, but the build of the openib btl would fail. Some users complained, thinking that there was a real compile error in the OMPI code base. Hence, we decided that it would be better to AC_CHECK_HEADER for the sysfs header files in configure. If the sysfs header files were not found, configure would abort. Users generally understand when configure aborts, and know how to read the output and fix the underlying problem; it was ''much'' more obvious than having the OMPI build fail for nebulous reasons much later. Note that we also checked for / added -lsysfs, but that wasn't necessary because libibverbs already run-time linked to it (i.e., libibverbs couldn't have been installed if the sysfs libraries weren't installed). However, there are now two reasons why the check for sysfs's header files is no longer necessary: * Newer versions of Autoconf are now used for OMPI tarballs that check for both the presence '''and''' usability of header files. Hence, AC_CHECK_HEADER for <infiniband/verbs.h> will actually try to ''use'' it, so if the sysfs header files are not installed, AC_CHECK_HEADER will (rightfully) fail. * libibverbs v1.1 (i.e., OFED 1.2 and beyond) does not require libsysfs at all (headers or libraries). When checking for the sysfs header files, OMPI's configure ''forces'' you to have sysfs installed, even though it may not be needed (e.g., libibverbs v1.1 and beyond). Clearly, this is not good (especially since the sysfs software package is now deprecated, and some Linux distros no longer install it by default). So this commit simply removes the check for the sysfs header files and libraries, allowing OMPI to be build on systems with libibverbs >=1.1 that do not have sysfs installed. For systems with libibverbs 1.0, if they do not have the sysfs headers installed, we'll still fail AC_CHECK_HEADER and therefore still fail configure properly. I expanded the warning message to say that if libibverbs 1.0 is being used, check to ensure that sysfs is installed, yadda yadda yadda. This commit was SVN r14971. The following Trac tickets were found above: Ticket 1045 --> https://svn.open-mpi.org/trac/ompi/ticket/1045
2007-06-09 03:34:05 +04:00
[AC_MSG_WARN([OpenFabrics support requested (via --with-openib) but not found.])
AC_MSG_WARN([If you are using libibverbs v1.0 (i.e., OFED v1.0 or v1.1), you *MUST* have both the libsysfs headers and libraries installed. Later versions of libibverbs do not require libsysfs.])
AC_MSG_ERROR([Aborting.])])
$3])
OMPI_VAR_SCOPE_POP
])