Skip to content

Commit 887400c

Browse files
authored
Merge pull request #7174 from jsquyres/pr/ofi-mtl-fi-version-bump
mtl/ofi: increase the FI_VERSION requested to 1.5 and make sure to check for OFI_LOCAL_COMM
2 parents dd2d7d2 + 49128a7 commit 887400c

File tree

4 files changed

+149
-43
lines changed

4 files changed

+149
-43
lines changed

config/opal_check_ofi.m4

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dnl -*- shell-script -*-
22
dnl
3-
dnl Copyright (c) 2015-2019 Cisco Systems, Inc. All rights reserved.
3+
dnl Copyright (c) 2015-2020 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,6 +10,45 @@ dnl
1010
dnl $HEADER$
1111
dnl
1212

13+
dnl
14+
dnl OPAL_CHECK_OFI_VERSION_GE
15+
dnl
16+
dnl Check that the OFI API version number is >= a specific value.
17+
dnl
18+
dnl $1: version number to compare, in the form of "major,minor"
19+
dnl (without quotes) -- i.e., a single token representing the
20+
dnl arguments to FI_VERSION()
21+
dnl $2: action if OFI API version is >= $1
22+
dnl $3: action if OFI API version is < $1
23+
AC_DEFUN([OPAL_CHECK_OFI_VERSION_GE],[
24+
OPAL_VAR_SCOPE_PUSH([opal_ofi_ver_ge_save_CPPFLAGS opal_ofi_ver_ge_happy])
25+
26+
AC_MSG_CHECKING([if OFI API version number is >= $1])
27+
opal_ofi_ver_ge_save_CPPFLAGS=$CPPFLAGS
28+
CPPFLAGS=$opal_ofi_CPPFLAGS
29+
30+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <rdma/fabric.h>]],
31+
[[
32+
#if !defined(FI_MAJOR_VERSION)
33+
#error "we cannot check the version -- sad panda"
34+
#elif FI_VERSION_LT(FI_VERSION(FI_MAJOR_VERSION, FI_MINOR_VERSION), FI_VERSION($1))
35+
#error "version is too low -- nopes"
36+
#endif
37+
]])],
38+
[opal_ofi_ver_ge_happy=1],
39+
[opal_ofi_ver_ge_happy=0])
40+
41+
AS_IF([test $opal_ofi_ver_ge_happy -eq 1],
42+
[AC_MSG_RESULT([yes])
43+
$2],
44+
[AC_MSG_RESULT([no])
45+
$3])
46+
47+
CPPFLAGS=$opal_ofi_ver_ge_save_CPPFLAGS
48+
49+
OPAL_VAR_SCOPE_POP
50+
])dnl
51+
1352
dnl
1453
dnl _OPAL_CHECK_OFI
1554
dnl --------------------------------------------------------

ompi/mca/mtl/ofi/configure.m4

Lines changed: 7 additions & 1 deletion
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-2019 Cisco Systems, Inc. All rights reserved
5+
# Copyright (c) 2014-2020 Cisco Systems, Inc. All rights reserved
66
# Copyright (c) 2017 Los Alamos National Security, LLC. All rights
77
# reserved.
88
# $COPYRIGHT$
@@ -28,6 +28,12 @@ AC_DEFUN([MCA_ompi_mtl_ofi_CONFIG],[
2828
# Check for OFI
2929
OPAL_CHECK_OFI
3030

31+
# The OFI MTL requires at least OFI libfabric v1.5.
32+
AS_IF([test "$opal_ofi_happy" = "yes"],
33+
[OPAL_CHECK_OFI_VERSION_GE([1,5],
34+
[],
35+
[opal_ofi_happy=no])])
36+
3137
AS_IF([test "$opal_ofi_happy" = "yes"],
3238
[$1],
3339
[$2])

ompi/mca/mtl/ofi/mtl_ofi_component.c

Lines changed: 97 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -341,21 +341,12 @@ is_in_list(char **list, char *item)
341341
}
342342

343343
static struct fi_info*
344-
select_ofi_provider(struct fi_info *providers)
344+
select_ofi_provider(struct fi_info *providers,
345+
char **include_list, char **exclude_list)
345346
{
346-
char **include_list = NULL;
347-
char **exclude_list = NULL;
348347
struct fi_info *prov = providers;
349348

350-
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
351-
"%s:%d: mtl:ofi:provider_include = \"%s\"\n",
352-
__FILE__, __LINE__, prov_include);
353-
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
354-
"%s:%d: mtl:ofi:provider_exclude = \"%s\"\n",
355-
__FILE__, __LINE__, prov_exclude);
356-
357-
if (NULL != prov_include) {
358-
include_list = opal_argv_split(prov_include, ',');
349+
if (NULL != include_list) {
359350
while ((NULL != prov) &&
360351
(!is_in_list(include_list, prov->fabric_attr->prov_name))) {
361352
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
@@ -364,8 +355,7 @@ select_ofi_provider(struct fi_info *providers)
364355
prov->fabric_attr->prov_name);
365356
prov = prov->next;
366357
}
367-
} else if (NULL != prov_exclude) {
368-
exclude_list = opal_argv_split(prov_exclude, ',');
358+
} else if (NULL != exclude_list) {
369359
while ((NULL != prov) &&
370360
(is_in_list(exclude_list, prov->fabric_attr->prov_name))) {
371361
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
@@ -376,9 +366,6 @@ select_ofi_provider(struct fi_info *providers)
376366
}
377367
}
378368

