WarpX
Loading...
Searching...
No Matches
SignalHandling Class Reference

Signal handling. More...

#include <SignalHandling.H>

Public Types

enum  signal_action_requested_labels { SIGNAL_REQUESTS_BREAK = 0 , SIGNAL_REQUESTS_CHECKPOINT = 1 , SIGNAL_REQUESTS_SIZE = 2 }
 Labels for indexed positions in signal_actions_requests. More...

Public Member Functions

 SignalHandling ()=delete

Static Public Member Functions

static int parseSignalNameToNumber (const std::string &str)
 Take a string and convert it to a corresponding signal number if possible.
static void InitSignalHandling ()
 Set up signal handlers based on input configuration provided in signal_conf_requests_*.
static void CheckSignals ()
 Check and clear signal flags and asynchronously broadcast them from process 0.
static void WaitSignals ()
 Complete the asynchronous broadcast of signal flags.
static bool TestAndResetActionRequestFlag (int action_to_test)
 Check whether a given action has been requested, and reset the associated flag.

Static Public Attributes

static constexpr int NUM_SIGNALS = 32
 The range of signal values to accept.
static bool signal_conf_requests [SIGNAL_REQUESTS_SIZE][NUM_SIGNALS]
 Whether configuration requests the code take a particular action on a particular signal.

Static Private Member Functions

static void SignalSetFlag (int signal_number)
 Signal handler to set flags on process 0 (other processes ignore configured signals).

Static Private Attributes

static bool m_any_signal_action_active = false
 Is any signal handling action configured in signal_conf_requests ?
static std::atomic< bool > signal_received_flags [NUM_SIGNALS]
 On process 0, whether a given signal has been received since the last check.
static MPI_Request signal_mpi_ibcast_request
 MPI requests for the asynchronous broadcasts of the signal-requested actions.
static bool signal_actions_requested [SIGNAL_REQUESTS_SIZE]

Detailed Description

Signal handling.

Rank 0 will accept signals and asynchronously broadcast the configured response; other processes will ignore them and follow the lead of rank 0 to avoid potential for deadlocks or timestep-skewed response.

Variables and functions are static rather than per-instance because signal handlers are configured at the process level.

Member Enumeration Documentation

◆ signal_action_requested_labels

Labels for indexed positions in signal_actions_requests.

Enumerator
SIGNAL_REQUESTS_BREAK 

Cleanly stop execution, as if the simulation reached its configured end.

SIGNAL_REQUESTS_CHECKPOINT 

Produce a checkpoint.

SIGNAL_REQUESTS_SIZE 

Constructor & Destructor Documentation

◆ SignalHandling()

Member Function Documentation

◆ CheckSignals()

Check and clear signal flags and asynchronously broadcast them from process 0.

◆ InitSignalHandling()

Set up signal handlers based on input configuration provided in signal_conf_requests_*.

◆ parseSignalNameToNumber()

Take a string and convert it to a corresponding signal number if possible.

◆ SignalSetFlag()

void ablastr::utils::SignalHandling::SignalSetFlag ( int signal_number)
staticprivate

Signal handler to set flags on process 0 (other processes ignore configured signals).

◆ TestAndResetActionRequestFlag()

Check whether a given action has been requested, and reset the associated flag.

◆ WaitSignals()

Complete the asynchronous broadcast of signal flags.

Member Data Documentation

◆ m_any_signal_action_active

Is any signal handling action configured in signal_conf_requests ?

◆ NUM_SIGNALS

The range of signal values to accept.

◆ signal_actions_requested

Boolean flags transmitted between CheckSignals() and HandleSignals() to indicate actions requested by signals

◆ signal_conf_requests

Whether configuration requests the code take a particular action on a particular signal.

◆ signal_mpi_ibcast_request

MPI requests for the asynchronous broadcasts of the signal-requested actions.

◆ signal_received_flags

std::atomic< bool > ablastr::utils::SignalHandling::signal_received_flags
staticprivate

On process 0, whether a given signal has been received since the last check.


The documentation for this class was generated from the following files: