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

drop caliper support #6475

Merged
merged 1 commit into from
Dec 5, 2024
Merged
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
12 changes: 0 additions & 12 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -427,18 +427,6 @@ AS_IF([test "x$with_flux_security" = "xyes"], [
])
AM_CONDITIONAL([HAVE_FLUX_SECURITY], [test "x$with_flux_security" = "xyes"])

AC_ARG_ENABLE(caliper,
[ --enable-caliper[=OPTS] Use caliper for profiling. [default=no] [OPTS=no/yes]], ,
[enable_caliper="no"])

if test "$enable_caliper" = "yes"; then
PKG_CHECK_MODULES([CALIPER], [caliper], [], [])
CFLAGS="${CFLAGS} ${CALIPER_CFLAGS} "
# Do not use CALIPER_LIBS, only link to libcaliper-stub
LIBS="${LIBS} $(pkg-config --libs-only-L caliper) -lcaliper-stub -lrt "
AC_DEFINE([HAVE_CALIPER], [1], [Define if you have libcaliper])
fi

AC_ARG_ENABLE([content-s3],
AS_HELP_STRING([--enable-content-s3], [Enable S3 storage backend]))

Expand Down
7 changes: 0 additions & 7 deletions doc/man1/flux-start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,6 @@ OPTIONS

Don't execute anything. This option is most useful with -v.

.. option:: --caliper-profile=PROFILE

Run brokers with Caliper profiling enabled, using a Caliper
configuration profile named *PROFILE*. Requires a version of Flux
built with :option:`--enable-caliper`. Unless :envvar:`CALI_LOG_VERBOSITY`
is already set in the environment, it will default to 0 for all brokers.

.. option:: --rundir=DIR

(only with :option:`--test-size`) Set the directory that will be
Expand Down
12 changes: 0 additions & 12 deletions scripts/fetch-and-build-caliper.sh

This file was deleted.

23 changes: 0 additions & 23 deletions src/broker/broker.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
#endif
#include <flux/core.h>
#include <jansson.h>
#if HAVE_CALIPER
#include <caliper/cali.h>
#include <sys/syscall.h>
#endif
#if HAVE_VALGRIND
# if HAVE_VALGRIND_H
# include <valgrind.h>
Expand Down Expand Up @@ -170,22 +166,6 @@ void parse_command_line_arguments (int argc, char *argv[], broker_ctx_t *ctx)
}
}

static int setup_profiling (const char *program, int rank)
{
#if HAVE_CALIPER
cali_begin_string_byname ("flux.type", "main");
cali_begin_int_byname ("flux.tid", syscall (SYS_gettid));
cali_begin_string_byname ("binary", program);
cali_begin_int_byname ("flux.rank", rank);
// TODO: this is a stopgap until we have better control over
// instrumemtation in child processes. If we want to see what children
// that load libflux are up to, this should be disabled
unsetenv ("CALI_SERVICES_ENABLE");
unsetenv ("CALI_CONFIG_PROFILE");
#endif
return (0);
}

static int increase_rlimits (void)
{
struct rlimit rlim;
Expand Down Expand Up @@ -406,9 +386,6 @@ int main (int argc, char *argv[])
flux_reactor_now (ctx.reactor) - ctx.starttime);
}

// Setup profiling
setup_profiling (argv[0], ctx.rank);

/* Initialize logging.
* OK to call flux_log*() after this.
*/
Expand Down
10 changes: 0 additions & 10 deletions src/broker/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@
#endif
#include <flux/core.h>
#include <jansson.h>
#if HAVE_CALIPER
#include <caliper/cali.h>
#include <sys/syscall.h>
#endif

