implementations.convergence_controller_classes.basic_restarting module

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

Bases: ConvergenceController

Class with some utilities for restarting. The specific functions are:
  • Telling each step after one that requested a restart to get restarted as well

  • Allowing each step to be restarted a limited number of times in a row before just moving on anyways

Default control order is 95.

dependencies(controller, description, **kwargs)[source]

Load a convergence controller that spreads the step sizes between steps.

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

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

Returns:

None

determine_restart(controller, S, **kwargs)[source]

Restart all steps after the first one which wants to be restarted as well, but also check if we lost patience with the restarts and want to move on anyways.

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

  • S (pySDC.Step) – The current step

Returns:

None

classmethod get_implementation(useMPI)[source]

Retrieve the implementation for a specific flavor of this class.

Parameters:

useMPI (bool) – Whether or not the controller uses MPI

Returns:

The child class that implements the desired flavor

Return type:

cls

reset_status_variables(controller, reset=False, **kwargs)[source]

Add status variables for whether to restart now and how many times the step has been restarted in a row to the Steps

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

  • reset (bool) – Whether the function is called for the first time or to reset

Returns:

None

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

Define parameters here.

Default parameters are:
  • control_order (int): The order relative to other convergence controllers

  • max_restarts (int): Maximum number of restarts we allow each step before we just move on with whatever we

    have

  • step_size_spreader (pySDC.ConvergenceController): A convergence controller that takes care of distributing

    the steps sizes between blocks

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)

setup_status_variables(controller, **kwargs)[source]

Add status variables for whether to restart now and how many times the step has been restarted in a row to the Steps

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

  • reset (bool) – Whether the function is called for the first time or to reset

Returns:

None

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

Bases: BasicRestarting

MPI specific version of basic restarting

determine_restart(controller, S, comm, **kwargs)[source]

Restart all steps after the first one which wants to be restarted as well, but also check if we lost patience with the restarts and want to move on anyways.

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

  • S (pySDC.Step) – The current step

  • comm (mpi4py.MPI.Intracomm) – Communicator

Returns:

None

prepare_next_block(controller, S, size, time, Tend, comm, **kwargs)[source]

Update restarts in a row for all steps.

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

  • S (pySDC.Step) – The current step

  • size (int) – The number of ranks

  • time (list) – List containing the time of all the steps

  • Tend (float) – Final time of the simulation

  • comm (mpi4py.MPI.Intracomm) – Communicator

Returns:

None

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

Bases: BasicRestarting

Non-MPI specific version of basic restarting

determine_restart(controller, S, MS, **kwargs)[source]

Restart all steps after the first one which wants to be restarted as well, but also check if we lost patience with the restarts and want to move on anyways.

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

  • S (pySDC.Step) – The current step

  • MS (list) – List of active steps

Returns:

None

prepare_next_block(controller, S, size, time, Tend, MS, **kwargs)[source]

Update restarts in a row for all steps.

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

  • S (pySDC.Step) – The current step

  • size (int) – The number of ranks

  • time (list) – List containing the time of all the steps

  • Tend (float) – Final time of the simulation

  • MS (list) – List of active steps

Returns:

None

reset_buffers_nonMPI(controller, **kwargs)[source]

Reset all variables with are used to simulate communication here

Parameters:

controller (pySDC.Controller) – The controller

Returns:

None