implementations.convergence_controller_classes.crash module

class CrashBase(controller, params, description, **kwargs)[source]

Bases: ConvergenceController

Crash the code across all ranks

communicate_crash(crash, msg='', comm=None, **kwargs)[source]

Communicate a crash across all ranks and raise an error if so.

Parameters:
  • crash (bool) – If this rank wants to crash

  • comm (mpi4py.MPI.Intracomm or None) – Communicator of the controller, if applicable:

class StopAtMaxRuntime(controller, params, description, **kwargs)[source]

Bases: CrashBase

Abort the code when the problem has exceeded a maximum runtime.

prepare_next_block(controller, S, *args, **kwargs)[source]

Check if we need to crash the code.

Parameters:
  • controller (pySDC.Controller.controller) – Controller

  • S (pySDC.Step.step) – Step

  • comm (mpi4py.MPI.Intracomm or None) – Communicator of the controller, if applicable

Raises:

ConvergenceError – If the solution does not fall within the allowed space

setup(controller, params, description, **kwargs)[source]

Define parameters here.

Default parameters are:
  • max_runtime (float): Crash the code when the norm of the runtime exceeds this threshold

Parameters:
  • controller (pySDC.Controller) – The controller

  • params (dict) – The params passed for this specific convergence controller

  • description (dict) – The description object used to instantiate the controller

Returns:

The updated params dictionary

Return type:

(dict)

class StopAtNan(controller, params, description, **kwargs)[source]

Bases: CrashBase

Crash the code when the norm of the solution exceeds some limit or contains nan. This class is useful when running with MPI in the sweeper or controller.

prepare_next_block(controller, S, *args, **kwargs)[source]

Check if we need to crash the code.

Parameters:
  • controller (pySDC.Controller.controller) – Controller

  • S (pySDC.Step.step) – Step

  • comm (mpi4py.MPI.Intracomm or None) – Communicator of the controller, if applicable

Raises:

ConvergenceError – If the solution does not fall within the allowed space

setup(controller, params, description, **kwargs)[source]

Define parameters here.

Default parameters are:
  • thresh (float): Crash the code when the norm of the solution exceeds this threshold

Parameters:
  • controller (pySDC.Controller) – The controller

  • params (dict) – The params passed for this specific convergence controller

  • description (dict) – The description object used to instantiate the controller

Returns:

The updated params dictionary

Return type:

(dict)