Skip to content

Commit

Permalink
Merge pull request #24 from miked-mellanox/topic/fix_build_noib
Browse files Browse the repository at this point in the history
fix autotools configure to support building w/o IB
  • Loading branch information
mike-dubman committed Nov 15, 2014
2 parents aedffe7 + cc6374b commit 630a63e
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 82 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ src/ucs/ucs_stats_parser
test/gtest/gtest
test/perf/ucx_perftest
build-*
ucx*tar.gz
128 changes: 74 additions & 54 deletions config/m4/ib.m4
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@
#


#
# Select IB transports
#
with_ib=no
AC_ARG_WITH([verbs],
[AC_HELP_STRING([--with-verbs(=DIR)],
[Build OpenFabrics support, adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])],
[],
[with_verbs=/usr])

AS_IF([test "x$with_verbs" == "xyes"], [with_verbs=/usr])
AS_IF([test -d "$with_verbs"], [with_ib=yes; str="with verbs support from $with_verbs"], [with_ib=no; str="without verbs support"])

AC_MSG_NOTICE([Compiling $str])

#
# RC Support
Expand All @@ -19,80 +24,95 @@ AC_ARG_WITH([rc],
[AC_HELP_STRING([--with-rc], [Compile with IB Reliable Connection support])],
[],
[with_rc=yes])
AS_IF([test "x$with_rc" != xno],
[AC_DEFINE([HAVE_TL_RC], 1, [RC transport support])
with_ib=yes
transports="${transports},rc"])



AC_ARG_WITH([ud],
[AC_HELP_STRING([--with-ud], [Compile with IB Unreliable Datagram support])],
[],
[with_ud=yes;with_ib=yes])
AS_IF([test "x$with_ud" != xno],
[AC_DEFINE([HAVE_TL_UD], 1, [UD transport support])
with_ib=yes
transports="${transports},ud"])
[with_ud=yes])



AC_ARG_WITH([dc],
[AC_HELP_STRING([--with-dc], [Compile with IB Dynamic Connection support])],
[],
[with_dc=yes;with_ib=yes])
AS_IF([test "x$with_dc" != xno],
[AC_CHECK_DECLS(IBV_EXP_QPT_DC_INI, [], [with_dc=no], [[#include <infiniband/verbs.h>]])
AC_CHECK_MEMBERS([struct ibv_exp_dct_init_attr.inline_size], [] , [with_dc=no], [[#include <infiniband/verbs.h>]])
])
AS_IF([test "x$with_dc" != xno],
[AC_DEFINE([HAVE_TL_DC], 1, [DC transport support])
with_ib=yes
transports="${transports},dc"])
[with_dc=yes])



#
# Check basic IB support: User wanted at least one IB transport, and we found
# verbs header file and library.
#
AS_IF([test "x$with_ib" != xno],
[AC_CHECK_HEADER([infiniband/verbs.h], [],
[AC_MSG_WARN([ibverbs header files not found]);with_ib=no])
save_LDFLAGS="$LDFLAGS"
AC_CHECK_LIB([ibverbs], [ibv_get_device_list],
[AC_SUBST(IBVERBS_LDFLAGS, [-libverbs])],
[AC_MSG_WARN([libibverbs not found]);with_ib=no])
LDFLAGS="$save_LDFLAGS"
])
AS_IF([test "x$with_ib" != xno],
[AC_DEFINE([HAVE_IB], 1, [IB support])])
AS_IF([test "x$with_ib" == xyes],
[
save_LDFLAGS="$LDFLAGS"
save_CFLAGS="$CFLAGS"
save_CPPFLAGS="$CPPFLAGS"
AC_CHECK_HEADER([infiniband/verbs.h], [], [AC_MSG_WARN([ibverbs header files not found]); with_ib=no])
AC_CHECK_LIB([ibverbs], [ibv_get_device_list],
[
AC_SUBST(IBVERBS_LDFLAGS, ["-L$with_verbs/lib64 -L$with_verbs/lib -libverbs"])
AC_SUBST(IBVERBS_CPPFLAGS, [-I$with_verbs/include])
AC_SUBST(IBVERBS_CFLAGS, [-I$with_verbs/include])
],
[AC_MSG_WARN([libibverbs not found]); with_ib=no])
LDFLAGS="$save_LDFLAGS"
CFLAGS="$save_CFLAGS"
CPPFLAGS="$save_CPPFLAGS"
],[:])

AS_IF([test "x$with_ib" == xyes],
[
AC_CHECK_HEADER([infiniband/verbs_exp.h],
[AC_DEFINE([HAVE_VERBS_EXP_H], 1, [IB experimental verbs])
verbs_exp=yes],
[verbs_exp=no])
with_mlx5_hw=no
AC_CHECK_HEADERS([infiniband/mlx5_hw.h],
[AC_MSG_NOTICE([Compiling with mlx5 bare-metal support])
AC_DEFINE([HAVE_MLX5_HW], 1, [mlx5 bare-metal support])
with_mlx5_hw=yes])
AC_DEFINE([HAVE_IB], 1, [IB support])
AS_IF([test "x$with_dc" != xno],
[AC_CHECK_DECLS(IBV_EXP_QPT_DC_INI, [], [with_dc=no], [[#include <infiniband/verbs.h>]])
AC_CHECK_MEMBERS([struct ibv_exp_dct_init_attr.inline_size], [] , [with_dc=no], [[#include <infiniband/verbs.h>]])
])
AS_IF([test "x$with_dc" != xno],
[AC_DEFINE([HAVE_TL_DC], 1, [DC transport support])
transports="${transports},dc"])
AS_IF([test "x$with_rc" != xno],
[AC_DEFINE([HAVE_TL_RC], 1, [RC transport support])
transports="${transports},rc"])
AS_IF([test "x$with_ud" != xno],
[AC_DEFINE([HAVE_TL_UD], 1, [UD transport support])
transports="${transports},ud"])
AS_IF([test -d "$with_verbs/lib64"],[libsuff="64"],[libsuff=""])
mlnx_valg_libdir=$with_verbs/lib${libsuff}/mlnx_ofed/valgrind
AC_MSG_NOTICE([Checking OFED valgrind libs $mlnx_valg_libdir])
AS_IF([test -d "$mlnx_valg_libdir"],
[AC_MSG_NOTICE([Added $mlnx_valg_libdir to valgrind LD_LIBRARY_PATH])
valgrind_libpath="$mlnx_valg_libdir:$valgrind_libpath"])
])


#
# Check for experimental verbs support
#
AC_CHECK_HEADER([infiniband/verbs_exp.h],
[AC_DEFINE([HAVE_VERBS_EXP_H], 1, [IB experimental verbs])
verbs_exp=yes],
[verbs_exp=no])


#
# mlx5 PRM
#
with_mlx5_hw=no
AC_CHECK_HEADERS([infiniband/mlx5_hw.h],
[AC_MSG_NOTICE([Compiling with mlx5 bare-metal support])
AC_DEFINE([HAVE_MLX5_HW], 1, [mlx5 bare-metal support])
with_mlx5_hw=yes])


#
# For automake
#
AM_CONDITIONAL([HAVE_IB], [test "x$with_ib" != xno])
AM_CONDITIONAL([HAVE_TL_RC], [test "x$with_rc" != xno])
AM_CONDITIONAL([HAVE_TL_DC], [test "x$with_dc" != xno])
AM_CONDITIONAL([HAVE_TL_UC], [test "x$with_uc" != xno])
AM_CONDITIONAL([HAVE_MLX5_HW], [test "x$with_mlx5_hw" != xno])

mlnx_valg_libdir=/usr/lib64/mlnx_ofed/valgrind
AS_IF([test -d "$mlnx_valg_libdir"],
[AC_MSG_NOTICE([Added $mlnx_valg_libdir to valgrind LD_LIBRARY_PATH])
valgrind_libpath="$mlnx_valg_libdir:$valgrind_libpath"])
36 changes: 14 additions & 22 deletions config/m4/mpi.m4
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,23 @@
#
# Enable compiling tests with MPI
#
AS_IF([test -n "$MPI_HOME"], [with_ompi="$MPI_HOME"])
AC_ARG_WITH([mpi],
[AS_HELP_STRING([--with-mpi@<:@=MPIHOME@:>@], [Compile MPI tests (default is NO).])],
[],
[with_mpi=no])
[AS_HELP_STRING([--with-mpi@<:@=MPIHOME@:>@], [Compile MPI tests (default is NO).])],[:],[with_mpi=no])

AS_IF([test "x$with_mpi" != xyes && test "x$with_mpi" != xno],mpi_path=$with_mpi;with_mpi=yes, mpi_path=$PATH)

#
# Search for mpicc and mpirun in the given path.
#
mpirun_path=""
mpicc_path=""
AS_IF([test "x$with_mpi" != xno],
[AS_IF([test "x$with_mpi" == xyes],
[AC_PATH_PROGS([mpicc_path], [mpicc])
AC_PATH_PROGS([mpirun_path], [mpirun])],
[AC_PATH_PROGS([mpicc_path], [mpicc], [], [$with_mpi/bin])
AC_PATH_PROGS([mpirun_path], [mpirun], [], [$with_mpi/bin])])
AS_IF([! test -z $mpicc_path],
[AC_DEFINE(HAVE_MPI, [1], "MPI compilation support")
AC_SUBST([MPICC], [$mpicc_path])],
[AC_MSG_ERROR(MPI support requsted but mpicc was not found)])
AS_IF([! test -z $mpirun_path],
[AC_SUBST([MPIRUN], [$mpirun_path])],
[AC_MSG_ERROR(MPI support requsted but mpirun was not found)])
])
AS_IF([test "x$with_mpi" == xyes],
[
AC_ARG_VAR(MPICC,[MPI C compiler command])
AC_PATH_PROGS(MPICC,mpicc mpiicc,"",$mpi_path)
AC_ARG_VAR(MPIRUN,[MPI launch command])
AC_PATH_PROGS(MPIRUN,mpirun mpiexec orterun,"",$mpi_path)
AS_IF([test -z "$MPIRUN"], AC_MSG_ERROR([--with-mpi was requested but MPI was not found in the PATH $with_mpi]),[:])
],[:])

AM_CONDITIONAL([HAVE_MPI], [! test -z $mpicc_path])
AM_CONDITIONAL([HAVE_MPIRUN], [! test -z $mpirun_path])
AM_CONDITIONAL([HAVE_MPI], [test -n "$MPIRUN"])
AM_CONDITIONAL([HAVE_MPICC], [test -n "$MPICC"])
AM_CONDITIONAL([HAVE_MPIRUN], [test -n "$MPIRUN"])
12 changes: 9 additions & 3 deletions contrib/test_jenkins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,30 @@ echo Starting on host: $(hostname)

echo "Autogen"
./autogen.sh
make distclean||:

echo "Making a directory for test build"
mkdir -p build-test
cd build-test

echo "Build w/o IB"
../contrib/configure-release --without-verbs && make $make_opt

echo "Build release"
../contrib/configure-release && make $make_opt && make $make_opt distcheck

echo "Build gtest "
make clean && ../contrib/configure-devel && make $make_opt
module load hpcx-gcc
make clean && ../contrib/configure-devel --with-mpi && make $make_opt
module unload hpcx-gcc

echo "Starting gtest"

make -C test/gtest test

module load tools/valgrind-3.9.0
module load tools/valgrind
make -C test/gtest VALGRIND_EXTRA_ARGS="--xml=yes --xml-file=valgrind.xml" test_valgrind
module unload tools/valgrind-3.9.0
module unload tools/valgrind


echo "Build with coverity"
Expand Down
4 changes: 4 additions & 0 deletions src/ucs/sys/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ static void UCS_F_CTOR ucs_init()
ucs_log_early_init(); /* Must be called before all others */
ucs_global_opts_init();
ucs_log_init();
#if ENABLE_STATS
ucs_stats_init();
#endif
ucs_memtrack_init();
ucs_debug_init();
ucs_instrument_init();
Expand All @@ -28,6 +30,8 @@ static void UCS_F_DTOR ucs_cleanup(void)
ucs_instrument_cleanup();
ucs_debug_cleanup();
ucs_memtrack_cleanup();
#if ENABLE_STATS
ucs_stats_cleanup();
#endif
ucs_log_cleanup();
}
8 changes: 5 additions & 3 deletions src/uct/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

lib_LTLIBRARIES = libuct.la

libuct_la_CPPFLAGS = -I$(abs_top_srcdir)/src -I$(abs_top_builddir)/src
libuct_la_LDFLAGS = -ldl -version-info $(SOVERSION) $(IBVERBS_LDFLAGS)
libuct_la_CPPFLAGS = -I$(abs_top_srcdir)/src -I$(abs_top_builddir)/src
libuct_la_LDFLAGS = -ldl -version-info $(SOVERSION)
libuct_la_LIBADD = $(LIBM) ../ucs/libucs.la
libuct_ladir = $(includedir)

Expand All @@ -25,6 +25,8 @@ libuct_la_SOURCES = \
tl/context.c

if HAVE_IB
libuct_la_CPPFLAGS += $(IBVERBS_CPPFLAGS)
libuct_la_LDFLAGS += $(IBVERBS_LDFLAGS)
noinst_HEADERS += \
ib/base/ib_context.h \
ib/base/ib_device.h \
Expand All @@ -44,7 +46,6 @@ libuct_la_SOURCES += \
ib/mlx5/ib_mlx5.c
endif

endif

if HAVE_TL_RC
noinst_HEADERS += \
Expand All @@ -62,3 +63,4 @@ libuct_la_SOURCES += \
endif

endif
endif

0 comments on commit 630a63e

Please sign in to comment.