spectre.support.Machines

Support for host machines, such as supercomputers.

Machines are defined as YAML files in ‘support/Machines/’. To add support for a new machine, add a YAML file that defines a Machine: key with the attributes listed in the Machine class below. Also add a submit script with the same name to ‘support/SubmitScripts/’.

To select a machine, specify the MACHINE option when configuring the CMake build.

Functions

this_machine([machinefile_path, raise_exception])

Determine the machine we are running on.

Classes

Machine(Name, Description, ...)

A machine we know how to run on, such as a particular supercomputer.

Exceptions

UnknownMachineError

Indicates we were unsuccessful in identifying the current machine

class spectre.support.Machines.Machine(Name: str, Description: str, DefaultProcsPerNode: int, DefaultQueue: str, DefaultTimeLimit: str, LaunchCommandSingleNode: List[str])

A machine we know how to run on, such as a particular supercomputer.

Many configuration options for job submission are set in the submit script for the machine (in ‘support/SubmitScripts/’). Here we provide additional metadata about the machine.

Name

A short name for the machine. Must match the YAML file name.

Type:

str

Description

A description of the machine. Give some basic context and any information that may help people get started using the machine. Provide links to wiki pages, signup pages, etc., for additional information.

Type:

str

DefaultProcsPerNode

Default number of worker threads spawned per node. It is often advised to leave one core per node or socket free for communication, so this might be the number of cores or hyperthreads per node minus one.

Type:

int

DefaultQueue

Default queue that jobs are submitted to. On Slurm systems you can see the available queues with sinfo.

Type:

str

DefaultTimeLimit

Default wall time limit for submitted jobs. For acceptable formats, see: https://slurm.schedmd.com/sbatch.html#OPT_time

Type:

str

LaunchCommandSingleNode

Command to launch an executable on a single compute node, e.g. [“mpirun”, “-n”, “1”]. This is used to run executables on interactive compute nodes. This is _not_ the full command to launch an executable in scheduled jobs, which can be found in the submit script instead. This is also not used on non-compute (login) nodes.

Type:

List[str]

DefaultProcsPerNode: int
DefaultQueue: str
DefaultTimeLimit: str
Description: str
LaunchCommandSingleNode: List[str]
Name: str
classmethod from_yaml(loader, node)

Convert a representation node to a Python object.

property launch_command: List[str]

The command to launch an executable on the machine.

Prepend this list to the command you want to run.

on_compute_node() bool

Determines whether or not we are running on a compute node.

classmethod to_yaml(dumper, data)

Convert a Python object to a representation node.

yaml_dumper

alias of Dumper

yaml_flow_style = None
yaml_loader

alias of SafeLoader

yaml_tag = '!Machine'
exception spectre.support.Machines.UnknownMachineError

Indicates we were unsuccessful in identifying the current machine

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

spectre.support.Machines.this_machine(machinefile_path=os.path.join(os.path.dirname(__file__), 'Machine.yaml'), raise_exception=True) Machine

Determine the machine we are running on.

Specify the ‘MACHINE’ option in the CMake build configuration to select a machine, or pass the ‘machinefile_path’ argument to this function.

Parameters:
  • machinefile_path – Path to a YAML file that describes the current machine. Defaults to the machine selected in the CMake build configuration.

  • raise_exception – If ‘True’ (default), raises an ‘UnknownMachineError’ if no machine was selected. Otherwise, returns ‘None’ if no machine was selected.

Returns: A ‘Machine’ object that describes the current machine, or ‘None’ if

no machine was selected and ‘raise_exception’ is ‘False’.