Skip to content

Commit c27beea

Browse files
authored
Merge pull request #3962 from karasevb/ucx_detect
configure: detect UCX support by default
2 parents dd3acd9 + cc348fd commit c27beea

File tree

2 files changed

+56
-43
lines changed

2 files changed

+56
-43
lines changed

config/ompi_check_ucx.m4

Lines changed: 52 additions & 40 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
@@ -29,58 +30,69 @@ AC_DEFUN([OMPI_CHECK_UCX],[
2930
[Search for Unified Communication X libraries in DIR])])
3031
OPAL_CHECK_WITHDIR([ucx-libdir], [$with_ucx_libdir], [libucp.*])
3132

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-
3633
AS_IF([test "$with_ucx" != "no"],
3734
[AS_IF([test ! -z "$with_ucx" && test "$with_ucx" != "yes"],
35+
[_x_ac_ucx_dirs="$with_ucx"],
3836
[
39-
ompi_check_ucx_dir="$with_ucx"
40-
ompi_check_ucx_libdir="$with_ucx/lib"
37+
PKG_CHECK_MODULES_STATIC([ucx],[ucx],
38+
[_x_ac_ucx_dirs=`$PKG_CONFIG --variable=prefix ucx`],
39+
[_x_ac_ucx_dirs="/usr /usr/local /opt/ucx"])
4140
])
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"
41+
for ompi_check_ucx_dir in $_x_ac_ucx_dirs; do
42+
AS_IF([test ! -z "$with_ucx_libdir" && test "$with_ucx_libdir" != "yes"],
43+
[
44+
ompi_check_ucx_libdir="$with_ucx_libdir"
45+
ompi_check_ucx_extra_libs="-L$ompi_check_ucx_libdir"
46+
],
47+
[AS_IF([test ! -z "$ompi_check_ucx_dir"],
48+
[
49+
ompi_check_ucx_libdir=$ompi_check_ucx_dir/lib
50+
ompi_check_ucx_extra_libs="-L$ompi_check_ucx_libdir"
51+
])])
4652

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"])
53+
ompi_check_ucx_$1_save_CPPFLAGS="$CPPFLAGS"
54+
ompi_check_ucx_$1_save_LDFLAGS="$LDFLAGS"
55+
ompi_check_ucx_$1_save_LIBS="$LIBS"
5756

57+
OPAL_CHECK_PACKAGE([ompi_check_ucx],
58+
[ucp/api/ucp.h],
59+
[ucp],
60+
[ucp_cleanup],
61+
[$ompi_check_ucx_extra_libs],
62+
[$ompi_check_ucx_dir],
63+
[$ompi_check_ucx_libdir],
64+
[ompi_check_ucx_happy="yes"],
65+
[ompi_check_ucx_happy="no"])
66+
CPPFLAGS="$ompi_check_ucx_$1_save_CPPFLAGS"
67+
LDFLAGS="$ompi_check_ucx_$1_save_LDFLAGS"
68+
LIBS="$ompi_check_ucx_$1_save_LIBS"
5869

70+
if test "$ompi_check_ucx_happy" = no; then
71+
continue
72+
fi
5973

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

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"])
83+
AC_MSG_RESULT([$ompi_ucx_version_ok])
84+
CPPFLAGS=$old_CPPFLAGS
7485

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

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])
88+
if test "$ompi_check_ucx_happy" = yes; then
89+
break
90+
fi
91+
done],
92+
[ompi_check_ucx_happy="no"])
93+
OPAL_SUMMARY_ADD([[Transports]],[[Open UCX]],[$1],[$ompi_check_ucx_happy])
8194
fi
8295

83-
8496
AS_IF([test "$ompi_check_ucx_happy" = "yes"],
8597
[$1_CPPFLAGS="[$]$1_CPPFLAGS $ompi_check_ucx_CPPFLAGS"
8698
$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)