379-
opal_argv_free(include_list);
380-
opal_argv_free(exclude_list);
381-
382369
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
383370
"%s:%d: mtl:ofi:prov: %s\n",
384371
__FILE__, __LINE__,
@@ -621,7 +608,9 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads,
621608
int ret, fi_version;
622609
int num_local_ranks, sep_support_in_provider, max_ofi_ctxts;
623610
int ofi_tag_leading_zeros, ofi_tag_bits_for_cid;
624-
struct fi_info *hints;
611+
char **include_list = NULL;
612+
char **exclude_list = NULL;
613+
struct fi_info *hints, *hints_dup = NULL;
625614
struct fi_info *providers = NULL;
626615
struct fi_info *prov = NULL;
627616
struct fi_info *prov_cq_data = NULL;
@@ -630,6 +619,19 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads,
630619
int universe_size;
631620
char *univ_size_str;
632621

622+
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
623+
"%s:%d: mtl:ofi:provider_include = \"%s\"\n",
624+
__FILE__, __LINE__, prov_include);
625+
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
626+
"%s:%d: mtl:ofi:provider_exclude = \"%s\"\n",
627+
__FILE__, __LINE__, prov_exclude);
628+
629+
if (NULL != prov_include) {
630+
include_list = opal_argv_split(prov_include, ',');
631+
} else if (NULL != prov_exclude) {
632+
exclude_list = opal_argv_split(prov_exclude, ',');
633+
}
634+
633635
/**
634636
* Hints to filter providers
635637
* See man fi_getinfo for a list of all filters
@@ -647,9 +649,11 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads,
647649
__FILE__, __LINE__);
648650
goto error;
649651
}
652+
/* Make sure to get a RDM provider that can do the tagged matching
653+
interface and local communication and remote communication. */
650654
hints->mode = FI_CONTEXT;
651-
hints->ep_attr->type = FI_EP_RDM; /* Reliable datagram */
652-
hints->caps = FI_TAGGED; /* Tag matching interface */
655+
hints->ep_attr->type = FI_EP_RDM;
656+
hints->caps = FI_TAGGED | FI_LOCAL_COMM | FI_REMOTE_COMM;
653657
hints->tx_attr->msg_order = FI_ORDER_SAS;
654658
hints->rx_attr->msg_order = FI_ORDER_SAS;
655659
hints->rx_attr->op_flags = FI_COMPLETION;
@@ -697,8 +701,59 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads,
697701
* FI_VERSION provides binary backward and forward compatibility support
698702
* Specify the version of OFI is coded to, the provider will select struct
699703
* layouts that are compatible with this version.
704+
*
705+
* Note: API version 1.5 is the first version that supports
706+
* FI_LOCAL_COMM / FI_REMOTE_COMM checking (and we definitely need
707+
* that checking -- e.g., some providers are suitable for RXD or
708+
* RXM, but can't provide local communication).
700709
*/
701-
fi_version = FI_VERSION(1, 0);
710+
fi_version = FI_VERSION(1, 5);
711+
712+
/**
713+
* The EFA provider in Libfabric versions prior to 1.10 contains a bug
714+
* where the FI_LOCAL_COMM and FI_REMOTE_COMM capabilities are not
715+
* advertised. However, we know that this provider supports both local and
716+
* remote communication. We must exclude these capability bits in order to
717+
* select EFA when we are using a version of Libfabric with this bug.
718+
*
719+
* Call fi_getinfo() without those capabilities and specifically ask for
720+
* the EFA provider. This is safe to do as EFA is only supported on Amazon
721+
* EC2 and EC2 only supports EFA and TCP-based networks. We'll also skip
722+
* this logic if the user specifies an include list without EFA or adds EFA
723+
* to the exclude list.
724+
*/
725+
if ((include_list && is_in_list(include_list, "efa")) ||
726+
(exclude_list && !is_in_list(exclude_list, "efa"))) {
727+
hints_dup = fi_dupinfo(hints);
728+
hints_dup->caps &= ~(FI_LOCAL_COMM | FI_REMOTE_COMM);
729+
hints_dup->fabric_attr->prov_name = strdup("efa");
730+
731+
ret = fi_getinfo(fi_version, NULL, NULL, 0ULL, hints_dup, &providers);
732+
733+
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
734+
"%s:%d: EFA specific fi_getinfo(): %s\n",
735+
__FILE__, __LINE__, fi_strerror(-ret));
736+
737+
if (FI_ENODATA == -ret) {
738+
/**
739+
* EFA is not available so fall through to call fi_getinfo() again
740+
* with the local/remote capabilities set.
741+
*/
742+
fi_freeinfo(hints_dup);
743+
hints_dup = NULL;
744+
} else if (0 != ret) {
745+
opal_show_help("help-mtl-ofi.txt", "OFI call fail", true,
746+
"fi_getinfo",
747+
ompi_process_info.nodename, __FILE__, __LINE__,
748+
fi_strerror(-ret), -ret);
749+
goto error;
750+
} else {
751+
fi_freeinfo(hints);
752+
hints = hints_dup;
753+
hints_dup = NULL;
754+
goto select_prov;
755+
}
756+
}
702757

