From 1d6ce20cded62eb6d02ee5ccf5398e5d938b40e3 Mon Sep 17 00:00:00 2001 From: Phil Miller Date: Sat, 2 Apr 2022 23:12:53 -0700 Subject: Allow process signals to trigger checkpoint or break behavior (#2896) * Beginnings of signal handling machinery * Add tentative logic to make checkpoint call * Adapt formatting slightly * Add calls to read signals and set up signal handlers * Initialize signal flag array * Add parsing of signal names, and fix some whitespace issues * Skip signal setup on Windows * added checkpoint and break signal inputs to picmi.py * Address initial review requests * Correct comment to match changed code * Convert maximum signal number to a symbolic name * Always parse signal input, and error out on Windows or wherever it may be unsupported * Typo fix * Add missing reset of checkpoint signal flag * Add reset of break signal, in support of Python or library usage * Test for a configured checkpoint diag when asked to checkpoint on a signal * Fix typo in Linux code path * Clean up MPI support * Use symbolic name for maximum signal number * Fix unused variable in the no-MPI case * Add missing header inclusions * Switch signal parsing to an enumerated table * Test signal handling for Linux, not GNU C library * Avoid another magic number * Update MPI_Ibcast call to match symbolic array length * Update loop over signal flags to use symbolic limit * Match #includes to usage * Add omitted C++ std header include * Guard entire set of signal definitions as *nix-only, not for Windows * Broaden Windows exclusion to avoid zero-length array that displeases MSVC++ * Check return value from sigaction() * Convert conditional calls to Abort() to assertions * Move check for platform support to input parsing * Shift signal handling code over toward ABLASTR to share with ImpactX and Hipace++ * Minor cleanup * A bit more cleanup * Fix formatting nits * Add AMReX error handling on MPI calls * Add ABLASTR signal handling code to GNU makefile too * Document new input parameters * Use ABLASTR assertion macros in ABLASTR code * Convert requests limit value to a requests array size * Generalize signal handling to an arbitrary set of potential actions * Rename class to match usage and file name * Stick stuff in ABLASTR namespace * Indent conditional includes as requested Co-authored-by: Roelof --- Python/pywarpx/picmi.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Python/pywarpx/picmi.py') diff --git a/Python/pywarpx/picmi.py b/Python/pywarpx/picmi.py index e0e843c8c..71e1b7ca5 100644 --- a/Python/pywarpx/picmi.py +++ b/Python/pywarpx/picmi.py @@ -983,6 +983,9 @@ class Simulation(picmistandard.PICMI_Simulation): self.collisions = kw.pop('warpx_collisions', None) self.embedded_boundary = kw.pop('warpx_embedded_boundary', None) + self.break_signals = kw.pop('warpx_break_signals', None) + self.checkpoint_signals = kw.pop('warpx_checkpoint_signals', None) + self.inputs_initialized = False self.warpx_initialized = False @@ -1021,6 +1024,9 @@ class Simulation(picmistandard.PICMI_Simulation): pywarpx.amr.check_input = self.amr_check_input + pywarpx.warpx.break_signals = self.break_signals + pywarpx.warpx.checkpoint_signals = self.checkpoint_signals + particle_shape = self.particle_shape for s in self.species: if s.particle_shape is not None: -- cgit v1.2.3