spinnman package

Subpackages

Submodules

spinnman.board_test_configuration module

class spinnman.board_test_configuration.BoardTestConfiguration[source]

Bases: object

Configuration to use for a test board

set_up_remote_board(version: int | None = None)[source]

Gets a remote board to test, returning the first that it finds.

Search order is - Local 4 Chip board - 48 Chip board “spinn-4.cs.man.ac.uk” - Local 48 Chip board if at 192.168.240.1 - Virtual machine

The first three ignore the version param the last needs it

Sets the version field in the configs.

Parameters:

version (into or None) – Version for a virtual if no physical board found

Raises:

unittest.SkipTest – If no physical machine found and no version provided

spinnman.config_setup module

spinnman.config_setup.add_spinnman_cfg()[source]

Add the local configuration and all dependent configuration files.

spinnman.config_setup.unittest_setup()[source]

Resets the configurations so only the local default configuration is included.

Note

This file should only be called from SpiNNMan/unittests.

spinnman.constants module

spinnman.constants.BMP_ADC_MAX: int = 4096

The range of values the BMP 12-bit ADCs can measure.

spinnman.constants.BMP_MISSING_FAN: int = -1

Fan speed value returned when a fan is absent.

spinnman.constants.BMP_MISSING_TEMP: int = -32768

Temperature value returned when a probe is not connected.

spinnman.constants.BMP_POST_POWER_ON_SLEEP_TIME: float = 5.0

Time to sleep after powering on boards

spinnman.constants.BMP_POWER_ON_TIMEOUT: float = 10.0

Timeout for BMP power-on commands to reply.

spinnman.constants.BMP_TEMP_SCALE: float = 0.00390625

Multiplier to convert from temperature probe values to degrees Celsius.

spinnman.constants.BMP_TIMEOUT: float = 0.5

Timeout for other BMP commands to reply

spinnman.constants.BMP_V_SCALE_12: float = 0.003662109375

Multiplier to convert from ADC value to volts for 12 V lines.

spinnman.constants.BMP_V_SCALE_2_5: float = 0.0006103515625

Multiplier to convert from ADC value to volts for lines less than 2.5 V.

spinnman.constants.BMP_V_SCALE_3_3: float = 0.00091552734375

Multiplier to convert from ADC value to volts for 3.3 V lines.

spinnman.constants.BOOT_RETRIES: int = 3

This is the number of retries during boot - this is different because otherwise boot takes too long (retrying on a non-booted machine will never work)

spinnman.constants.CPU_INFO_BYTES: int = 128

How many bytes the CPU info data takes up

spinnman.constants.CPU_INFO_OFFSET: int = 3842011136

The address of the start of the VCPU structure (copied from sark.h)

spinnman.constants.CPU_IOBUF_ADDRESS_OFFSET: int = 88

The address at which the iobuf address starts

spinnman.constants.CPU_MAX_USER: int = 3

The largest user “register” number.

spinnman.constants.CPU_USER_OFFSET: int = 4

The number of bytes the user start address moves each time

spinnman.constants.CPU_USER_START_ADDRESS: int = 112

The address at which user0 register starts

