Skip to content

Commit d917d54

Browse files
committed
configure: detect UCX support by default
Adds detecting UCX from following paths: "/usr /usr/local /opt/ucx" Signed-off-by: Boris Karasev <[email protected]>
1 parent 4a3aa4f commit d917d54

File tree

2 files changed

+54
-45
lines changed

2 files changed

+54
-45
lines changed

config/ompi_check_ucx.m4

Lines changed: 50 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- shell-script -*-
22
#
3-
# Copyright (C) 2015 Mellanox Technologies Ltd. ALL RIGHTS RESERVED.
3+
# Copyright (C) 2015-2017 Mellanox Technologies, Inc.
4+
# All rights reserved.
45
# Copyright (c) 2015 Research Organization for Information Science
56
# and Technology (RIST). All rights reserved.
67
# Copyright (c) 2016 Los Alamos National Security, LLC. All rights
@@ -20,6 +21,7 @@
2021
# support, otherwise executes action-if-not-found
2122
AC_DEFUN([OMPI_CHECK_UCX],[
2223
if test -z "$ompi_check_ucx_happy" ; then
24+
_x_ac_ucx_dirs="/usr /usr/local /opt/ucx"
2325
AC_ARG_WITH([ucx],
2426
[AC_HELP_STRING([--with-ucx(=DIR)],
2527
[Build with Unified Communication X library support])])
@@ -29,58 +31,64 @@ AC_DEFUN([OMPI_CHECK_UCX],[
2931
[Search for Unified Communication X libraries in DIR])])
3032
OPAL_CHECK_WITHDIR([ucx-libdir], [$with_ucx_libdir], [libucp.*])
3133

32-
ompi_check_ucx_$1_save_CPPFLAGS="$CPPFLAGS"
33-
ompi_check_ucx_$1_save_LDFLAGS="$LDFLAGS"
34-
ompi_check_ucx_$1_save_LIBS="$LIBS"
35-
3634
AS_IF([test "$with_ucx" != "no"],
3735
[AS_IF([test ! -z "$with_ucx" && test "$with_ucx" != "yes"],
38-
[
39-
ompi_check_ucx_dir="$with_ucx"
40-
ompi_check_ucx_libdir="$with_ucx/lib"
41-
])
42-
AS_IF([test ! -z "$with_ucx_libdir" && test "$with_ucx_libdir" != "yes"],
43-
[ompi_check_ucx_libdir="$with_ucx_libdir"])
44-
45-
ompi_check_ucx_extra_libs="-L$ompi_check_ucx_libdir"
36+
[_x_ac_ucx_dirs="$with_ucx"])
37+
for ompi_check_ucx_dir in $_x_ac_ucx_dirs; do
38+
AS_IF([test ! -z "$with_ucx_libdir" && test "$with_ucx_libdir" != "yes"],
39+
[
40+
ompi_check_ucx_libdir="$with_ucx_libdir"
41+
ompi_check_ucx_extra_libs="-L$ompi_check_ucx_libdir"
42+
],
43+
[AS_IF([test ! -z "$ompi_check_ucx_dir"],
44+
[
45+
ompi_check_ucx_libdir=$ompi_check_ucx_dir/lib
46+
ompi_check_ucx_extra_libs="-L$ompi_check_ucx_libdir"
47+
])])
4648

47-
OPAL_CHECK_PACKAGE([ompi_check_ucx],
48-
[ucp/api/ucp.h],
49-
[ucp],
50-
[ucp_cleanup],
51-
[$ompi_check_ucx_extra_libs],
52-
[$ompi_check_ucx_dir],
53-
[$ompi_check_ucx_libdir],
54-
[ompi_check_ucx_happy="yes"],
55-
[ompi_check_ucx_happy="no"])],
56-
[ompi_check_ucx_happy="no"])
49+
ompi_check_ucx_$1_save_CPPFLAGS="$CPPFLAGS"
50+
ompi_check_ucx_$1_save_LDFLAGS="$LDFLAGS"
51+
ompi_check_ucx_$1_save_LIBS="$LIBS"
5752

53+
OPAL_CHECK_PACKAGE([ompi_check_ucx],
54+
[ucp/api/ucp.h],
55+
[ucp],
56+
[ucp_cleanup],
57+
[$ompi_check_ucx_extra_libs],
58+
[$ompi_check_ucx_dir],
59+
[$ompi_check_ucx_libdir],
60+
[ompi_check_ucx_happy="yes"],
61+
[ompi_check_ucx_happy="no"])
62+
CPPFLAGS="$ompi_check_ucx_$1_save_CPPFLAGS"
63+
LDFLAGS="$ompi_check_ucx_$1_save_LDFLAGS"
64+
LIBS="$ompi_check_ucx_$1_save_LIBS"
5865

66+
if test "$ompi_check_ucx_happy" = no; then
67+
continue
68+
fi
5969

60-
CPPFLAGS="$ompi_check_ucx_$1_save_CPPFLAGS"
61-
LDFLAGS="$ompi_check_ucx_$1_save_LDFLAGS"
62-
LIBS="$ompi_check_ucx_$1_save_LIBS"
70+
AC_MSG_CHECKING(for UCX version compatibility)
71+
AC_REQUIRE_CPP
72+
old_CPPFLAGS="$CPPFLAGS"
73+
CPPFLAGS="$CPPFLAGS -I$ompi_check_ucx_dir/include"
74+
AC_COMPILE_IFELSE(
75+
[AC_LANG_PROGRAM([[#include <uct/api/version.h>]],[[]])],
76+
[ompi_ucx_version_ok="yes"],
77+
[ompi_ucx_version_ok="no"])
6378

64-
AC_MSG_CHECKING(for UCX version compatibility)
65-
AC_REQUIRE_CPP
66-
old_CPPFLAGS="$CPPFLAGS"
67-
CPPFLAGS="$CPPFLAGS -I$ompi_check_ucx_dir/include"
68-
AC_COMPILE_IFELSE(
69-
[AC_LANG_PROGRAM([[#include <uct/api/version.h>]],
70-
[[
71-
]])],
72-
[ompi_ucx_version_ok="yes"],
73-
[ompi_ucx_version_ok="no"])
79+
AC_MSG_RESULT([$ompi_ucx_version_ok])
80+
CPPFLAGS=$old_CPPFLAGS
7481

75-
AC_MSG_RESULT([$ompi_ucx_version_ok])
76-
CPPFLAGS=$old_CPPFLAGS
82+
AS_IF([test "$ompi_ucx_version_ok" = "no"], [ompi_check_ucx_happy="no"])
7783

78-
AS_IF([test "$ompi_ucx_version_ok" = "no"], [ompi_check_ucx_happy="no"])
79-
80-
OPAL_SUMMARY_ADD([[Transports]],[[Open UCX]],[$1],[$ompi_check_ucx_happy])
84+
if test "$ompi_check_ucx_happy" = yes; then
85+
break
86+
fi
87+
done],
88+
[ompi_check_ucx_happy="no"])
89+
OPAL_SUMMARY_ADD([[Transports]],[[Open UCX]],[$1],[$ompi_check_ucx_happy])
8190
fi
8291

83-
8492
AS_IF([test "$ompi_check_ucx_happy" = "yes"],
8593
[$1_CPPFLAGS="[$]$1_CPPFLAGS $ompi_check_ucx_CPPFLAGS"
8694
$1_LDFLAGS="[$]$1_LDFLAGS $ompi_check_ucx_LDFLAGS"

ompi/mca/pml/ucx/Makefile.am

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#
2-
# Copyright (C) Mellanox Technologies Ltd. 2001-2015. ALL RIGHTS RESERVED.
2+
# Copyright (C) 2001-2017 Mellanox Technologies, Inc.
3+
# All rights reserved.
34
# $COPYRIGHT$
45
#
56
# Additional copyrights may follow
@@ -36,10 +37,10 @@ mcacomponentdir = $(ompilibdir)
3637
mcacomponent_LTLIBRARIES = $(component_install)
3738
mca_pml_ucx_la_SOURCES = $(local_sources)
3839
mca_pml_ucx_la_LIBADD = $(pml_ucx_LIBS)
39-
mca_pml_ucx_la_LDFLAGS = -module -avoid-version
40+
mca_pml_ucx_la_LDFLAGS = -module -avoid-version $(pml_ucx_LDFLAGS)
4041

4142
noinst_LTLIBRARIES = $(component_noinst)
4243
libmca_pml_ucx_la_SOURCES = $(local_sources)
4344
libmca_pml_ucx_la_LIBADD = $(pml_ucx_LIBS)
44-
libmca_pml_ucx_la_LDFLAGS = -module -avoid-version
45+
libmca_pml_ucx_la_LDFLAGS = -module -avoid-version $(pml_ucx_LDFLAGS)
4546

0 commit comments

Comments
 (0)