#include "src/common/libflux/plugin_private.h"
#include "src/common/libutil/log.h"
Expand Down Expand Up @@ -90,12 +86,6 @@ struct broker_module {

static int setup_module_profiling (module_t *p)
{
#if HAVE_CALIPER
cali_begin_string_byname ("flux.type", "module");
cali_begin_int_byname ("flux.tid", syscall (SYS_gettid));
cali_begin_int_byname ("flux.rank", p->rank);
cali_begin_string_byname ("flux.name", p->name);
#endif
size_t len = strlen (p->name);
// one character longer than target to pass -Wstringop-truncation
char local_name[17] = {0};
Expand Down
3 changes: 0 additions & 3 deletions src/cmd/builtin/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ static int cmd_version (optparse_t *p, int ac, char *av[])
#if __SANITIZE_THREAD__
printf ("+tsan");
#endif
#if HAVE_CALIPER
printf ("+caliper");
#endif
#if HAVE_LIBSYSTEMD
printf ("+systemd");
#endif
Expand Down
41 changes: 0 additions & 41 deletions src/cmd/flux-start.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ int exec_broker (const char *cmd_argz,
char *create_rundir (void);
void client_destroy (struct client *cli);
char *find_broker (const char *searchpath);
static void setup_profiling_env (void);
static void client_wait_respond (struct client *cli);
static void client_run_respond (struct client *cli, int errnum);

Expand All @@ -119,14 +118,6 @@ static struct optparse_option opts[] = {
.flags = OPTPARSE_OPT_AUTOSPLIT,
.usage = "Add comma-separated broker options, e.g. \"-o,-v\"", },
/* Option group 1, these options will be listed after those above */
#if HAVE_CALIPER
{ .group = 1,
.name = "caliper-profile", .has_arg = 1,
.arginfo = "PROFILE",
.usage = "Enable profiling in brokers using Caliper configuration "
"profile named `PROFILE'",
},
#endif /* !HAVE_CALIPER */
{ .group = 1,
.name = "wrap", .has_arg = 1, .arginfo = "ARGS,...",
.flags = OPTPARSE_OPT_AUTOSPLIT,
Expand Down Expand Up @@ -239,8 +230,6 @@ int main (int argc, char *argv[])
log_msg_exit ("--test-size argument must be > 0");
}

setup_profiling_env ();

if (!optparse_hasopt (ctx.opts, "test-size")) {
int i;
for (i = 0; i < ARRAY_SIZE (opts); i++) {
Expand Down Expand Up @@ -270,36 +259,6 @@ int main (int argc, char *argv[])
return status;
}

static void setup_profiling_env (void)
{
#if HAVE_CALIPER
const char *profile;
/*
* If --profile was used, set or append libcaliper.so in LD_PRELOAD
* to subprocess environment, swapping stub symbols for the actual
* libcaliper symbols.
*/
if (optparse_getopt (ctx.opts, "caliper-profile", &profile) == 1) {
const char *pl = getenv ("LD_PRELOAD");
int rc = setenvf ("LD_PRELOAD",
1,
"%s%s%s",
pl ? pl : "",
pl ? " ": "",
"libcaliper.so");
if (rc < 0)
log_err_exit ("Unable to set LD_PRELOAD in environment");

if ((profile != NULL) &&
(setenv ("CALI_CONFIG_PROFILE", profile, 1) < 0))
log_err_exit ("setenv (CALI_CONFIG_PROFILE)");
setenv ("CALI_LOG_VERBOSITY", "0", 0);
}
#endif
}



char *find_broker (const char *searchpath)
{
char *cpy = xstrdup (searchpath);
Expand Down
150 changes: 0 additions & 150 deletions src/common/libflux/handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
#include <dlfcn.h>
#include <sys/epoll.h>
#include <poll.h>
#if HAVE_CALIPER
#include <caliper/cali.h>
#include <sys/syscall.h>
#endif
#include <flux/core.h>

#include "src/common/libflux/plugin_private.h"
Expand All @@ -42,23 +38,6 @@
#include "msg_deque.h"
#include "message_private.h" // to check msg refcount in flux_send_new ()

#if HAVE_CALIPER
struct profiling_context {
int initialized;
cali_id_t msg_type;
cali_id_t msg_seq;
cali_id_t msg_topic;
cali_id_t msg_sender;
cali_id_t msg_rpc;
cali_id_t msg_rpc_nodeid;
cali_id_t msg_rpc_resp_expected;
cali_id_t msg_action;
cali_id_t msg_match_type;
cali_id_t msg_match_tag;
cali_id_t msg_match_glob;
};
#endif

struct flux_handle {
flux_t *parent; // if FLUX_O_CLONE, my parent
struct aux_item *aux;
Expand All @@ -78,9 +57,6 @@ struct flux_handle {
void *comms_error_arg;
bool comms_error_in_progress;
bool destroy_in_progress;
#if HAVE_CALIPER
struct profiling_context prof;
#endif
struct rpc_track *tracker;
};

Expand Down Expand Up @@ -121,107 +97,6 @@ static flux_t *lookup_clone_ancestor (flux_t *h)
return h;
}

#if HAVE_CALIPER
void profiling_context_init (struct profiling_context* prof)
{
prof->msg_type = cali_create_attribute ("flux.message.type",
CALI_TYPE_STRING,
CALI_ATTR_DEFAULT | CALI_ATTR_ASVALUE);
prof->msg_seq = cali_create_attribute ("flux.message.seq",
CALI_TYPE_INT,
CALI_ATTR_SKIP_EVENTS);
prof->msg_topic = cali_create_attribute ("flux.message.topic",
CALI_TYPE_STRING,
CALI_ATTR_DEFAULT | CALI_ATTR_ASVALUE);
prof->msg_sender = cali_create_attribute ("flux.message.sender",
CALI_TYPE_STRING,
CALI_ATTR_SKIP_EVENTS);
// if flux.message.rpc is set, we're inside an RPC, it will be set to a
// type, single or multi
prof->msg_rpc = cali_create_attribute ("flux.message.rpc",
CALI_TYPE_STRING,
CALI_ATTR_SKIP_EVENTS);
prof->msg_rpc_nodeid = cali_create_attribute ("flux.message.rpc.nodeid",
CALI_TYPE_INT,
CALI_ATTR_SKIP_EVENTS);
prof->msg_rpc_resp_expected =
cali_create_attribute ("flux.message.response_expected",
CALI_TYPE_INT,
CALI_ATTR_SKIP_EVENTS);
prof->msg_action = cali_create_attribute ("flux.message.action",
CALI_TYPE_STRING,
CALI_ATTR_DEFAULT | CALI_ATTR_ASVALUE);
prof->msg_match_type = cali_create_attribute ("flux.message.match.type",
CALI_TYPE_INT,
CALI_ATTR_SKIP_EVENTS);
prof->msg_match_tag = cali_create_attribute ("flux.message.match.tag",
CALI_TYPE_INT,
CALI_ATTR_SKIP_EVENTS);
prof->msg_match_glob = cali_create_attribute ("flux.message.match.glob",
CALI_TYPE_STRING,
CALI_ATTR_SKIP_EVENTS);
prof->initialized=1;
}

static void profiling_msg_snapshot (flux_t *h,
const flux_msg_t *msg,
int flags,
const char *msg_action)
{
h = lookup_clone_ancestor (h);
cali_id_t attributes[3];
const void * data[3];
size_t size[3];

// This can get called before the handle is really ready
if(! h->prof.initialized) return;

int len = 0;

if (msg_action) {
attributes[len] = h->prof.msg_action;
data[len] = msg_action;
size[len] = strlen(msg_action);
++len;
}

int type;
flux_msg_get_type (msg, &type);
const char *msg_type = flux_msg_typestr (type);
if (msg_type) {
attributes[len] = h->prof.msg_type;
data[len] = msg_type;
size[len] = strlen(msg_type);
++len;
}

const char *msg_topic;
if (type != FLUX_MSGTYPE_CONTROL)
flux_msg_get_topic (msg, &msg_topic);
else
msg_topic = "NONE";
/* attributes[len] = h->prof.msg_topic; */
/* data[len] = msg_topic; */
/* size[len] = strlen(msg_topic); */
/* ++len; */

if (type == FLUX_MSGTYPE_EVENT) {
uint32_t seq;
flux_msg_get_seq (msg, &seq);
cali_begin_int (h->prof.msg_seq, seq);
}
cali_push_snapshot (CALI_SCOPE_PROCESS | CALI_SCOPE_THREAD,
len /* n_entries */,
attributes /* event_attributes */,
data /* event_data */,
size /* event_size */);
if (type == FLUX_MSGTYPE_EVENT)
cali_end (h->prof.msg_seq);
}


#endif

static connector_init_f *find_connector_builtin (const char *scheme)
{
for (int i = 0; i < ARRAY_SIZE (builtin_connectors); i++)
Expand Down Expand Up @@ -352,9 +227,6 @@ flux_t *flux_open_ex (const char *uri, int flags, flux_error_t *errp)
goto error;
}
h->dso = dso;
#if HAVE_CALIPER
profiling_context_init(&h->prof);
#endif
if ((s = getenv ("FLUX_HANDLE_USERID"))) {
uint32_t userid = strtoul (s, NULL, 10);
if (flux_opt_set (h,
Expand Down Expand Up @@ -877,9 +749,6 @@ int flux_send (flux_t *h, const flux_msg_t *msg, int flags)
flags |= h->flags;
update_tx_stats (h, msg);
handle_trace_message (h, msg);
#if HAVE_CALIPER
profiling_msg_snapshot(h, msg, flags, "send");
#endif
while (h->ops->send (h->impl, msg, flags) < 0) {
if (comms_error (h, errno) < 0)
return -1;
Expand Down Expand Up @@ -913,9 +782,6 @@ int flux_send_new (flux_t *h, flux_msg_t **msg, int flags)
flags |= h->flags;
update_tx_stats (h, *msg);
handle_trace_message (h, *msg);
#if HAVE_CALIPER
profiling_msg_snapshot(h, *msg, flags, "send");
#endif
while (h->ops->send_new (h->impl, msg, flags) < 0) {
if (comms_error (h, errno) < 0)
return -1;
Expand Down Expand Up @@ -1017,22 +883,6 @@ flux_msg_t *flux_recv (flux_t *h, struct flux_match match, int flags)
if (defer_requeue (&l, h) < 0)
goto error;
defer_destroy (&l);
#if HAVE_CALIPER
cali_begin_int (h->prof.msg_match_type, match.typemask);
cali_begin_int (h->prof.msg_match_tag, match.matchtag);
cali_begin_string (h->prof.msg_match_glob,
match.topic_glob ? match.topic_glob : "NONE");
const char *sender;
sender = flux_msg_route_first (msg);
if (sender)
cali_begin_string (h->prof.msg_sender, sender);
profiling_msg_snapshot (h, msg, flags, "recv");
if (sender)
cali_end (h->prof.msg_sender);
cali_end (h->prof.msg_match_type);
cali_end (h->prof.msg_match_tag);
cali_end (h->prof.msg_match_glob);
#endif
rpc_track_update (h->tracker, msg);
return msg;
error:
Expand Down
Loading
Loading