Skip to content

Commit 947b3fe

Browse files
committed
ofi: Improve memory monitor detection
Test for the features needed to support injecting a memory monitor in Libfabric, rather than testing for a Libfabric version. Signed-off-by: Brian Barrett <bbarrett@amazon.com>
1 parent 00a5108 commit 947b3fe

File tree

2 files changed

+20
-25
lines changed

2 files changed

+20
-25
lines changed

config/opal_check_ofi.m4

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -126,19 +126,26 @@ AC_DEFUN([_OPAL_CHECK_OFI],[
126126
CPPFLAGS="$CPPFLAGS $opal_ofi_CPPFLAGS"
127127

128128
AS_IF([test $opal_ofi_happy = yes],
129-
[AC_CHECK_MEMBER([struct fi_info.nic],
129+
[AC_CHECK_HEADERS([rdma/fi_ext.h])
130+
131+
AC_CHECK_MEMBER([struct fi_info.nic],
130132
[opal_check_fi_info_pci=1],
131133
[opal_check_fi_info_pci=0],
132-
[[#include <rdma/fabric.h>]])])
134+
[[#include <rdma/fabric.h>]])
135+
136+
AC_DEFINE_UNQUOTED([OPAL_OFI_PCI_DATA_AVAILABLE],
137+
[$opal_check_fi_info_pci],
138+
[check if pci data is available in ofi])
133139

134-
AC_DEFINE_UNQUOTED([OPAL_OFI_PCI_DATA_AVAILABLE],
135-
[$opal_check_fi_info_pci],
136-
[check if pci data is available in ofi])
140+
AC_CHECK_DECLS([PMIX_PACKAGE_RANK],
141+
[],
142+
[],
143+
[#include <pmix.h>])
137144

138-
AC_CHECK_DECLS([PMIX_PACKAGE_RANK],
139-
[],
140-
[],
141-
[#include <pmix.h>])
145+
AC_CHECK_TYPES([struct fi_ops_mem_monitor], [], [],
146+
[#ifdef HAVE_RDMA_FI_EXT_H
147+
#include <rdma/fi_ext.h>
148+
#endif])])
142149

143150
CPPFLAGS=$opal_check_ofi_save_CPPFLAGS
144151
LDFLAGS=$opal_check_ofi_save_LDFLAGS
@@ -157,18 +164,6 @@ AC_DEFUN([_OPAL_CHECK_OFI],[
157164
[AC_MSG_WARN([OFI libfabric support requested (via --with-ofi or --with-libfabric), but not found.])
158165
AC_MSG_ERROR([Cannot continue.])])
159166
])
160-
opal_ofi_import_monitor=no
161-
AS_IF([test $opal_ofi_happy = "yes"],
162-
[OPAL_CHECK_OFI_VERSION_GE([1,14],
163-
[opal_ofi_import_monitor=yes],
164-
[opal_ofi_import_monitor=no])])
165-
166-
167-
if test "$opal_ofi_import_monitor" = "yes"; then
168-
AC_DEFINE_UNQUOTED([OPAL_OFI_IMPORT_MONITOR_SUPPORT],1,
169-
[Whether libfabric supports monitor import])
170-
fi
171-
172167
])dnl
173168

174169

opal/mca/common/ofi/common_ofi.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <errno.h>
2222
#include <unistd.h>
2323
#include <rdma/fabric.h>
24-
#if OPAL_OFI_IMPORT_MONITOR_SUPPORT
24+
#ifdef HAVE_RDMA_FI_EXT_H
2525
#include <rdma/fi_ext.h>
2626
#endif
2727

@@ -45,7 +45,7 @@ static opal_mutex_t opal_common_ofi_mutex = OPAL_MUTEX_STATIC_INIT;
4545
static bool opal_common_ofi_initialized = false;
4646
static int opal_common_ofi_init_ref_cnt = 0;
4747

48-
#if OPAL_OFI_IMPORT_MONITOR_SUPPORT
48+
#ifdef HAVE_STRUCT_FI_OPS_MEM_MONITOR
4949

5050
static int opal_common_ofi_monitor_start(struct fid_mem_monitor *monitor)
5151
{
@@ -88,7 +88,7 @@ static void opal_common_ofi_mem_release_cb(void *buf, size_t length,
8888
opal_common_ofi_monitor->import_ops->notify(opal_common_ofi_monitor,
8989
buf, length);
9090
}
91-
#endif /* OPAL_OFI_IMPORT_MONITOR_SUPPORT */
91+
#endif /* HAVE_STRUCT_FI_OPS_MEM_MONITOR */
9292

9393
int opal_common_ofi_init(void)
9494
{
@@ -98,7 +98,7 @@ int opal_common_ofi_init(void)
9898
if (opal_common_ofi_initialized) {
9999
return OPAL_SUCCESS;
100100
}
101-
#if OPAL_OFI_IMPORT_MONITOR_SUPPORT
101+
#ifdef HAVE_STRUCT_FI_OPS_MEM_MONITOR
102102

103103
mca_base_framework_open(&opal_memory_base_framework, 0);
104104
if ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT)

0 commit comments

Comments
 (0)