703758
/**
704759
* fi_getinfo: returns information about fabric services for reaching a
@@ -711,6 +766,11 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads,
711766
0ULL, /* Optional flag */
712767
hints, /* In: Hints to filter providers */
713768
&providers); /* Out: List of matching providers */
769+
770+
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
771+
"%s:%d: fi_getinfo(): %s\n",
772+
__FILE__, __LINE__, fi_strerror(-ret));
773+
714774
if (FI_ENODATA == -ret) {
715775
// It is not an error if no information is returned.
716776
goto error;
@@ -722,17 +782,23 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads,
722782
goto error;
723783
}
724784

785+
select_prov:
725786
/**
726787
* Select a provider from the list returned by fi_getinfo().
727788
*/
728-
prov = select_ofi_provider(providers);
789+
prov = select_ofi_provider(providers, include_list, exclude_list);
729790
if (!prov) {
730791
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
731792
"%s:%d: select_ofi_provider: no provider found\n",
732793
__FILE__, __LINE__);
733794
goto error;
734795
}
735796

797+
opal_argv_free(include_list);
798+
include_list = NULL;
799+
opal_argv_free(exclude_list);
800+
exclude_list = NULL;
801+
736802
/**
737803
* Select the format of the OFI tag
738804
*/
@@ -1006,6 +1072,12 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads,
10061072
return &ompi_mtl_ofi.base;
10071073

10081074
error:
1075+
if (include_list) {
1076+
opal_argv_free(include_list);
1077+
}
1078+
if (exclude_list) {
1079+
opal_argv_free(exclude_list);
1080+
}
10091081
if (providers) {
10101082
(void) fi_freeinfo(providers);
10111083
}
@@ -1015,6 +1087,9 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads,
10151087
if (hints) {
10161088
(void) fi_freeinfo(hints);
10171089
}
1090+
if (hints_dup) {
1091+
(void) fi_freeinfo(hints_dup);
1092+
}
10181093
if (ompi_mtl_ofi.sep) {
10191094
(void) fi_close((fid_t)ompi_mtl_ofi.sep);
10201095
}

opal/mca/btl/usnic/configure.m4

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# All rights reserved.
1313
# Copyright (c) 2006 Sandia National Laboratories. All rights
1414
# reserved.
15-
# Copyright (c) 2010-2019 Cisco Systems, Inc. All rights reserved
15+
# Copyright (c) 2010-2020 Cisco Systems, Inc. All rights reserved
1616
# Copyright (c) 2017 Los Alamos National Security, LLC. All rights
1717
# reserved.
1818
# $COPYRIGHT$
@@ -100,25 +100,11 @@ AC_DEFUN([_OPAL_BTL_USNIC_DO_CONFIG],[
100100
OPAL_CHECK_OFI
101101
opal_btl_usnic_happy=$opal_ofi_happy])
102102

103-
# The usnic BTL requires at least OFI libfabric v1.1 (there was a
104-
# critical bug in libfabric v1.0).
103+
# The usnic BTL requires at least OFI libfabric v1.3.
105104
AS_IF([test "$opal_btl_usnic_happy" = "yes"],
106-
[AC_MSG_CHECKING([whether OFI libfabric is >= v1.1])
107-
opal_btl_usnic_CPPFLAGS_save=$CPPFLAGS
108-
CPPFLAGS="$opal_ofi_CPPFLAGS $CPPFLAGS"
109-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <rdma/fabric.h>]],
110-
[[
111-
#if !defined(FI_MAJOR_VERSION)
112-
#error your version of OFI libfabric is too old
113-
#elif FI_VERSION(FI_MAJOR_VERSION, FI_MINOR_VERSION) < FI_VERSION(1, 1)
114-
#error your version of OFI libfabric is too old
115-
#endif
116-
]])],
117-
[opal_btl_usnic_happy=yes],
118-
[opal_btl_usnic_happy=no])
119-
AC_MSG_RESULT([$opal_btl_usnic_happy])
120-
CPPFLAGS=$opal_btl_usnic_CPPFLAGS_save
121-
])
105+
[OPAL_CHECK_OFI_VERSION_GE([1,3],
106+
[],
107+
[opal_btl_usnic_happy=no])])
122108

123109
# Make sure we can find the OFI libfabric usnic extensions header
124110
AS_IF([test "$opal_btl_usnic_happy" = "yes" ],

0 commit comments

Comments
 (0)