aboutsummaryrefslogtreecommitdiff
path: root/Python/pywarpx/picmi.py
diff options
context:
space:
mode:
authorGravatar Phil Miller <unmobile+gh@gmail.com> 2022-04-02 23:12:53 -0700
committerGravatar GitHub <noreply@github.com> 2022-04-02 23:12:53 -0700
commit1d6ce20cded62eb6d02ee5ccf5398e5d938b40e3 (patch)
tree63ab140a95aa1945f4a971f8bcb06375b14319a4 /Python/pywarpx/picmi.py
parent14292f6d6256bebfd92c5c325fc259d8280d682f (diff)
downloadWarpX-1d6ce20cded62eb6d02ee5ccf5398e5d938b40e3.tar.gz
WarpX-1d6ce20cded62eb6d02ee5ccf5398e5d938b40e3.tar.zst
WarpX-1d6ce20cded62eb6d02ee5ccf5398e5d938b40e3.zip
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 <atomic> 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 <roelof.groenewald@modernelectron.com>
Diffstat (limited to 'Python/pywarpx/picmi.py')
-rw-r--r--Python/pywarpx/picmi.py6
1 files changed, 6 insertions, 0 deletions
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: