Skip to content

Commit

Permalink
hydra: remove dependency on libslurm
Browse files Browse the repository at this point in the history
We use libslurm for host list string parsing if it is available.
However, libslurm's interface for slurm_hostlist_create changed recently
-- from return `hostlist_t` to returning `hostlist_t *`. However, users
may have different slurm library installed, makding supporting it
difficult. Because we always have the fallback parsing routines, let's
remove the dependency on libslurm for simplicity.
  • Loading branch information
hzhou committed Jan 8, 2025
1 parent 5483482 commit f0030c2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 38 deletions.
8 changes: 0 additions & 8 deletions src/pm/hydra/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -439,14 +439,6 @@ AM_CONDITIONAL([HYDRA_HAVE_HWLOC], [test "${pac_have_hwloc}" = "yes"])
AC_MSG_CHECKING([available processor topology libraries])
AC_MSG_RESULT([$available_topolibs])

#########################################################################
# Slurm hostlist parsing
#########################################################################
PAC_CHECK_HEADER_LIB_OPTIONAL([slurm],[slurm/slurm.h],[slurm],[slurm_hostlist_create])
if test "$pac_have_slurm" = "yes" ; then
AC_DEFINE(HAVE_SLURM,1,[Define if slurm is available])
fi

#########################################################################
# POSIX Regcomp
#########################################################################
Expand Down
32 changes: 2 additions & 30 deletions src/pm/hydra/lib/tools/bootstrap/external/slurm_query_node_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
#include "slurm.h"

/* START UNIT - list_to_nodes */
#if defined(HAVE_SLURM)
#include <slurm/slurm.h> /* for slurm_hostlist_create */
#elif defined(HAVE_POSIX_REGCOMP)
#if defined(HAVE_POSIX_REGCOMP)
#include <regex.h> /* for POSIX regular expressions */

#define MAX_GMATCH 5 /* max number of atoms in group matches + 1 */
Expand All @@ -23,33 +21,7 @@
static int *tasks_per_node = NULL;
static struct HYD_node *global_node_list = NULL;

#if defined(HAVE_SLURM)
static HYD_status list_to_nodes(char *str)
{
hostlist_t *hostlist;
char *host;
int k = 0;
HYD_status status = HYD_SUCCESS;

if ((hostlist = slurm_hostlist_create(str)) == NULL) {
status = HYD_FAILURE;
goto fn_fail;
}

for (host = slurm_hostlist_shift(hostlist); host; host = slurm_hostlist_shift(hostlist)) {
status = HYDU_add_to_node_list(host, tasks_per_node[k++], &global_node_list);
HYDU_ERR_POP(status, "unable to add to node list\n");
}

slurm_hostlist_destroy(hostlist);

fn_exit:
return status;

fn_fail:
goto fn_exit;
}
#elif defined(HAVE_POSIX_REGCOMP)
#if defined(HAVE_POSIX_REGCOMP)
static HYD_status list_to_nodes(char *str)
{
regex_t gmatch_old[2];
Expand Down

0 comments on commit f0030c2

Please sign in to comment.