WarpX
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Static Private Attributes | List of all members
ablastr::utils::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. More...
 
static void InitSignalHandling ()
 Set up signal handlers based on input configuration provided in signal_conf_requests_* More...
 
static void CheckSignals ()
 Check and clear signal flags and asynchronously broadcast them from process 0. More...
 
static void WaitSignals ()
 Complete the asynchronous broadcast of signal flags. More...
 
static bool TestAndResetActionRequestFlag (int action_to_test)
 Check whether a given action has been requested, and reset the associated flag. More...
 

Static Public Attributes

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

Static Private Member Functions

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

Static Private Attributes

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

ablastr::utils::SignalHandling::SignalHandling ( )
delete

Member Function Documentation

◆ CheckSignals()

void ablastr::utils::SignalHandling::CheckSignals ( )
static

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

◆ InitSignalHandling()

void ablastr::utils::SignalHandling::InitSignalHandling ( )
static

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

◆ parseSignalNameToNumber()

int ablastr::utils::SignalHandling::parseSignalNameToNumber ( const std::string &  str)
static

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()

bool ablastr::utils::SignalHandling::TestAndResetActionRequestFlag ( int  action_to_test)
static

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

◆ WaitSignals()

void ablastr::utils::SignalHandling::WaitSignals ( )
static

Complete the asynchronous broadcast of signal flags.

Member Data Documentation

◆ m_any_signal_action_active

bool ablastr::utils::SignalHandling::m_any_signal_action_active = false
staticprivate

Is any signal handling action configured in signal_conf_requests ?

◆ NUM_SIGNALS

constexpr int ablastr::utils::SignalHandling::NUM_SIGNALS = 32
staticconstexpr

The range of signal values to accept.

◆ signal_actions_requested

bool ablastr::utils::SignalHandling::signal_actions_requested
staticprivate

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

◆ signal_conf_requests

bool ablastr::utils::SignalHandling::signal_conf_requests
static

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

◆ signal_mpi_ibcast_request

MPI_Request ablastr::utils::SignalHandling::signal_mpi_ibcast_request
staticprivate

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: