Skip to content

Commit

Permalink
Add an action to test older HWLOC version
Browse files Browse the repository at this point in the history
Signed-off-by: Ralph Castain <rhc@pmix.org>
  • Loading branch information
rhc54 committed Oct 4, 2023
1 parent 9ddcf0a commit 9a7e95f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 71 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/builds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,38 @@ jobs:
make install
make uninstall
ubuntu-oldHWLOC:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends software-properties-common libevent-dev
- name: Git clone HWLOC v1.x
uses: actions/checkout@v4
with:
repository: open-mpi/hwloc
ref: hwloc-1.11.13
- name: Build HWLOC
run: |
./autogen.sh
./configure --prefix=$RUNNER_TEMP/hwlocinstall
make -j install
- name: Git clone OpenPMIx
uses: actions/checkout@v3
with:
submodules: recursive
- name: Build OpenPMIx
run: |
./autogen.pl
./configure --prefix=${PWD}/install --with-hwloc=$RUNNER_TEMP/hwlocinstall
make -j
cd test
make check
cd ..
make install
make uninstall
distcheck:
runs-on: ubuntu-latest
steps:
Expand Down
13 changes: 10 additions & 3 deletions config/pmix_setup_hwloc.m4
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# MCA_hwloc_CONFIG([action-if-found], [action-if-not-found])
# --------------------------------------------------------------------
AC_DEFUN([PMIX_SETUP_HWLOC],[
PMIX_VAR_SCOPE_PUSH([pmix_hwloc_dir pmix_hwloc_libdir])
PMIX_VAR_SCOPE_PUSH([pmix_hwloc_dir pmix_hwloc_libdir pmix_check_hwloc_save_CPPFLAGS])

AC_ARG_WITH([hwloc],
[AS_HELP_STRING([--with-hwloc=DIR],
Expand All @@ -32,9 +32,10 @@ AC_DEFUN([PMIX_SETUP_HWLOC],[
[If --disable-hwloc-lib-checks is specified, configure will assume that -lhwloc is available])])

pmix_hwloc_support=1
pmix_check_hwloc_save_CPPFLAGS="$CPPFLAGS"

if test "$with_hwloc" = "no"; then
AC_MSG_WARN([PRRTE requires HWLOC topology library support.])
AC_MSG_WARN([PMIx requires HWLOC topology library support.])
AC_MSG_WARN([Please reconfigure so we can find the library.])
AC_MSG_ERROR([Cannot continue.])
fi
Expand All @@ -53,13 +54,16 @@ AC_DEFUN([PMIX_SETUP_HWLOC],[
[PMIX_FLAGS_APPEND_UNIQ([PMIX_FINAL_LIBS], [$with_hwloc_extra_libs])])

if test $pmix_hwloc_support -eq 0; then
AC_MSG_WARN([PRRTE requires HWLOC topology library support, but])
AC_MSG_WARN([PMIx requires HWLOC topology library support, but])
AC_MSG_WARN([an adequate version of that library was not found.])
AC_MSG_WARN([Please reconfigure and point to a location where])
AC_MSG_WARN([the HWLOC library can be found.])
AC_MSG_ERROR([Cannot continue.])
fi

# update global flags to test for HWLOC version
PMIX_FLAGS_PREPEND_UNIQ([CPPFLAGS], [$pmix_hwloc_CPPFLAGS])

# NOTE: We have already read PMIx's VERSION file, so we can use
# those values
pmix_hwloc_min_num_version=PMIX_HWLOC_NUMERIC_MIN_VERSION
Expand Down Expand Up @@ -103,6 +107,9 @@ AC_DEFUN([PMIX_SETUP_HWLOC],[
AC_MSG_WARN([to an HWLOC version in the $pmix_hwloc_min_version-2.x range.])
AC_MSG_ERROR([Cannot continue])])

# reset global flags
CPPFLAGS=$pmix_check_hwloc_save_CPPFLAGS

PMIX_FLAGS_APPEND_UNIQ([CPPFLAGS], [$pmix_hwloc_CPPFLAGS])
PMIX_WRAPPER_FLAGS_ADD([CPPFLAGS], [$pmix_hwloc_CPPFLAGS])

Expand Down
68 changes: 0 additions & 68 deletions src/hwloc/pmix_hwloc_datatype.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,80 +342,12 @@ pmix_status_t pmix_hwloc_copy_topology(pmix_topology_t *dest, pmix_topology_t *s
}
dest->source = strdup("hwloc");

#if PMIX_HAVE_HWLOC_TOPOLOGY_DUP
/* use the hwloc dup function */
if (0 != hwloc_topology_dup((hwloc_topology_t *) &dest->topology, src->topology)) {
return PMIX_ERROR;
}

return PMIX_SUCCESS;
#else
/* we have to do this in a convoluted manner */
char *xmlbuffer = NULL;
int len;
struct hwloc_topology_support *srcsup, *destsup;
pmix_status_t rc;
unsigned long flags;

/* extract an xml-buffer representation of the tree */
# if HWLOC_API_VERSION < 0x20000
if (0 != hwloc_topology_export_xmlbuffer(src->topology, &xmlbuffer, &len)) {
return PMIX_ERROR;
}
# else
if (0 != hwloc_topology_export_xmlbuffer(src->topology, &xmlbuffer, &len, 0)) {
return PMIX_ERROR;
}
# endif

/* convert the xml back */
if (0 != hwloc_topology_init((hwloc_topology_t *) &dest->topology)) {
rc = PMIX_ERROR;
free(xmlbuffer);
return rc;
}
if (0 != hwloc_topology_set_xmlbuffer(dest->topology, xmlbuffer, strlen(xmlbuffer)+1)) {
rc = PMIX_ERROR;
free(xmlbuffer);
hwloc_topology_destroy(dest->topology);
return rc;
}

/* since we are loading this from an external source, we have to
* explicitly set a flag so hwloc sets things up correctly
*/
flags = HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM;
#if HWLOC_API_VERSION < 0x00020000
flags |= HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM;
flags |= HWLOC_TOPOLOGY_FLAG_IO_DEVICES;
#else
if (0 != hwloc_topology_set_io_types_filter(dest->topology, HWLOC_TYPE_FILTER_KEEP_IMPORTANT)) {
hwloc_topology_destroy(dest->topology);
free(xmlbuffer);
return PMIX_ERROR;
}
flags |= HWLOC_TOPOLOGY_FLAG_INCLUDE_DISALLOWED;
#endif
if (0 != hwloc_topology_set_flags(dest->topology, flags)) {
hwloc_topology_destroy(dest->topology);
free(xmlbuffer);
return PMIX_ERROR;
}
/* now load the topology */
if (0 != hwloc_topology_load(dest->topology)) {
hwloc_topology_destroy(dest->topology);
free(xmlbuffer);
return PMIX_ERROR;
}
free(xmlbuffer);

/* transfer the support struct */
srcsup = (struct hwloc_topology_support *) hwloc_topology_get_support((hwloc_topology_t) src->topology);
destsup = (struct hwloc_topology_support *) hwloc_topology_get_support(dest->topology);
memcpy(destsup, srcsup, sizeof(struct hwloc_topology_support));

return PMIX_SUCCESS;
#endif
}

#define PMIX_HWLOC_MAX_STRING 2048
Expand Down

0 comments on commit 9a7e95f

Please sign in to comment.