Commit 3a5c4c46 authored by Jonathan Jenkins's avatar Jonathan Jenkins

margo support in lookup

parent ab72f107
Pipeline #113 skipped
......@@ -36,12 +36,6 @@ dnl
PKG_PROG_PKG_CONFIG
PKG_CONFIG="pkg-config --static"
PKG_CHECK_MODULES_STATIC([MERCURY],[mercury],[],
[AC_MSG_ERROR([Could not find working mercury installation!])])
LIBS="$MERCURY_LIBS $LIBS"
CPPFLAGS="$MERCURY_CFLAGS $CPPFLAGS"
CFLAGS="$MERCURY_CFLAGS $CFLAGS"
check_mpi=auto
AC_ARG_ENABLE([mpi],
[--enable-mpi Enable MPI (default: dynamic check)],
......@@ -70,5 +64,35 @@ fi
AM_CONDITIONAL([HAVE_MPI], [test "x${check_mpi_status}" = xsuccess])
check_margo=auto
AC_ARG_ENABLE([margo],
[--enable-margo Enable Margo (default: dynamic check)],
[case "${enableval}" in
yes) check_margo=yes ;;
no) check_margo=no ;;
*) AC_MSG_ERROR([Invalid value ${enableval} for --enable-margo])
esac])
if test "x${check_margo}" = xauto -o "x${check_margo}" = xyes ; then
PKG_CHECK_MODULES_STATIC([MARGO],[margo],
[AC_DEFINE([HAVE_MARGO], [1], [Define to 1 if compiled with Margo support])
LIBS="$MARGO_LIBS $LIBS"
CPPFLAGS="$MARGO_CFLAGS $CPPFLAGS"
CFLAGS="$MARGO_CFLAGS $CFLAGS"
check_margo_status=success], [check_margo_status=fail])
fi
if test "x${check_margo_status}" = xfail -a "x${check_margo}" = xyes; then
AC_MSG_ERROR([Margo requested but unable to be used. See config.log])
fi
AM_CONDITIONAL([HAVE_MARGO], [test "x${check_margo_status}" = xsuccess])
# mercury check goes last - libs should be linked in before margo
PKG_CHECK_MODULES_STATIC([MERCURY],[mercury],
[LIBS="$MERCURY_LIBS $LIBS"
CPPFLAGS="$MERCURY_CFLAGS $CPPFLAGS"
CFLAGS="$MERCURY_CFLAGS $CFLAGS"])
AC_CONFIG_FILES([Makefile maint/ssg.pc])
AC_OUTPUT
......@@ -15,6 +15,9 @@
#ifdef HAVE_MPI
#include <ssg-mpi.h>
#endif
#ifdef HAVE_MARGO
#include <ssg-margo.h>
#endif
// helpers for looking up a server
static hg_return_t lookup_serv_addr_cb(const struct hg_cb_info *info);
......@@ -256,6 +259,60 @@ hg_return_t ssg_lookup(ssg_t s, hg_context_t *hgctx)
return HG_SUCCESS;
}
#ifdef HAVE_MARGO
// TODO: refactor - code is mostly a copy of ssg_lookup
hg_return_t ssg_lookup_margo(ssg_t s, margo_instance_id mid)
{
hg_context_t *hgctx;
hg_return_t hret;
// "effective" rank for the lookup loop
int eff_rank = 0;
// set the hg class up front - need for destructing addrs
hgctx = margo_get_context(mid);
if (hgctx == NULL) return HG_INVALID_PARAM;
s->hgcl = margo_get_class(mid);
if (s->hgcl == NULL) return HG_INVALID_PARAM;
// perform search for my rank if not already set
if (s->rank == SSG_RANK_UNKNOWN) {
hret = find_rank(s->hgcl, s);
if (hret != HG_SUCCESS) return hret;
}
if (s->rank == SSG_EXTERNAL_RANK) {
// do a completely arbitrary effective rank determination to try and
// prevent everyone talking to the same member at once
eff_rank = (((intptr_t)hgctx)/sizeof(hgctx)) % s->num_addrs;
}
else
eff_rank = s->rank;
// rank is set, perform lookup
for (int i = eff_rank+1; i < s->num_addrs; i++) {
hret = margo_addr_lookup(
mid, hgctx, s->addr_strs[i], &s->addrs[i]);
if (hret != HG_SUCCESS) return hret;
else if (s->addrs[i] == HG_ADDR_NULL) return HG_PROTOCOL_ERROR;
}
for (int i = 0; i < eff_rank; i++) {
hret = margo_addr_lookup(
mid, hgctx, s->addr_strs[i], &s->addrs[i]);
if (hret != HG_SUCCESS) return hret;
else if (s->addrs[i] == HG_ADDR_NULL) return HG_PROTOCOL_ERROR;
}
if (s->rank == SSG_EXTERNAL_RANK) {
hret = margo_addr_lookup(
mid, hgctx, s->addr_strs[eff_rank], &s->addrs[eff_rank]);
if (hret != HG_SUCCESS) return hret;
else if (s->addrs[eff_rank] == HG_ADDR_NULL) return HG_PROTOCOL_ERROR;
}
return HG_SUCCESS;
}
#endif
void ssg_finalize(ssg_t s)
{
if (s == SSG_NULL) return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment