Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: ability to enable HPCToolkit profiling on first quintain work RPC #37

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,25 @@ LIBS="$ZLIB_LIBS $LIBS"
CPPFLAGS="$ZLIB_CFLAGS $CPPFLAGS"
CFLAGS="$ZLIB_CFLAGS $CFLAGS"

AC_ARG_WITH([hpctoolkit],
[AS_HELP_STRING([--with-hpctoolkit],
[enable explicit support for HPCToolkit profiling control])],
[],
[with_hpctoolkit=no])

# if hpctoolkit support not disabled, check for header and library
if test x$with_hpctoolkit != xno; then
# guess that hpctoolkit might be in the spack env. Otherwise the user
# needs to set LDFLAGS appropriately at configure time
LIBS="-L$SPACK_ENV/.spack-env/view/lib/hpctoolkit $LIBS"
AC_CHECK_HEADER([hpctoolkit.h],
[AC_CHECK_LIB(hpctoolkit, hpctoolkit_sampling_start,
[AC_DEFINE(HAVE_HPCTOOLKIT, 1, [HPCToolkit support enabled])
LIBS="-lhpctoolkit $LIBS"],
[AC_MSG_ERROR(Cannot find required hpctoolkit_sampling_start() in libhpctoolkit)])],
[AC_MSG_ERROR(Cannot find hpctoolkit headers)])
fi

# optional mpi; this will cause the benchmark program to be built as well,
# in addition to the provider piece
AC_MSG_CHECKING([If MPI programs can be compiled])
Expand Down
15 changes: 15 additions & 0 deletions src/quintain-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
#include <margo-bulk-pool.h>
#include <quintain-server.h>

#ifdef HAVE_HPCTOOLKIT
#include <hpctoolkit.h>
#endif

#include "quintain-rpc.h"
#include "quintain-macros.h"

Expand Down Expand Up @@ -172,6 +176,10 @@ int quintain_provider_deregister(quintain_provider_t provider)
return QTN_SUCCESS;
}

#ifdef HAVE_HPCTOOLKIT
static int hpctoolkit_started = 0;
#endif

static void qtn_work_ult(hg_handle_t handle)
{
margo_instance_id mid = MARGO_INSTANCE_NULL;
Expand All @@ -186,6 +194,13 @@ static void qtn_work_ult(hg_handle_t handle)

memset(&out, 0, sizeof(out));

#ifdef HAVE_HPCTOOLKIT
if (!hpctoolkit_started) {
hpctoolkit_sampling_start();
hpctoolkit_started = 1;
}
#endif

mid = margo_hg_handle_get_instance(handle);
assert(mid);
info = margo_get_info(handle);
Expand Down
Loading