Skip to content

Commit 8451cd7

Browse files
authored
Merge pull request #6363 from jsquyres/pr/fix-ofi-configury
Consolidated: fix OFI configury / linking issues
2 parents f53a4f2 + dd20174 commit 8451cd7

File tree

14 files changed

+179
-348
lines changed

14 files changed

+179
-348
lines changed

VERSION

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
2-
# Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved.
2+
# Copyright (c) 2008-2019 Cisco Systems, Inc. All rights reserved.
33
# Copyright (c) 2011 NVIDIA Corporation. All rights reserved.
44
# Copyright (c) 2013 Mellanox Technologies, Inc.
55
# All rights reserved.
@@ -110,7 +110,6 @@ libmca_orte_common_alps_so_version=0:0:0
110110

111111
# OPAL layer
112112
libmca_opal_common_cuda_so_version=0:0:0
113-
libmca_opal_common_ofi_so_version=0:0:0
114113
libmca_opal_common_sm_so_version=0:0:0
115114
libmca_opal_common_ucx_so_version=0:0:0
116115
libmca_opal_common_ugni_so_version=0:0:0

config/opal_check_ofi.m4

Lines changed: 106 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dnl -*- shell-script -*-
22
dnl
3-
dnl Copyright (c) 2015-2016 Cisco Systems, Inc. All rights reserved.
3+
dnl Copyright (c) 2015-2019 Cisco Systems, Inc. All rights reserved.
44
dnl Copyright (c) 2016-2017 Los Alamos National Security, LLC. All rights
55
dnl reserved.
66
dnl $COPYRIGHT$
@@ -10,102 +10,116 @@ dnl
1010
dnl $HEADER$
1111
dnl
1212

13-
14-
# OPAL_CHECK_OFI(prefix, [action-if-found], [action-if-not-found]
15-
# --------------------------------------------------------
16-
# Check if libfabric support can be found.
17-
#
18-
# Sets prefix_{CPPFLAGS, LDFLAGs, LIBS} as needed and runs
19-
# action-if-found if there is support; otherwise executes
20-
# action-if-not-found.
21-
#
22-
AC_DEFUN([OPAL_CHECK_OFI],[
23-
if test -z "$opal_check_libfabric_happy" ; then
24-
OPAL_VAR_SCOPE_PUSH([opal_check_libfabric_$1_save_CPPFLAGS opal_check_libfabric_$1_save_LDFLAGS opal_check_libfabric_$1_save_LIBS])
25-
26-
# Add --with options
27-
AC_ARG_WITH([libfabric],
28-
[AC_HELP_STRING([--with-libfabric=DIR],
29-
[Deprecated synonym for --with-ofi])])
30-
AC_ARG_WITH([libfabric-libdir],
31-
[AC_HELP_STRING([--with-libfabric-libdir=DIR],
32-
[Deprecated synonym for --with-ofi-libdir])])
33-
34-
AC_ARG_WITH([ofi],
35-
[AC_HELP_STRING([--with-ofi=DIR],
36-
[Specify location of OFI libfabric installation, adding DIR/include to the default search location for libfabric headers, and DIR/lib or DIR/lib64 to the default search location for libfabric libraries. Error if libfabric support cannot be found.])])
37-
38-
AC_ARG_WITH([ofi-libdir],
39-
[AC_HELP_STRING([--with-ofi-libdir=DIR],
40-
[Search for OFI libfabric libraries in DIR])])
41-
42-
if test "$with_ofi" = ""; then
43-
with_ofi=$with_libfabric
44-
fi
45-
46-
if test "$with_ofi_libdir" = ""; then
47-
with_ofi_libdir=$with_libfabric_libdir
48-
fi
49-
50-
# Sanity check the --with values
51-
OPAL_CHECK_WITHDIR([ofi], [$with_ofi],
52-
[include/rdma/fabric.h])
53-
OPAL_CHECK_WITHDIR([ofi-libdir], [$with_ofi_libdir],
54-
[libfabric.*])
55-
56-
opal_check_ofi_$1_save_CPPFLAGS=$CPPFLAGS
57-
opal_check_ofi_$1_save_LDFLAGS=$LDFLAGS
58-
opal_check_ofi_$1_save_LIBS=$LIBS
59-
60-
opal_check_ofi_happy=yes
61-
AS_IF([test "$with_ofi" = "no"],
62-
[opal_check_ofi_happy=no])
63-
64-
AS_IF([test $opal_check_ofi_happy = yes],
65-
[AC_MSG_CHECKING([looking for OFI libfabric in])
66-
AS_IF([test "$with_ofi" != "yes"],
67-
[opal_ofi_dir=$with_ofi
68-
AC_MSG_RESULT([($opal_ofi_dir)])],
69-
[AC_MSG_RESULT([(default search paths)])])
70-
AS_IF([test ! -z "$with_ofi_libdir" && \
71-
test "$with_ofi_libdir" != "yes"],
72-
[opal_ofi_libdir=$with_ofi_libdir])
73-
])
74-
75-
AS_IF([test $opal_check_ofi_happy = yes],
76-
[OPAL_CHECK_PACKAGE([opal_check_ofi],
77-
[rdma/fabric.h],
78-
[fabric],
79-
[fi_getinfo],
80-
[],
81-
[$opal_ofi_dir],
82-
[$opal_ofi_libdir],
83-
[],
84-
[opal_check_ofi_happy=no])])
85-
86-
CPPFLAGS=$opal_check_ofi_$1_save_CPPFLAGS
87-
LDFLAGS=$opal_check_ofi_$1_save_LDFLAGS
88-
LIBS=$opal_check_ofi_$1_save_LIBS
89-
90-
OPAL_SUMMARY_ADD([[Transports]],[[OpenFabrics Libfabric]],[$1],[$opal_check_ofi_happy])
91-
92-
OPAL_VAR_SCOPE_POP
13+
dnl
14+
dnl _OPAL_CHECK_OFI
15+
dnl --------------------------------------------------------
16+
dnl Do the real work of checking for OFI libfabric.
17+
dnl Upon return:
18+
dnl
19+
dnl - opal_ofi_happy: will be "yes" or "no"
20+
dnl - opal_ofi_{CPPFLAGS|LDFLAGS|LIBS} will be loaded (if relevant)
21+
dnl
22+
AC_DEFUN([_OPAL_CHECK_OFI],[
23+
# Add --with options
24+
AC_ARG_WITH([libfabric],
25+
[AC_HELP_STRING([--with-libfabric=DIR],
26+
[Deprecated synonym for --with-ofi])])
27+
AC_ARG_WITH([libfabric-libdir],
28+
[AC_HELP_STRING([--with-libfabric-libdir=DIR],
29+
[Deprecated synonym for --with-ofi-libdir])])
30+
31+
AC_ARG_WITH([ofi],
32+
[AC_HELP_STRING([--with-ofi=DIR],
33+
[Specify location of OFI libfabric installation, adding DIR/include to the default search location for libfabric headers, and DIR/lib or DIR/lib64 to the default search location for libfabric libraries. Error if libfabric support cannot be found.])])
34+
35+
AC_ARG_WITH([ofi-libdir],
36+
[AC_HELP_STRING([--with-ofi-libdir=DIR],
37+
[Search for OFI libfabric libraries in DIR])])
38+
39+
if test "$with_ofi" = ""; then
40+
with_ofi=$with_libfabric
9341
fi
9442

95-
if test $opal_check_ofi_happy = yes ; then
96-
$1_CPPFLAGS="[$]$1_CPPFLAGS $opal_check_ofi_CPPFLAGS"
97-
$1_LIBS="[$]$1_LIBS $opal_check_ofi_LIBS"
98-
$1_LDFLAGS="[$]$1_LDFLAGS $opal_check_ofi_LDFLAGS"
99-
100-
AC_SUBST($1_CPPFLAGS)
101-
AC_SUBST($1_LDFLAGS)
102-
AC_SUBST($1_LIBS)
43+
if test "$with_ofi_libdir" = ""; then
44+
with_ofi_libdir=$with_libfabric_libdir
10345
fi
10446

105-
AS_IF([test $opal_check_ofi_happy = yes],
106-
[$2],
47+
# Sanity check the --with values
48+
OPAL_CHECK_WITHDIR([ofi], [$with_ofi],
49+
[include/rdma/fabric.h])
50+
OPAL_CHECK_WITHDIR([ofi-libdir], [$with_ofi_libdir],
51+
[libfabric.*])
52+
53+
OPAL_VAR_SCOPE_PUSH([opal_check_ofi_save_CPPFLAGS opal_check_ofi_save_LDFLAGS opal_check_ofi_save_LIBS])
54+
opal_check_ofi_save_CPPFLAGS=$CPPFLAGS
55+
opal_check_ofi_save_LDFLAGS=$LDFLAGS
56+
opal_check_ofi_save_LIBS=$LIBS
57+
58+
opal_ofi_happy=yes
59+
AS_IF([test "$with_ofi" = "no"],
60+
[opal_ofi_happy=no])
61+
62+
AS_IF([test $opal_ofi_happy = yes],
63+
[AC_MSG_CHECKING([looking for OFI libfabric in])
64+
AS_IF([test "$with_ofi" != "yes"],
65+
[opal_ofi_dir=$with_ofi
66+
AC_MSG_RESULT([($opal_ofi_dir)])],
67+
[AC_MSG_RESULT([(default search paths)])])
68+
AS_IF([test ! -z "$with_ofi_libdir" && \
69+
test "$with_ofi_libdir" != "yes"],
70+
[opal_ofi_libdir=$with_ofi_libdir])
71+
])
72+
73+
AS_IF([test $opal_ofi_happy = yes],
74+
[OPAL_CHECK_PACKAGE([opal_ofi],
75+
[rdma/fabric.h],
76+
[fabric],
77+
[fi_getinfo],
78+
[],
79+
[$opal_ofi_dir],
80+
[$opal_ofi_libdir],
81+
[],
82+
[opal_ofi_happy=no])])
83+
84+
CPPFLAGS=$opal_check_ofi_save_CPPFLAGS
85+
LDFLAGS=$opal_check_ofi_save_LDFLAGS
86+
LIBS=$opal_check_ofi_save_LIBS
87+
88+
AC_SUBST([opal_ofi_CPPFLAGS])
89+
AC_SUBST([opal_ofi_LDFLAGS])
90+
AC_SUBST([opal_ofi_LIBS])
91+
92+
OPAL_SUMMARY_ADD([[Transports]],[[OpenFabrics OFI Libfabric]],[],[$opal_ofi_happy])
93+
94+
OPAL_VAR_SCOPE_POP
95+
96+
AS_IF([test $opal_ofi_happy = no],
10797
[AS_IF([test -n "$with_ofi" && test "$with_ofi" != "no"],
10898
[AC_MSG_WARN([OFI libfabric support requested (via --with-ofi or --with-libfabric), but not found.])
10999
AC_MSG_ERROR([Cannot continue.])])
110-
$3])
100+
])
111101
])dnl
102+
103+
104+
dnl
105+
dnl OPAL_CHECK_OFI
106+
dnl --------------------------------------------------------
107+
dnl Check to see if OFI libfabric is available.
108+
dnl
109+
dnl This is a simple wrapper around _OPAL_CHECK_OFI that just
110+
dnl ensures to only run the checks once. We do not use AC_REQUIRE
111+
dnl because that re-orders the texts and makes ordering in stdout
112+
dnl quite confusing / difficult to grok.
113+
dnl
114+
AC_DEFUN([OPAL_CHECK_OFI],[
115+
# Check for OFI libfabric. Note that $opal_ofi_happy is used in
116+
# other configure.m4's to know if OFI/libfabric configured
117+
# successfully. We only need to run the back-end checks once, but
118+
# at least emit a "checking..." statement each subsequent time
119+
# this macro is invoked so that configure's stdout has
120+
# sensible/logical output.
121+
AS_IF([test -z "$opal_ofi_happy"],
122+
[_OPAL_CHECK_OFI],
123+
[AC_MSG_CHECKING([if OFI libfabric is available])
124+
AC_MSG_RESULT([$opal_ofi_happy])])
125+
])

configure.ac

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# University of Stuttgart. All rights reserved.
1111
# Copyright (c) 2004-2005 The Regents of the University of California.
1212
# All rights reserved.
13-
# Copyright (c) 2006-2018 Cisco Systems, Inc. All rights reserved
13+
# Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved
1414
# Copyright (c) 2006-2008 Sun Microsystems, Inc. All rights reserved.
1515
# Copyright (c) 2006-2017 Los Alamos National Security, LLC. All rights
1616
# reserved.
@@ -154,7 +154,6 @@ AC_SUBST(libopen_pal_so_version)
154154
# transparently by adding some intelligence in autogen.pl
155155
# and/or opal_mca.m4, but I don't have the cycles to do this
156156
# right now.
157-
AC_SUBST(libmca_opal_common_ofi_so_version)
158157
AC_SUBST(libmca_opal_common_cuda_so_version)
159158
AC_SUBST(libmca_opal_common_sm_so_version)
160159
AC_SUBST(libmca_opal_common_ugni_so_version)

ompi/mca/mtl/ofi/Makefile.am

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
#
22
# Copyright (c) 2013-2015 Intel, Inc. All rights reserved
33
#
4-
# Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved.
4+
# Copyright (c) 2014-2019 Cisco Systems, Inc. All rights reserved
55
# Copyright (c) 2017 Los Alamos National Security, LLC. All rights
66
# reserved.
77
# Copyright (c) 2017 IBM Corporation. All rights reserved.
8+
# Copyright (c) 2019 Research Organization for Information Science
9+
# and Technology (RIST). All rights reserved.
810
# $COPYRIGHT$
911
#
1012
# Additional copyrights may follow
@@ -13,40 +15,40 @@
1315
#
1416

1517
EXTRA_DIST = post_configure.sh \
16-
$(generated_source_modules)
18+
$(generated_source_modules)
1719

1820
MAINTAINERCLEANFILES = \
19-
$(generated_sources)
21+
$(generated_sources)
2022

21-
AM_CPPFLAGS = $(ompi_mtl_ofi_CPPFLAGS) $(opal_common_ofi_CPPFLAGS)
23+
AM_CPPFLAGS = $(opal_ofi_CPPFLAGS)
2224

2325
dist_ompidata_DATA = help-mtl-ofi.txt
2426

2527
generated_source_modules = \
26-
mtl_ofi_send_opt.pm \
27-
mtl_ofi_isend_opt.pm \
28-
mtl_ofi_irecv_opt.pm \
29-
mtl_ofi_iprobe_opt.pm \
30-
mtl_ofi_improbe_opt.pm
28+
mtl_ofi_send_opt.pm \
29+
mtl_ofi_isend_opt.pm \
30+
mtl_ofi_irecv_opt.pm \
31+
mtl_ofi_iprobe_opt.pm \
32+
mtl_ofi_improbe_opt.pm
3133

3234
generated_sources = \
33-
mtl_ofi_send_opt.c \
34-
mtl_ofi_isend_opt.c \
35-
mtl_ofi_irecv_opt.c \
36-
mtl_ofi_iprobe_opt.c \
37-
mtl_ofi_improbe_opt.c
35+
mtl_ofi_send_opt.c \
36+
mtl_ofi_isend_opt.c \
37+
mtl_ofi_irecv_opt.c \
38+
mtl_ofi_iprobe_opt.c \
39+
mtl_ofi_improbe_opt.c
3840

3941
mtl_ofi_sources = \
40-
mtl_ofi.h \
41-
mtl_ofi.c \
42-
mtl_ofi_compat.h \
43-
mtl_ofi_component.c \
44-
mtl_ofi_endpoint.h \
45-
mtl_ofi_endpoint.c \
46-
mtl_ofi_request.h \
47-
mtl_ofi_types.h \
48-
mtl_ofi_opt.h \
49-
$(generated_sources)
42+
mtl_ofi.h \
43+
mtl_ofi.c \
44+
mtl_ofi_compat.h \
45+
mtl_ofi_component.c \
46+
mtl_ofi_endpoint.h \
47+
mtl_ofi_endpoint.c \
48+
mtl_ofi_request.h \
49+
mtl_ofi_types.h \
50+
mtl_ofi_opt.h \
51+
$(generated_sources)
5052

5153
# A number of files are generated from macro expansion to minimize
5254
# branches in the critical path. These files have perl modules with the suffix
@@ -55,7 +57,7 @@ mtl_ofi_sources = \
5557
# files should be added to generated_source_modules, as well as adding
5658
# their .c variants to generated_sources.
5759
%.c : %.pm;
58-
$(PERL) generate-opt-funcs.pl $@
60+
$(PERL) -I$(top_srcdir)/ompi/mca/mtl/ofi $(top_srcdir)/ompi/mca/mtl/ofi/generate-opt-funcs.pl $@
5961

6062
# Make the output library in this directory, and name it either
6163
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
@@ -73,15 +75,14 @@ mcacomponentdir = $(ompilibdir)
7375
mcacomponent_LTLIBRARIES = $(component_install)
7476
mca_mtl_ofi_la_SOURCES = $(mtl_ofi_sources)
7577
mca_mtl_ofi_la_LDFLAGS = \
76-
$(ompi_mtl_ofi_LDFLAGS) \
78+
$(opal_ofi_LDFLAGS) \
7779
-module -avoid-version
7880
mca_mtl_ofi_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \
79-
$(ompi_mtl_ofi_LIBS) \
80-
$(OPAL_TOP_BUILDDIR)/opal/mca/common/ofi/lib@OPAL_LIB_PREFIX@mca_common_ofi.la
81+
$(opal_ofi_LIBS)
8182

8283
noinst_LTLIBRARIES = $(component_noinst)
8384
libmca_mtl_ofi_la_SOURCES = $(mtl_ofi_sources)
8485
libmca_mtl_ofi_la_LDFLAGS = \
85-
$(ompi_mtl_ofi_LDFLAGS) \
86+
$(opal_ofi_LDFLAGS) \
8687
-module -avoid-version
87-
libmca_mtl_ofi_la_LIBADD = $(ompi_mtl_ofi_LIBS)
88+
libmca_mtl_ofi_la_LIBADD = $(opal_ofi_LIBS)

ompi/mca/mtl/ofi/configure.m4

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Copyright (c) 2013-2014 Intel, Inc. All rights reserved
44
#
5-
# Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved.
5+
# Copyright (c) 2014-2019 Cisco Systems, Inc. All rights reserved
66
# Copyright (c) 2017 Los Alamos National Security, LLC. All rights
77
# reserved.
88
# $COPYRIGHT$
@@ -25,10 +25,10 @@ AC_DEFUN([MCA_ompi_mtl_ofi_POST_CONFIG], [
2525
AC_DEFUN([MCA_ompi_mtl_ofi_CONFIG],[
2626
AC_CONFIG_FILES([ompi/mca/mtl/ofi/Makefile])
2727

28-
# ensure we already ran the common OFI/libfabric config
29-
AC_REQUIRE([MCA_opal_common_ofi_CONFIG])
28+
# Check for OFI
29+
OPAL_CHECK_OFI
3030

31-
AS_IF([test "$opal_common_ofi_happy" = "yes"],
31+
AS_IF([test "$opal_ofi_happy" = "yes"],
3232
[$1],
3333
[$2])
3434
])dnl

0 commit comments

Comments
 (0)