class spinnman.constants.EIEIO_COMMAND_IDS(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

A listing of what SpiNNaker specific EIEIO commands there are.

DATABASE = 1

Database handshake with external program; not routed via SpiNNaker

EVENT_PADDING = 2

Fill in buffer area with padding

EVENT_STOP = 3

End of all buffers, stop execution

HOST_DATA_READ = 9

Host confirming data being read form SpiNNaker memory

HOST_DATA_READ_ACK = 12

Host confirming request to read data received

HOST_SEND_SEQUENCED_DATA = 7

Buffers being sent from host to SpiNNaker

SPINNAKER_REQUEST_BUFFERS = 6

Spinnaker requesting new buffers for spike source population

SPINNAKER_REQUEST_READ_DATA = 8

Buffers available to be read from a buffered out vertex

START_RESUME_NOTIFICATION = 11

Command for notifying the external devices that the simulation has started

START_SENDING_REQUESTS = 5

Start complaining that there is SDRAM free space for buffers

STOP_PAUSE_NOTIFICATION = 10

Command for notifying the external devices that the simulation has stopped

STOP_SENDING_REQUESTS = 4

Stop complaining that there is SDRAM free space for buffers

class spinnman.constants.IPTAG_TIME_OUT_WAIT_TIMES(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

The values used by the SCP IP tag time outs. These control how long to wait for any message request which requires a response, before raising an error.

The value is calculated via the following formula:

10ms * 2^(tag_timeout_value - 1)

TIMEOUT_10_ms = 1
TIMEOUT_1280_ms = 8
TIMEOUT_160_ms = 5
TIMEOUT_20_ms = 2
TIMEOUT_2560_ms = 9
TIMEOUT_320_ms = 6
TIMEOUT_40_ms = 3
TIMEOUT_640_ms = 7
TIMEOUT_80_ms = 4
spinnman.constants.MAX_TAG_ID: int = 7

Max user requested tag value

spinnman.constants.NO_ROUTER_DIAGNOSTIC_FILTERS: int = 16

Number of router diagnostic filters

spinnman.constants.N_RETRIES: int = 10

This is the default number of retries when using SCP

class spinnman.constants.READ_TYPES(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

The types of read available from SARK. These values are used to tell SARK how to read the data in a time efficient manner.

BYTE = 0
HALF_WORD = 1
WORD = 2
spinnman.constants.ROUTER_DEFAULT_FILTERS_MAX_POSITION: int = 11

Point where default filters finish and user set-able ones are available

spinnman.constants.ROUTER_DIAGNOSTIC_FILTER_SIZE: int = 4

Size of a router diagnostic filter control register in bytes

spinnman.constants.ROUTER_FILTER_CONTROLS_OFFSET: int = 512

Offset for the router filter controls first register (one word each)

spinnman.constants.ROUTER_REGISTER_BASE_ADDRESS: int = 3774873600

The base address of a routers diagnostic filter controls

spinnman.constants.ROUTER_REGISTER_P2P_ADDRESS: int = 3774939136

The base address of a routers p2p routing table

class spinnman.constants.ROUTER_REGISTER_REGISTERS(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

The indices to the router registers.

DUMP_FR = 11
DUMP_MC = 8
DUMP_NN = 10
DUMP_PP = 9
EXT_FR = 7
EXT_MC = 1
EXT_NN = 5
EXT_PP = 3
LOC_FR = 6
LOC_MC = 0
LOC_NN = 4
LOC_PP = 2
USER_0 = 12
USER_1 = 13
USER_2 = 14
USER_3 = 15
spinnman.constants.SCP_SCAMP_PORT: int = 17893

The default port of the connection

spinnman.constants.SCP_TIMEOUT: float = 1.0

This is the default timeout when using SCP

spinnman.constants.SCP_TIMEOUT_COUNT = 5.0

This is the default timeout when using SCP count (can take a bit longer)

spinnman.constants.SYSTEM_VARIABLE_BASE_ADDRESS: int = 4110450432

The base address of the system variable structure in System ram

spinnman.constants.SYSTEM_VARIABLE_BYTES: int = 256

The size of the system variable structure in bytes

spinnman.constants.UDP_BOOT_CONNECTION_DEFAULT_PORT: int = 54321

The default port of the connection

spinnman.constants.UDP_MESSAGE_MAX_SIZE: int = 256

The max size a UDP packet can be, excluding headers

spinnman.constants.address_length_dtype: Dict[Tuple[int, int], READ_TYPES] = {(0, 0): READ_TYPES.WORD, (0, 1): READ_TYPES.BYTE, (0, 2): READ_TYPES.HALF_WORD, (0, 3): READ_TYPES.BYTE, (1, 0): READ_TYPES.BYTE, (1, 1): READ_TYPES.BYTE, (1, 2): READ_TYPES.BYTE, (1, 3): READ_TYPES.BYTE, (2, 0): READ_TYPES.HALF_WORD, (2, 1): READ_TYPES.BYTE, (2, 2): READ_TYPES.HALF_WORD, (2, 3): READ_TYPES.BYTE, (3, 0): READ_TYPES.BYTE, (3, 1): READ_TYPES.BYTE, (3, 2): READ_TYPES.BYTE, (3, 3): READ_TYPES.BYTE}

This is a mapping between read address in the mapping between word byte position, the number of bytes you wish to read, and the type of time efficient way to read said amount of bytes via SARK

spinnman.exceptions module

exception spinnman.exceptions.SpallocException[source]

Bases: SpinnmanException

Raised when there is a problem with the Spalloc session or job.

exception spinnman.exceptions.SpiNNManCoresNotInStateException(timeout: float | None, expected_states: FrozenSet[CPUState], failed_core_states: CPUInfos)[source]

Bases: SpinnmanTimeoutException

Cores failed to reach a given state within a timeout.

Parameters:
failed_core_states() CPUInfos[source]
Return type:

CPUInfos

exception spinnman.exceptions.SpinnmanEIEIOPacketParsingException(parsing_format: str, packet: bytes)[source]

Bases: SpinnmanException

Unable to complete the parsing of the EIEIO packet received. The routine used is invalid or the content of the packet is invalid.

Parameters:
  • parsing_format (str) –

  • packet (bytes) –

property packet: bytes
Return type:

bytes

exception spinnman.exceptions.SpinnmanEOFException[source]

Bases: SpinnmanIOException

An exception that we’re trying to do I/O on a closed socket. That isn’t going to work!

Parameters:

problem (str) – The problem with the IO

exception spinnman.exceptions.SpinnmanException[source]

Bases: Exception

Superclass of exceptions that occur when dealing with communication with SpiNNaker.

exception spinnman.exceptions.SpinnmanGenericProcessException(exception: Exception, tb: TracebackType, x: int, y: int, p: int, phys_p: str, tb2: TracebackType | None = None)[source]

Bases: SpinnmanException

Encapsulates exceptions from processes which communicate with some core/chip.

Parameters:
property exception: Exception
Return type:

Exception

exception spinnman.exceptions.SpinnmanGroupedProcessException(error_requests: List[AbstractSCPRequest], exceptions: List[Exception], tracebacks: List[TracebackType], connections: List[SCAMPConnection])[source]

Bases: SpinnmanException

Encapsulates exceptions from processes which communicate with a collection of cores/chips.

exception spinnman.exceptions.SpinnmanIOException(problem: str)[source]

Bases: SpinnmanException

An exception that something went wrong with the underlying IO.

Parameters:

problem (str) – The problem with the IO

property problem: str

The problem with IO.

Return type:

str

exception spinnman.exceptions.SpinnmanInvalidPacketException(packet_type: str, problem: str)[source]

Bases: SpinnmanException

An exception that indicates that a packet was not in the expected format.

Parameters:
  • packet_type (str) – The type of packet expected

  • problem (str) – The problem with the packet

property packet_type: str

The packet type.

Return type:

str

property problem: str

The problem with the packet.

Return type:

str

exception spinnman.exceptions.SpinnmanInvalidParameterException(parameter: str, value, problem: str)[source]

Bases: SpinnmanException

An exception that indicates that the value of one of the parameters passed was invalid.

Parameters:
  • parameter (str) – The name of the parameter that is invalid

  • value (str) – The value of the parameter that is invalid

  • problem (str) – The problem with the parameter

property parameter: str

The parameter with an invalid value.

Return type:

str

property problem: str

The problem with the parameter value.

Return type:

str

property value

The value that is invalid.

exception spinnman.exceptions.SpinnmanInvalidParameterTypeException(parameter: str, param_type, problem: str)[source]

Bases: SpinnmanException

An exception that indicates that the type of one of the parameters passed was invalid.

Parameters:
  • parameter (str) – The name of the parameter that is invalid

  • param_type (str) – The type of the parameter that is invalid

  • problem (str) – The problem with the parameter

property parameter: str

The parameter with an invalid value.

Return type:

str

property problem: str

The problem with the parameter value.

Return type:

str

property type

The value that is invalid.

exception spinnman.exceptions.SpinnmanTimeoutException(operation: str, timeout: float | None, msg: str | None = None)[source]

Bases: SpinnmanException

An exception that indicates that a timeout occurred before an operation could finish.

Parameters:
  • operation (str) – The operation being performed

  • timeout (float) – The timeout value in seconds

property operation: str

The operation that was performed.

Return type:

str

property timeout: float | None

The timeout value in seconds.

Return type:

float

exception spinnman.exceptions.SpinnmanUnexpectedResponseCodeException(operation: str, command, response: str | SCPResult)[source]

Bases: SpinnmanException

Indicate that a response code returned from the board was unexpected for the current operation.

Parameters:
  • operation (str) – The operation being performed

  • command (str) – The command being executed

  • response (str) – The response received in error

property command

The command being executed.

property operation: str

The operation being performed.

Return type:

str

property response: str

The unexpected response.

Return type:

str

exception spinnman.exceptions.SpinnmanUnsupportedOperationException(operation: str)[source]

Bases: SpinnmanException

An exception that indicates that the given operation is not supported.

Parameters:

operation (str) – The operation being requested

property operation: str

The unsupported operation requested.

Return type:

str

spinnman.get_cores_in_run_state module

This is a script used to check the state of a SpiNNaker machine.

spinnman.get_cores_in_run_state.get_cores_in_run_state(txrx, app_id, print_all_chips)[source]
Parameters:
spinnman.get_cores_in_run_state.main(args)[source]

Runs the script.

Module contents

Used to communicate with a SpiNNaker Board. The main part of this package is the Transceiver class. This can be used to send and receive packets in various SpiNNaker formats, depending on what connections are available.

Functional Requirements

  1. Connect to and communicate with a machine using a number of different connections.

  2. Boot a machine with the expected version of the software.

    • If the machine is already booted but the version is not the version expected, an exception will be thrown.

  3. Check the version of the software which the machine is booted with.

  4. Query the state of the machine to determine:

    • What the current state of the machine is in terms of the chips and cores available, the SDRAM available on the chips and which links are available between which chips.

    • What external links to the host exist (and separately add the discovered links to the set of links used to communicate with the machine).

    • What is running on the machine and where, and what the current status of those processes are.

    • How many cores are in a given state.

    • What is in the IOBUF buffers.

    • What the current routing entries for a given router are.

    • What the routing status counter values are.

  5. Load application binaries on to the machine, either to individual cores or via a “flood-fill” mechanism to multiple cores simultaneously (which may be a subset of the cores on a subset of the chips).

  6. Write data to SDRAM, either on an individual chip, or via a “flood-fill” mechanism to multiple chips simultaneously.

  7. Send a signal to an application.

  8. Read data from SDRAM on an individual chip.

  9. Send and receive SpiNNaker packets where the connections allow this.

    • If no connection supports this packet type, an exception is thrown.

    • The user should be able to select which connection is used. Selection of a connection which does not support the traffic type will also result in an exception.

  10. Send and receive SCP and SDP packets where the connections allow this.

    • If no connection supports the packet type, an exception is thrown.

    • The user should be able to select which connection is used. Selection of a connection which does not support the traffic type will also result in an exception.

  11. It should be possible to call any of the functions simultaneously, including the same function more than once.

    • Where possible, multiple connections should be used to overlap calls.

    • The functions should not return until they have confirmed that any messages sent have been received, and any responses have been received.

    • Functions should not respond with the result of a different function.

    • Functions can further sub-divide the call into a number of separate calls that can be divided across the available connections, so long as the other requirements are met.

  12. More than one machine can be connected to the same host.

    • Once the subset of connections has been worked out for each machine, the operation of these machines should be independent.

Use Cases

  • Connecting is done by using create_transceiver_from_hostname().

  • boot_board() and get_scamp_version() are used to ensure that the board is booted correctly before starting a simulation.

  • get_machine_details() is used to get a representation of the current state of the machine, which is used to decide where executables are to be run on the board for a particular simulation, where any external peripherals are connected, and how messages between the executables and/or the external peripherals are to be routed.

  • write_memory() and execute() are used to write parameters and execute executables on the board

  • send_signal() is used to send a signal which starts, stops or pauses a simulation.

  • get_core_state_count() is used to determine if a simulation is complete or has gone into an error state.

  • get_iobuf(), get_cpu_infos() and get_router_diagnostics() are used to diagnose a problem with a simulation.

  • read_memory() is used to read some statistics recorded in SDRAM after a simulation.