From 62ca5edd03630e388d7c4bb0c93e5952d55e5b11 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Mon, 11 Oct 2021 16:30:12 +0200 Subject: BUILD: Remove SuperMUC code. Issue #7033 --- configure.ac | 14 -- po/POTFILES.in | 1 - src/include/gnunet_testbed_service.h | 18 -- src/testbed/gnunet-testbed-profiler.c | 4 - src/testbed/gnunet_testbed_mpi_spawn.c | 327 --------------------------------- src/testbed/testbed_api_hosts.c | 35 ---- src/testbed/testbed_api_testbed.c | 11 -- 7 files changed, 410 deletions(-) delete mode 100644 src/testbed/gnunet_testbed_mpi_spawn.c diff --git a/configure.ac b/configure.ac index fec1069fc..6936e7067 100644 --- a/configure.ac +++ b/configure.ac @@ -1686,20 +1686,6 @@ AC_DEFINE_UNQUOTED([HAVE_GNUTLS_DANE], $gnutls_dane, [We have GnuTLS with DANE s -# Test if we are building for superMUC -AC_MSG_CHECKING(if GNUnet is being configured to run on the SuperMUC) -AC_ARG_ENABLE([supermuc], - [AS_HELP_STRING([--enable-supermuc], - [build GNUnet with support to run on the SuperMUC (default is NO)])], - [AS_IF([test "x$enable_supermuc" = "xno"], - [supermuc=0], - [supermuc=1])], - [supermuc=0 - enable_supermuc=no]) -AC_MSG_RESULT($enable_SUPERMUC) -AM_CONDITIONAL([ENABLE_SUPERMUC], [test "x$supermuc" = "x1"]) -AC_DEFINE_UNQUOTED([ENABLE_SUPERMUC], [$supermuc], [Build with support for SuperMUC]) - # Check if NSE has to send timestamp information to testbed logger for # generating histogram of messages received AC_MSG_CHECKING(if NSE has to send timestamp information to testbed logger) diff --git a/po/POTFILES.in b/po/POTFILES.in index 232416684..e34cb25f4 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -406,7 +406,6 @@ src/testbed/gnunet-service-testbed_oc.c src/testbed/gnunet-service-testbed_peers.c src/testbed/gnunet-testbed-profiler.c src/testbed/gnunet_mpi_test.c -src/testbed/gnunet_testbed_mpi_spawn.c src/testbed/testbed_api.c src/testbed/testbed_api_barriers.c src/testbed/testbed_api_hosts.c diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h index acb444de4..888c6e391 100644 --- a/src/include/gnunet_testbed_service.h +++ b/src/include/gnunet_testbed_service.h @@ -138,24 +138,6 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, struct GNUNET_TESTBED_Host ***hosts); -/** - * Loads the set of host allocated by the LoadLeveler Job Scheduler. This - * function is only available when compiled with support for LoadLeveler and is - * used for running on the SuperMUC - * - * @param cfg the configuration to use as a template while starting a controller - * on any of the loaded hosts. Operation queue sizes specific to a host - * are also read from this configuration handle - * @param hosts set to the hosts found in the file; caller must free this if - * number of hosts returned is greater than 0 - * @return number of hosts returned in 'hosts', 0 on error - */ -unsigned int -GNUNET_TESTBED_hosts_load_from_loadleveler (const struct - GNUNET_CONFIGURATION_Handle *cfg, - struct GNUNET_TESTBED_Host - ***hosts); - /** * Destroy a host handle. Must only be called once everything * running on that host has been stopped. diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c index b07c725a3..49d975119 100644 --- a/src/testbed/gnunet-testbed-profiler.c +++ b/src/testbed/gnunet-testbed-profiler.c @@ -227,11 +227,9 @@ test_run (void *cls, abort_task = NULL; return; } -#if (! ENABLE_SUPERMUC) fprintf (stdout, "Testbed running, waiting for keystroke to shut down\n"); fflush (stdout); (void) getc (stdin); -#endif fprintf (stdout, "Shutting down. Please wait\n"); fflush (stdout); GNUNET_SCHEDULER_shutdown (); @@ -297,14 +295,12 @@ main (int argc, char *const *argv) "keystroke but continues to run until a termination " "signal is received"), &noninteractive), -#if ! ENABLE_SUPERMUC GNUNET_GETOPT_option_string ('H', "hosts", "FILENAME", gettext_noop ( "name of the file with the login information for the testbed"), &hosts_file), -#endif GNUNET_GETOPT_OPTION_END }; const char *binaryHelp = "gnunet-testbed-profiler [OPTIONS]"; diff --git a/src/testbed/gnunet_testbed_mpi_spawn.c b/src/testbed/gnunet_testbed_mpi_spawn.c deleted file mode 100644 index 577ffbeba..000000000 --- a/src/testbed/gnunet_testbed_mpi_spawn.c +++ /dev/null @@ -1,327 +0,0 @@ -#include "platform.h" -#include "gnunet_util_lib.h" -#include "gnunet_testbed_service.h" - - -/** - * Generic logging shorthand - */ -#define LOG(kind, ...) \ - GNUNET_log (kind, __VA_ARGS__) - -/** - * Debug logging shorthand - */ -#define LOG_DEBUG(...) \ - LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__) - -/** - * Global result - */ -static int ret; - -/** - * The child process we spawn - */ -static struct GNUNET_OS_Process *child; - -/** - * The arguments including the binary to spawn - */ -static char **argv2; - -/** - * Pipe used to communicate shutdown via signal. - */ -static struct GNUNET_DISK_PipeHandle *sigpipe; - -/** - * Filename of the unique file - */ -static char *fn; - -/** - * Handle to the unique file - */ -static int fh; - -/** - * The return code of the binary - */ -static unsigned long child_exit_code; - -/** - * The process status of the child - */ -static enum GNUNET_OS_ProcessStatusType child_status; - -/** - * Task to kill the child - */ -static struct GNUNET_SCHEDULER_Task *terminate_task_id; - -/** - * Task to kill the child - */ -static struct GNUNET_SCHEDULER_Task *child_death_task_id; - -/** - * The shutdown task - */ -static void -shutdown_task (void *cls) -{ - if (0 != child_exit_code) - { - LOG (GNUNET_ERROR_TYPE_WARNING, "Child exited with error code: %lu\n", - child_exit_code); - ret = 128 + (int) child_exit_code; - } - if (0 != fh) - { - close (fh); - } - if ((NULL != fn) && (0 != unlink (fn))) - { - GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "open"); - ret = GNUNET_SYSERR; - } -} - - -static void -terminate_task (void *cls) -{ - static int hard_kill; - - GNUNET_assert (NULL != child); - terminate_task_id = - GNUNET_SCHEDULER_add_shutdown (&terminate_task, NULL); - if (0 != hard_kill) - { - switch (hard_kill) - { - case 1: - case 2: - LOG (GNUNET_ERROR_TYPE_WARNING, - "%d more interrupts needed to send SIGKILL to the child\n", - 3 - hard_kill); - hard_kill++; - return; - - case 3: - GNUNET_break (0 == GNUNET_OS_process_kill (child, SIGKILL)); - return; - } - } - hard_kill++; - GNUNET_break (0 == GNUNET_OS_process_kill (child, GNUNET_TERM_SIG)); - LOG (GNUNET_ERROR_TYPE_INFO, _ ("Waiting for child to exit.\n")); -} - - -/** - * Task triggered whenever we receive a SIGCHLD (child - * process died). - * - * @param cls closure, NULL if we need to self-restart - */ -static void -child_death_task (void *cls) -{ - const struct GNUNET_DISK_FileHandle *pr; - char c[16]; - const struct GNUNET_SCHEDULER_TaskContext *tc; - - - pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); - child_death_task_id = NULL; - tc = GNUNET_SCHEDULER_get_task_context (); - if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) - { - child_death_task_id = - GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, - pr, &child_death_task, NULL); - return; - } - /* consume the signal */ - GNUNET_break (0 < GNUNET_DISK_file_read (pr, &c, sizeof(c))); - LOG_DEBUG ("Child died\n"); - GNUNET_SCHEDULER_cancel (terminate_task_id); - terminate_task_id = NULL; - GNUNET_assert (GNUNET_OK == GNUNET_OS_process_status (child, &child_status, - &child_exit_code)); - GNUNET_OS_process_destroy (child); - child = NULL; - GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); -} - - -static void -destroy_hosts (struct GNUNET_TESTBED_Host **hosts, unsigned int nhosts) -{ - unsigned int host; - - GNUNET_assert (NULL != hosts); - for (host = 0; host < nhosts; host++) - if (NULL != hosts[host]) - GNUNET_TESTBED_host_destroy (hosts[host]); - GNUNET_free (hosts); - hosts = NULL; -} - - -/** - * The main scheduler run task - * - * @param cls NULL - */ -static void -run (void *cls) -{ - struct GNUNET_TESTBED_Host **hosts; - const struct GNUNET_CONFIGURATION_Handle *null_cfg; - char *tmpdir; - char *hostname; - size_t hostname_len; - unsigned int nhosts; - - null_cfg = GNUNET_CONFIGURATION_create (); - nhosts = GNUNET_TESTBED_hosts_load_from_loadleveler (null_cfg, &hosts); - if (0 == nhosts) - { - GNUNET_break (0); - ret = GNUNET_SYSERR; - return; - } - hostname_len = GNUNET_OS_get_hostname_max_length (); - hostname = GNUNET_malloc (hostname_len); - if (0 != gethostname (hostname, hostname_len)) - { - LOG (GNUNET_ERROR_TYPE_ERROR, "Cannot get hostname. Exiting\n"); - GNUNET_free (hostname); - destroy_hosts (hosts, nhosts); - ret = GNUNET_SYSERR; - return; - } - if (NULL == strstr (GNUNET_TESTBED_host_get_hostname (hosts[0]), hostname)) - { - LOG_DEBUG ("Exiting as `%s' is not the lowest host\n", hostname); - GNUNET_free (hostname); - ret = GNUNET_OK; - return; - } - LOG_DEBUG ("Will be executing `%s' on host `%s'\n", argv2[0], hostname); - GNUNET_free (hostname); - destroy_hosts (hosts, nhosts); - tmpdir = getenv ("TMPDIR"); - if (NULL == tmpdir) - tmpdir = getenv ("TMP"); - if (NULL == tmpdir) - tmpdir = getenv ("TEMP"); - if (NULL == tmpdir) - tmpdir = "/tmp"; - (void) GNUNET_asprintf (&fn, "%s/gnunet-testbed-spawn.lock", tmpdir); - /* Open the unique file; we can create it then we can spawn the child process - else we exit */ - fh = open (fn, O_CREAT | O_EXCL | O_CLOEXEC, - S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); - if (-1 == fh) - { - if (EEXIST == errno) - { - LOG_DEBUG ("Lock file already created by other process. Exiting\n"); - ret = GNUNET_OK; - return; - } - GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "open"); - ret = GNUNET_SYSERR; - return; - } - /* Spawn the new process here */ - LOG (GNUNET_ERROR_TYPE_INFO, _ ("Spawning process `%s'\n"), argv2[0]); - child = GNUNET_OS_start_process_vap (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, - NULL, - NULL, NULL, - argv2[0], argv2); - if (NULL == child) - { - GNUNET_break (0); - ret = GNUNET_SYSERR; - GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); - return; - } - ret = GNUNET_OK; - terminate_task_id = - GNUNET_SCHEDULER_add_shutdown (&terminate_task, NULL); - child_death_task_id = - GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, - GNUNET_DISK_pipe_handle (sigpipe, - GNUNET_DISK_PIPE_END_READ), - &child_death_task, NULL); -} - - -/** - * Signal handler called for SIGCHLD. - */ -static void -sighandler_child_death () -{ - static char c; - int old_errno = errno; /* back-up errno */ - - GNUNET_break (1 == - GNUNET_DISK_file_write (GNUNET_DISK_pipe_handle - (sigpipe, GNUNET_DISK_PIPE_END_WRITE), - &c, sizeof(c))); - errno = old_errno; /* restore errno */ -} - - -/** - * Execution start point - */ -int -main (int argc, char *argv[]) -{ - struct GNUNET_SIGNAL_Context *shc_chld; - unsigned int cnt; - - ret = -1; - if (argc < 2) - { - printf ("Need arguments: gnunet-testbed-mpi-spawn "); - return 1; - } - if (GNUNET_OK != GNUNET_log_setup ("gnunet-testbed-spawn", NULL, NULL)) - { - GNUNET_break (0); - return 1; - } - if (NULL == (sigpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE))) - { - GNUNET_break (0); - ret = GNUNET_SYSERR; - return 1; - } - shc_chld = - GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death); - if (NULL == shc_chld) - { - LOG (GNUNET_ERROR_TYPE_ERROR, "Cannot install a signal handler\n"); - return 1; - } - argv2 = GNUNET_malloc (sizeof(char *) * argc); - for (cnt = 1; cnt < argc; cnt++) - argv2[cnt - 1] = argv[cnt]; - GNUNET_SCHEDULER_run (run, NULL); - GNUNET_free (argv2); - GNUNET_SIGNAL_handler_uninstall (shc_chld); - shc_chld = NULL; - GNUNET_DISK_pipe_close (sigpipe); - GNUNET_free (fn); - if (GNUNET_OK != ret) - return ret; - return 0; -} diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c index 1a8d9976d..8dd0a4893 100644 --- a/src/testbed/testbed_api_hosts.c +++ b/src/testbed/testbed_api_hosts.c @@ -567,41 +567,6 @@ simple_resolve (const char *host) } -/** - * Loads the set of host allocated by the LoadLeveler Job Scheduler. This - * function is only available when compiled with support for LoadLeveler and is - * used for running on the SuperMUC - * - * @param cfg the configuration to use as a template while starting a controller - * on any of the loaded hosts. Operation queue sizes specific to a host - * are also read from this configuration handle - * @param hosts set to the hosts found in the file; caller must free this if - * number of hosts returned is greater than 0 - * @return number of hosts returned in 'hosts', 0 on error - */ -unsigned int -GNUNET_TESTBED_hosts_load_from_loadleveler ( - const struct GNUNET_CONFIGURATION_Handle *cfg, - struct GNUNET_TESTBED_Host ***hosts) -{ -#if ! ENABLE_SUPERMUC - LOG (GNUNET_ERROR_TYPE_ERROR, - _ ("The function %s is only available when compiled with (--with-ll)\n"), - __func__); - GNUNET_assert (0); -#else - const char *hostfile; - - if (NULL == (hostfile = getenv ("MP_SAVEHOSTFILE"))) - { - GNUNET_break (0); - return 0; - } - return GNUNET_TESTBED_hosts_load_from_file (hostfile, cfg, hosts); -#endif -} - - /** * Destroy a host handle. Must only be called once everything * running on that host has been stopped. diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c index e9b9979ce..e0b76ad78 100644 --- a/src/testbed/testbed_api_testbed.c +++ b/src/testbed/testbed_api_testbed.c @@ -1265,16 +1265,6 @@ GNUNET_TESTBED_run (const char *host_filename, GNUNET_assert (num_peers > 0); rc = GNUNET_new (struct GNUNET_TESTBED_RunHandle); rc->cfg = GNUNET_CONFIGURATION_dup (cfg); -#if ENABLE_SUPERMUC - rc->num_hosts = GNUNET_TESTBED_hosts_load_from_loadleveler (rc->cfg, - &rc->hosts); - if (0 == rc->num_hosts) - { - LOG (GNUNET_ERROR_TYPE_WARNING, - _ ("No hosts loaded from LoadLeveler. Need at least one host\n")); - goto error_cleanup; - } -#else if (NULL != host_filename) { rc->num_hosts = @@ -1289,7 +1279,6 @@ GNUNET_TESTBED_run (const char *host_filename, } else rc->h = GNUNET_TESTBED_host_create (NULL, NULL, rc->cfg, 0); -#endif rc->num_peers = num_peers; rc->event_mask = event_mask; rc->cc = cc; -- cgit v1.2.3