gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-252-gf9a3f78
a Global And Modular Bsm Inference Tool

Variables for use in signal handlers. More...

#include <signal_handling.hpp>

Public Types

typedef void(* void_func) ()
 Set cleanup function to run during emergency shutdown. More...
 

Public Attributes

jmp_buf env
 Saved information on calling environment for longjmp. More...
 
bool jumppoint_set
 
int havejumped
 
void_func cleanup
 
bool cleanup_function_set
 

Private Attributes

int rank
 
volatile sig_atomic_t shutdownBegun
 Flag to warn if early shutdown is already in process. More...
 
volatile sig_atomic_t emergency
 Flag to warn if the shutdown that is in progress is an emergency shutdown (use to decided whether to attempt MPI synchronisation) More...
 
bool POSIX_signal_noticed
 Flag to indicate if POSIX shutdown signal has been noticed. More...
 
bool shutdown_due_to_MPI_message
 
int shutdown_attempts
 Number of times synchronisation for soft shutdown has been attempted;. More...
 
int attempts_since_ff
 
int ff_loop_count
 
bool ff_on
 
int ff_count
 
bool inside_omp_block
 Flag to switch signal handling behavior to multithreaded mode (i.e. More...
 
int received_signals [MAX_SIGNALS]
 
int N_signals
 

Static Private Attributes

static const int MAX_SIGNALS = 10
 Array to record received signals (up to max_signals) More...
 
 SignalData ()
 SignalData member functions. More...
 
std::string myrank ()
 Retrieve MPI rank as a string (for log messages etc.) More...
 
void setjump ()
 Set jump point;. More...
 
void set_cleanup (void_func f)
 Set cleanup function. More...
 
void call_cleanup ()
 Call cleanup function. More...
 
void set_shutdown_begun (const sig_atomic_t emergnc=0)
 Register that shutdown has begun. More...
 
bool shutdown_begun ()
 Check if (any kind of) shutdown is in progress. More...
 
EXPORT_SYMBOLS bool check_if_shutdown_begun ()
 Check for signals that early shutdown is required If an MPI message telling us to perform an emergency shutdown is received (which should only happen in the case of an error on some other process) then a shutdown exception is raised. More...
 
void add_signal (int sig)
 Check if emergency shutdown is in progress. More...
 
std::string display_received_signals ()
 Print to string a list of the signals received so far by this process. More...
 
void entering_multithreaded_region ()
 Check if shutdown is in progress and raise appropriate termination exception if so. More...
 
void leaving_multithreaded_region ()
 Exit threadsafe signal handling mode. More...
 
bool inside_multithreaded_region ()
 Report 'true' if inside a multithreaded region (according to our own flag) More...
 
void update_looptime (double newtime)
 Extra functions needed in MPI mode. More...
 
void attempt_soft_shutdown ()
 Perform soft shutdown if processes can be synchronised. More...
 
bool all_processes_ready ()
 Attempt to synchronise all processes, but abort if it takes too long. More...
 

Detailed Description

Variables for use in signal handlers.

Definition at line 74 of file signal_handling.hpp.

Member Typedef Documentation

◆ void_func

typedef void(* Gambit::SignalData::void_func) ()

Set cleanup function to run during emergency shutdown.

Definition at line 91 of file signal_handling.hpp.

Constructor & Destructor Documentation

◆ SignalData()

Gambit::SignalData::SignalData ( )

SignalData member functions.

Constructor (initialise member variables)

Definition at line 142 of file signal_handling.cpp.

143  : jumppoint_set(false)
144  , havejumped(1) // set to zero after jump point set
145  , cleanup_function_set(false)
146  , rank(-1)
147  , shutdownBegun(0)
148  , emergency(0)
149  , POSIX_signal_noticed(false)
151  , shutdown_attempts(0)
152  , attempts_since_ff(0)
153  , ff_loop_count(0)
154  , ff_on(false)
155  , ff_count(0)
156  , inside_omp_block(false)
157  , N_signals(0)
158  #ifdef WITH_MPI
159  , MPIsize(1)
160  , _comm_rdy(false)
161  , shutdown_broadcast_done(false)
162  , looptimes(1000)
163  , timeout(500)
164  , msgs()
165  #endif
166  {
167  #ifdef WITH_MPI
168  msgs[SOFT_SHUTDOWN] = ShutdownMsg(SOFT_SHUTDOWN,shutdown_name(SOFT_SHUTDOWN));
169  msgs[EMERGENCY_SHUTDOWN] = ShutdownMsg(EMERGENCY_SHUTDOWN,shutdown_name(EMERGENCY_SHUTDOWN));
170  msgs[NO_MORE_MESSAGES] = ShutdownMsg(NO_MORE_MESSAGES,shutdown_name(NO_MORE_MESSAGES));
171  #endif
172  }
volatile sig_atomic_t shutdownBegun
Flag to warn if early shutdown is already in process.
bool POSIX_signal_noticed
Flag to indicate if POSIX shutdown signal has been noticed.
bool inside_omp_block
Flag to switch signal handling behavior to multithreaded mode (i.e.
volatile sig_atomic_t emergency
Flag to warn if the shutdown that is in progress is an emergency shutdown (use to decided whether to ...
int shutdown_attempts
Number of times synchronisation for soft shutdown has been attempted;.

Member Function Documentation

◆ add_signal()

void Gambit::SignalData::add_signal ( int  sig)

Check if emergency shutdown is in progress.

Add signal to record.

Add signal to record

Definition at line 209 of file signal_handling.cpp.

References MAX_SIGNALS, N_signals, and received_signals.

Referenced by Gambit::sighandler_soft().

210  {
211  //std::cerr << " Adding signal " << sig << std::endl; // debugging
212  if(N_signals<MAX_SIGNALS) {
214  N_signals+=1;
215  }
216  else
217  {
218  // no more space to record signals.
219  N_signals+=1;
220  }
221  }
int received_signals[MAX_SIGNALS]
static const int MAX_SIGNALS
Array to record received signals (up to max_signals)
Here is the caller graph for this function:

◆ all_processes_ready()

bool Gambit::SignalData::all_processes_ready ( )
private

Attempt to synchronise all processes, but abort if it takes too long.

Definition at line 265 of file signal_handling.cpp.

References Gambit::EOM, and Gambit::logger().

Referenced by attempt_soft_shutdown().

266  {
267  #ifdef WITH_MPI
268  logger() << "Waiting up to "<<timeout/1000<<" seconds for all processes to sync..." << EOM;
269  // sleep setup
270  bool timedout = false;
271  std::chrono::milliseconds bar_timeout(std::lround(timeout));
272  if( signalComm->BarrierWithTimeout(bar_timeout, 9999) )
273  {
274  timedout = true; // Barrier timed out waiting for some process to enter
275  }
276  // else the barrier succeed in synchronising all processes
277  logger() << "Synchronised? " << !timedout << EOM;
278  return !timedout;
279  #else
280  return true; // Always ready if no MPI
281  #endif
282  }
const Logging::endofmessage EOM
Explicit const instance of the end of message struct in Gambit namespace.
Definition: logger.hpp:99
Logging::LogMaster & logger()
Function to retrieve a reference to the Gambit global log object.
Definition: logger.cpp:95
Here is the call graph for this function:
Here is the caller graph for this function:

◆ attempt_soft_shutdown()

void Gambit::SignalData::attempt_soft_shutdown ( )

Perform soft shutdown if processes can be synchronised.

Start counting...

First time we see the shutdown signal, we will allow control to return to the scanner at least once, so that it can get its own affairs in order.

Definition at line 284 of file signal_handling.cpp.

References all_processes_ready(), attempts_since_ff, call_cleanup(), Gambit::EOM, ff_count, ff_loop_count, ff_on, Gambit::logger(), myrank(), and shutdown_attempts.

Referenced by Gambit::Scanner::Scanner_Plugin_Function< ret(args...)>::main(), Gambit::Likelihood_Container::main(), and Gambit::Scanner::Multi_Scanner_Plugin_Function< ret(args...)>::main().

285  {
286  const int max_attempts=-1; // Number of extra likelihood evaluations allowed for sync attempts before we declare failure. -1 means "unlimited"
287  const int attempts_before_ff=10; // Number of times to attempt synchronisation before entering a "fast forward" period
288  const int ff_loops=1000; // Number of "fast-forward" loops to perform in a fast-forward period
289 
291  static std::chrono::time_point<std::chrono::system_clock> start(std::chrono::system_clock::now());
292 
293  if(shutdown_attempts==0)
294  {
297  logger() << "Beginning GAMBIT soft shutdown procedure. Control will be returned to the scanner plugin so "
298  << "that it can get its affairs in order in preparation for shutdown (it may cease iterating if "
299  << "it has that capability), and next iteration we will attempt to synchronise all processes and "
300  << "shut them down. If sync fails, we will loop up to "<<max_attempts<<" times (-1 means infinite), attempting to "
301  << "synchronise each time. If sync fails, an emergency shutdown will be attempted." << EOM;
303  }
304  else if(ff_on)
305  {
306  logger() << "Fast-forward active (loop "<<ff_loop_count<<"); no synchronisation attempted." << EOM;
307  // Fast-forward active; just increment counters and return
308  ++ff_loop_count;
309  if(ff_loop_count>=ff_loops)
310  {
311  logger() << "Fast-forward period finished (performed "<<ff_loop_count<<" fast loops)." << EOM;
312  ff_on = false;
313  ff_loop_count=0;
314  }
315  }
316  else if(attempts_since_ff>=attempts_before_ff)
317  {
318  // Enter "fast-forward" period
319  ff_on = true;
320  ++ff_count;
321  std::ostringstream msg;
322  msg << "rank "<<myrank()<<": Tried to synchronise for shutdown (attempt "<<shutdown_attempts<<") but failed. Will now fast-forward through "<<ff_loops<<" iterations in an attempt to 'unlock' possible MPI deadlocks with the scanner.";
323  std::cerr << msg.str() << std::endl;
324  logger() << msg.str() << EOM;
325  // Reset counters
327  }
328  else
329  {
330  // Normal sync attempt (no fast forward)
331  if(shutdown_attempts==1)
332  {
333  logger() << "Scanner did not shut down when given the chance; we will therefore assume responsibility for terminating the scan." << EOM;
334  }
335  logger() << "Attempting to synchronise for soft shutdown (attempt "<<shutdown_attempts<<")" << EOM;
336  if (all_processes_ready())
337  {
338  logger() << "Calling cleanup routines" << EOM;
339  call_cleanup();
340  std::ostringstream msg;
341  logger() << "Throwing soft shutdown exception" << EOM;
342  throw SoftShutdownException(msg.str());
343  }
344 
345  // Compute elapsed time since shutdown began
346  std::chrono::time_point<std::chrono::system_clock> current = std::chrono::system_clock::now();
347  std::chrono::duration<double> time_waited = current - start;
348 
349  if(max_attempts!=-1 and shutdown_attempts>=max_attempts)
350  {
351  logger() << "Failed to synchronise for soft shutdown! Attempting cleanup anyway, but cannot guarantee safety of the scan output." << EOM;
352  call_cleanup();
353  std::ostringstream msg;
354  #ifdef WITH_MPI
355  msg << "rank "<<myrank()<<": ";
356  #endif
357  msg << "Soft shutdown failed, emergency shutdown performed instead! (could not synchronise all processes after "<<shutdown_attempts
358  <<" attempts, and after waiting "<<std::chrono::duration_cast<std::chrono::seconds>(time_waited).count()
359  <<" seconds; fast-forward periods of "<<ff_loops<<" iterations were performed "<<ff_count
360  <<" times). Data handled by external scanner codes may have been left in an inconsistent state." << std::endl;
361  throw HardShutdownException(msg.str());
362  }
363  else
364  {
365  logger() << "Attempt to sync for soft shutdown failed (this was attempt "<<shutdown_attempts<<" of "<<max_attempts<<" (-1 means infinite)); "
366  <<std::chrono::duration_cast<std::chrono::seconds>(time_waited).count() <<" seconds have elapsed since "
367  <<"shutdown attempts began). Will allow evaluation to continue and attempt to sync again next iteration." << EOM;
368  }
371  }
372  }
void call_cleanup()
Call cleanup function.
bool all_processes_ready()
Attempt to synchronise all processes, but abort if it takes too long.
const Logging::endofmessage EOM
Explicit const instance of the end of message struct in Gambit namespace.
Definition: logger.hpp:99
Logging::LogMaster & logger()
Function to retrieve a reference to the Gambit global log object.
Definition: logger.cpp:95
std::string myrank()
Retrieve MPI rank as a string (for log messages etc.)
int shutdown_attempts
Number of times synchronisation for soft shutdown has been attempted;.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ call_cleanup()

void Gambit::SignalData::call_cleanup ( )

Call cleanup function.

Definition at line 202 of file signal_handling.cpp.

References cleanup, and cleanup_function_set.

Referenced by attempt_soft_shutdown().

203  {
205  // Do nothing if no function has been set;
206  }
Here is the caller graph for this function:

◆ check_if_shutdown_begun()

bool Gambit::SignalData::check_if_shutdown_begun ( )

Check for signals that early shutdown is required If an MPI message telling us to perform an emergency shutdown is received (which should only happen in the case of an error on some other process) then a shutdown exception is raised.

Otherwise, we just return a bool indicating the shutdown status

Definition at line 379 of file signal_handling.cpp.

References Gambit::LogTags::core, display_received_signals(), emergency, Gambit::EOM, Gambit::LogTags::info, Gambit::logger(), POSIX_signal_noticed, rank, set_shutdown_begun(), shutdown_begun(), and shutdown_due_to_MPI_message.

Referenced by Gambit::Printers::check_for_error_messages().

380  {
381  if(not shutdown_begun())
382  {
383  // If shutdown is not known to be in progress, check for MPI messages telling us to initiate shutdown
384  #ifdef WITH_MPI
385  #ifdef SIGNAL_DEBUG
387  logger() << LogTags::core << LogTags::info << "Doing Iprobe to check for shutdown messages from other processes (with MPI tag "<<signalComm->mytag<<")" << EOM;
388  #endif
389  if(signalComm->Iprobe(MPI_ANY_SOURCE, signalComm->mytag))
390  {
391  #ifdef SIGNAL_DEBUG
392  logger() << LogTags::core << LogTags::info << "Shutdown message detected; doing Recv" << EOM;
393  #endif
394  int code;
395  MPI_Status msg_status;
396  signalComm->Recv(&code, 1, MPI_ANY_SOURCE, signalComm->mytag, &msg_status);
397 
398  // Check what code was received and use it to determined what kind of shutdown to do
399  if(code==SOFT_SHUTDOWN)
400  {
402  logger() << LogTags::core << LogTags::info << "Received SOFT shutdown message from process with rank " << msg_status.MPI_SOURCE << EOM;
403  }
404  else if(code==EMERGENCY_SHUTDOWN)
405  {
406  set_shutdown_begun(1); // '1' argument means emergency set also.
407  logger() << LogTags::core << LogTags::info << "Received EMERGENCY shutdown message from process with rank " << msg_status.MPI_SOURCE << EOM;
408  }
409  else
410  {
411  std::ostringstream ss;
412  ss << "Received UNRECOGNISED shutdown message from process with rank " << msg_status.MPI_SOURCE<<". Performing emergency shutdown, but please note that this indicates a ***BUG*** somewhere in the signal handling code!!!";
413  std::cout << ss.str() << std::endl;
414  logger() << LogTags::core << LogTags::info << ss.str() << EOM;
415  set_shutdown_begun(1); // '1' argument means emergency set also.
416  }
417 
419  }
420  #ifdef SIGNAL_DEBUG
421  else
422  {
423  logger() << LogTags::core << LogTags::info << "No shutdown message detected; continuing as normal" << EOM;
424  }
425  #endif
426  #endif
427  }
428 
429  // Check shutdown status again (might have changed due to MPI message receipt)
430  if(shutdown_begun())
431  {
433  {
434  std::ostringstream ss;
435  ss << "Process "<<rank<<": Shutdown signal detected!"<< std::endl;
436  // std::cerr << ss.str();
437  logger() << ss.str() << display_received_signals() << EOM;
438  POSIX_signal_noticed = true;
439  }
440 
441  std::ostringstream ss;
442  static int loopi(0);
443  logger() << "Shutdown is in progress; emergency="<< emergency <<" (loop="<<loopi<<")"<< EOM;
444  ++loopi;
445  logger() << ss.str() << EOM;
446 
447  #ifdef WITH_MPI
448  if(not shutdown_due_to_MPI_message) // Don't broadcast another shutdown message if we are shutting down due to an MPI message we received. Assume that all processes will get the first message (otherwise for 1000 process job we will end up with 1000*1000 shutdown messages clogging up the network)
449  {
450  // Broadcast shutdown message to all processes
451  int shutdown_code;
452  if(emergency)
453  {
454  shutdown_code = EMERGENCY_SHUTDOWN;
455  }
456  else
457  {
458  shutdown_code = SOFT_SHUTDOWN;
459  }
460  broadcast_shutdown_signal(shutdown_code);
461  }
462  else if(emergency)
463  {
464  throw MPIShutdownException("Received emergency shutdown command via MPI! Terminating run.");
465  }
466  #endif
467 
468  }
469  return shutdown_begun();
470  }
std::string display_received_signals()
Print to string a list of the signals received so far by this process.
void set_shutdown_begun(const sig_atomic_t emergnc=0)
Register that shutdown has begun.
const Logging::endofmessage EOM
Explicit const instance of the end of message struct in Gambit namespace.
Definition: logger.hpp:99
Logging::LogMaster & logger()
Function to retrieve a reference to the Gambit global log object.
Definition: logger.cpp:95
bool POSIX_signal_noticed
Flag to indicate if POSIX shutdown signal has been noticed.
bool shutdown_begun()
Check if (any kind of) shutdown is in progress.
volatile sig_atomic_t emergency
Flag to warn if the shutdown that is in progress is an emergency shutdown (use to decided whether to ...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ display_received_signals()

std::string Gambit::SignalData::display_received_signals ( )

Print to string a list of the signals received so far by this process.

Definition at line 224 of file signal_handling.cpp.

References MAX_SIGNALS, N_signals, received_signals, and Gambit::signal_name().

Referenced by check_if_shutdown_begun(), and main().

225  {
226  std::ostringstream myout;
227  if(N_signals > 0 )
228  {
229  myout << "Caught the following signals (in order):" << std::endl;
230  for(int i=0; i<N_signals; i++)
231  {
232  if(i<MAX_SIGNALS)
233  {
234  myout <<"#"<<i+1<<": Signal "<<received_signals[i]<<" ("<<signal_name(received_signals[i])<<")"<<std::endl;
235  }
236  }
237  if( (N_signals - MAX_SIGNALS) > 0)
238  {
239  myout << "Another " << (N_signals - MAX_SIGNALS) <<" signals were caught but their values were not recorded (buffer exceeded)"<<std::endl;
240  }
241  }
242  return myout.str();
243  }
std::string signal_name(int sig)
Translate signal codes to strings.
int received_signals[MAX_SIGNALS]
static const int MAX_SIGNALS
Array to record received signals (up to max_signals)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ entering_multithreaded_region()

void Gambit::SignalData::entering_multithreaded_region ( )

Check if shutdown is in progress and raise appropriate termination exception if so.

Absorb any extra shutdown messages that may be unreceived (since every process broadcasts to every other process that it should shut down, so with lots of processess there will be lots of unreceived messages floating around)

(to be called by Gambit once it is safe to trigger termination) Only check for emergency shutdown signals (i.e. do not attempt synchronisation) Switch to threadsafe signal handling mode

TODO: Thread checking routines are no longer needed due to simplified shutdown method. Can be deleted when functors are updated to no longer call these routines. Switch to threadsafe signal handling mode

Definition at line 550 of file signal_handling.cpp.

References inside_omp_block.

Referenced by Gambit::FunctorHelp::entering_multithreaded_region().

551  {
552  inside_omp_block = 1;
553  // Debugging
554  //std::cerr << "rank " << rank <<": ENTERING_MULTITHREADED_REGION" << std::endl;
555  //std::cerr << "rank " << rank <<": signaldata().inside_omp_block=1 " << std::endl;
556  }
bool inside_omp_block
Flag to switch signal handling behavior to multithreaded mode (i.e.
Here is the caller graph for this function:

◆ inside_multithreaded_region()

bool Gambit::SignalData::inside_multithreaded_region ( )

Report 'true' if inside a multithreaded region (according to our own flag)

Definition at line 568 of file signal_handling.cpp.

References Gambit::LogTags::core, Gambit::EOM, Gambit::LogTags::info, inside_omp_block, LOCAL_INFO, Gambit::logger(), rank, and Gambit::utils_error().

569  {
570  return inside_omp_block;
571  }
bool inside_omp_block
Flag to switch signal handling behavior to multithreaded mode (i.e.
Here is the call graph for this function:

◆ leaving_multithreaded_region()

void Gambit::SignalData::leaving_multithreaded_region ( )

Exit threadsafe signal handling mode.

Definition at line 559 of file signal_handling.cpp.

References inside_omp_block.

Referenced by Gambit::FunctorHelp::leaving_multithreaded_region().

560  {
561  inside_omp_block = 0;
562  // Debugging
563  //std::cerr << "rank " << rank <<": LEAVING_MULTITHREADED_REGION" << std::endl;
564  //std::cerr << "rank " << rank <<": signaldata().inside_omp_block=0 " << std::endl;
565  }
bool inside_omp_block
Flag to switch signal handling behavior to multithreaded mode (i.e.
Here is the caller graph for this function:

◆ myrank()

std::string Gambit::SignalData::myrank ( )

Retrieve MPI rank as a string (for log messages etc.)

Definition at line 175 of file signal_handling.cpp.

References rank.

Referenced by attempt_soft_shutdown(), Gambit::FunctorHelp::entering_multithreaded_region(), and Gambit::FunctorHelp::leaving_multithreaded_region().

176  {
177  std::ostringstream tmp;
178  #ifdef WITH_MPI
179  if(rank==-1) { tmp << "UNKNOWN"; }
180  else { tmp << rank; }
181  #else
182  tmp << "(MPI DISABLED)";
183  #endif
184  return tmp.str();
185  }
Here is the caller graph for this function:

◆ set_cleanup()

void Gambit::SignalData::set_cleanup ( void_func  f)

Set cleanup function.

Definition at line 195 of file signal_handling.cpp.

References cleanup, cleanup_function_set, and combine_hdf5::f.

Referenced by main().

196  {
197  cleanup = f;
198  cleanup_function_set = true;
199  }
Here is the caller graph for this function:

◆ set_shutdown_begun()

void Gambit::SignalData::set_shutdown_begun ( const sig_atomic_t  emergnc = 0)

Register that shutdown has begun.

Definition at line 246 of file signal_handling.cpp.

References emergency, and shutdownBegun.

Referenced by check_if_shutdown_begun(), main(), and Gambit::sighandler_soft().

247  {
248  shutdownBegun = 1;
249  emergency = emergnc;
250  // // if(ignore_signals_during_shutdown)
251  // {
252  // /// Redirect all future signals (except of course kill etc.) to the null handlers
253  // signal(SIGTERM, sighandler_null);
254  // signal(SIGINT, sighandler_null);
255  // signal(SIGUSR1, sighandler_null);
256  // signal(SIGUSR2, sighandler_null);
257  // }
258  }
volatile sig_atomic_t shutdownBegun
Flag to warn if early shutdown is already in process.
volatile sig_atomic_t emergency
Flag to warn if the shutdown that is in progress is an emergency shutdown (use to decided whether to ...
Here is the caller graph for this function:

◆ setjump()

void Gambit::SignalData::setjump ( )

Set jump point;.

Definition at line 188 of file signal_handling.cpp.

References env, havejumped, and jumppoint_set.

189  {
190  havejumped = setjmp(env);
191  jumppoint_set = true;
192  }
jmp_buf env
Saved information on calling environment for longjmp.

◆ shutdown_begun()

bool Gambit::SignalData::shutdown_begun ( )

Check if (any kind of) shutdown is in progress.

Check if shutdown is in progress.

Definition at line 261 of file signal_handling.cpp.

References shutdownBegun.

Referenced by check_if_shutdown_begun().

261 { return shutdownBegun; }
volatile sig_atomic_t shutdownBegun
Flag to warn if early shutdown is already in process.
Here is the caller graph for this function:

◆ update_looptime()

void Gambit::SignalData::update_looptime ( double  newtime)

Extra functions needed in MPI mode.

Add a new loop time to internal array used to decide barrier timeout.

Add a new loop time to internal array used to decide barrier timeout

Definition at line 474 of file signal_handling.cpp.

References Gambit::LogTags::core, Gambit::LogTags::debug, Gambit::EOM, Gambit::LogTags::info, LOCAL_INFO, Gambit::logger(), cyclic_include_check::loop, rank, and Gambit::utils_error().

475  {
476  // Leave this as 1 second now that likelihood calculation is disabled during shutdown
477  }
Here is the call graph for this function:

Member Data Documentation

◆ attempts_since_ff

int Gambit::SignalData::attempts_since_ff
private

Definition at line 192 of file signal_handling.hpp.

Referenced by attempt_soft_shutdown().

◆ cleanup

void_func Gambit::SignalData::cleanup

Definition at line 92 of file signal_handling.hpp.

Referenced by call_cleanup(), and set_cleanup().

◆ cleanup_function_set

bool Gambit::SignalData::cleanup_function_set

Definition at line 93 of file signal_handling.hpp.

Referenced by call_cleanup(), and set_cleanup().

◆ emergency

volatile sig_atomic_t Gambit::SignalData::emergency
private

Flag to warn if the shutdown that is in progress is an emergency shutdown (use to decided whether to attempt MPI synchronisation)

Definition at line 183 of file signal_handling.hpp.

Referenced by check_if_shutdown_begun(), and set_shutdown_begun().

◆ env

jmp_buf Gambit::SignalData::env

Saved information on calling environment for longjmp.

Definition at line 82 of file signal_handling.hpp.

Referenced by setjump().

◆ ff_count

int Gambit::SignalData::ff_count
private

Definition at line 195 of file signal_handling.hpp.

Referenced by attempt_soft_shutdown().

◆ ff_loop_count

int Gambit::SignalData::ff_loop_count
private

Definition at line 193 of file signal_handling.hpp.

Referenced by attempt_soft_shutdown().

◆ ff_on

bool Gambit::SignalData::ff_on
private

Definition at line 194 of file signal_handling.hpp.

Referenced by attempt_soft_shutdown().

◆ havejumped

int Gambit::SignalData::havejumped

Definition at line 84 of file signal_handling.hpp.

Referenced by setjump().

◆ inside_omp_block

bool Gambit::SignalData::inside_omp_block
private

Flag to switch signal handling behavior to multithreaded mode (i.e.

triggers switch to threadsafe emergency shutdown behaviour)

Definition at line 199 of file signal_handling.hpp.

Referenced by entering_multithreaded_region(), inside_multithreaded_region(), and leaving_multithreaded_region().

◆ jumppoint_set

bool Gambit::SignalData::jumppoint_set

Definition at line 83 of file signal_handling.hpp.

Referenced by setjump().

◆ MAX_SIGNALS

const int Gambit::SignalData::MAX_SIGNALS = 10
staticprivate

Array to record received signals (up to max_signals)

Definition at line 202 of file signal_handling.hpp.

Referenced by add_signal(), and display_received_signals().

◆ N_signals

int Gambit::SignalData::N_signals
private

Definition at line 204 of file signal_handling.hpp.

Referenced by add_signal(), and display_received_signals().

◆ POSIX_signal_noticed

bool Gambit::SignalData::POSIX_signal_noticed
private

Flag to indicate if POSIX shutdown signal has been noticed.

Definition at line 185 of file signal_handling.hpp.

Referenced by check_if_shutdown_begun().

◆ rank

int Gambit::SignalData::rank
private

◆ received_signals

int Gambit::SignalData::received_signals[MAX_SIGNALS]
private

Definition at line 203 of file signal_handling.hpp.

Referenced by add_signal(), and display_received_signals().

◆ shutdown_attempts

int Gambit::SignalData::shutdown_attempts
private

Number of times synchronisation for soft shutdown has been attempted;.

Definition at line 191 of file signal_handling.hpp.

Referenced by attempt_soft_shutdown().

◆ shutdown_due_to_MPI_message

bool Gambit::SignalData::shutdown_due_to_MPI_message
private

Definition at line 188 of file signal_handling.hpp.

Referenced by check_if_shutdown_begun().

◆ shutdownBegun

volatile sig_atomic_t Gambit::SignalData::shutdownBegun
private

Flag to warn if early shutdown is already in process.

Definition at line 180 of file signal_handling.hpp.

Referenced by set_shutdown_begun(), and shutdown_begun().


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