These pages document the python code for the SpiNNMan module which is part of the SpiNNaker Project.

This code depends on SpiNNUtils and SpiNNMachine (Combined_documentation).

SpiNNMan

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

Contents

spinnman

spinnman package

Subpackages
spinnman.connections package
Subpackages
spinnman.connections.abstract_classes package
Submodules
spinnman.connections.abstract_classes.abstract_scp_connection module
spinnman.connections.abstract_classes.connection module
spinnman.connections.abstract_classes.listenable module
Module contents
class spinnman.connections.abstract_classes.Connection

Bases: spinn_utilities.abstract_context_manager.AbstractContextManager

An abstract connection to the SpiNNaker board over some medium

close()[source]

Closes the connection

is_connected()[source]

Determines if the medium is connected at this point in time

Returns:True if the medium is connected, False otherwise
Return type:bool
Raises:SpinnmanIOException – If there is an error when determining the connectivity of the medium.
class spinnman.connections.abstract_classes.Listenable

Bases: object

An interface for connections that can listen for incoming messages.

Implementing this interface means that the connection can be used with ConnectionListener.

get_receive_method()[source]

Get the method that receives for this connection.

is_ready_to_receive(timeout=0)[source]

Determines if there is an SCP packet to be read without blocking.

Parameters:timeout (int) – The time to wait before returning if the connection is not ready
Returns:True if there is an SCP packet to be read
Return type:bool
class spinnman.connections.abstract_classes.AbstractSCPConnection

Bases: spinnman.connections.abstract_classes.Connection

A sender and receiver of SCP messages

chip_x

The x-coordinate of the chip at which messages sent down this connection will arrive at first

Return type:int
chip_y

The y-coordinate of the chip at which messages sent down this connection will arrive at first

Return type:int
get_scp_data(scp_request)[source]

Returns the data of an SCP request as it would be sent down this connection

is_ready_to_receive(timeout=0)[source]

Determines if there is an SCP packet to be read without blocking

Parameters:timeout (int) – The time to wait before returning if the connection is not ready
Returns:True if there is an SCP packet to be read
Return type:bool
receive_scp_response(timeout=1.0)[source]

Receives an SCP response from this connection. Blocks until a message has been received, or a timeout occurs.

Parameters:

timeout (int) – The time in seconds to wait for the message to arrive; if not specified, will wait forever, or until the connection is closed

Returns:

The SCP result, the sequence number, the data of the response and the offset at which the data starts (i.e., where the SDP header starts).

Return type:

tuple(SCPResult, int, bytes, int)

Raises:
send_scp_request(scp_request)[source]

Sends an SCP request down this connection

Messages must have the following properties:

  • source_port is None or 7
  • source_cpu is None or 31
  • source_chip_x is None or 0
  • source_chip_y is None or 0

tag in the message is optional; if not set, the default set in the constructor will be used. sequence in the message is optional; if not set, (sequence number last assigned + 1) % 65536 will be used

Parameters:scp_request (AbstractSCPRequest) – message packet to send
Raises:SpinnmanIOException – If there is an error sending the message
spinnman.connections.udp_packet_connections package
Submodules
spinnman.connections.udp_packet_connections.bmp_connection module
spinnman.connections.udp_packet_connections.boot_connection module
spinnman.connections.udp_packet_connections.eieio_connection module
spinnman.connections.udp_packet_connections.ip_address_connection module
spinnman.connections.udp_packet_connections.scamp_connection module
spinnman.connections.udp_packet_connections.sdp_connection module
spinnman.connections.udp_packet_connections.udp_connection module
spinnman.connections.udp_packet_connections.utils module
Module contents
class spinnman.connections.udp_packet_connections.BMPConnection(connection_data)

Bases: spinnman.connections.udp_packet_connections.UDPConnection, spinnman.connections.abstract_classes.AbstractSCPConnection

A BMP connection which supports queries to the BMP of a SpiNNaker machine

Parameters:connection_data (BMPConnectionData) – The description of what to connect to.
boards

The set of boards supported by the BMP

Return type:iterable of int
cabinet

The cabinet ID of the BMP

Return type:int
chip_x

Defined to satisfy the AbstractSCPConnection - always 0 for a BMP

chip_y

Defined to satisfy the AbstractSCPConnection - always 0 for a BMP

frame

The frame ID of the BMP

Return type:int
get_scp_data(scp_request)[source]

Returns the data of an SCP request as it would be sent down this connection

receive_scp_response(timeout=1.0)[source]

Receives an SCP response from this connection. Blocks until a message has been received, or a timeout occurs.

Parameters:

timeout (int) – The time in seconds to wait for the message to arrive; if not specified, will wait forever, or until the connection is closed

Returns:

The SCP result, the sequence number, the data of the response and the offset at which the data starts (i.e., where the SDP header starts).

Return type:

tuple(SCPResult, int, bytes, int)

Raises:
send_scp_request(scp_request)[source]

Sends an SCP request down this connection

Messages must have the following properties:

  • source_port is None or 7
  • source_cpu is None or 31
  • source_chip_x is None or 0
  • source_chip_y is None or 0

tag in the message is optional; if not set, the default set in the constructor will be used. sequence in the message is optional; if not set, (sequence number last assigned + 1) % 65536 will be used

Parameters:scp_request (AbstractSCPRequest) – message packet to send
Raises:SpinnmanIOException – If there is an error sending the message
class spinnman.connections.udp_packet_connections.BootConnection(remote_host=None)

Bases: spinnman.connections.udp_packet_connections.UDPConnection

A connection to the SpiNNaker board that uses UDP to for booting

Parameters:remote_host (str) – The remote host name or IP address to send packets to. If not specified, the socket will be available for listening only, and will throw and exception if used for sending
Raises:SpinnmanIOException – If there is an error setting up the communication channel
receive_boot_message(timeout=None)[source]

Receives a boot message from this connection. Blocks until a message has been received, or a timeout occurs.

Parameters:

timeout (int) – The time in seconds to wait for the message to arrive; if not specified, will wait forever, or until the connection is closed.

Returns:

a boot message

Return type:

SpinnakerBootMessage

Raises:
send_boot_message(boot_message)[source]

Sends a SpiNNaker boot message using this connection.

Parameters:boot_message (SpinnakerBootMessage) – The message to be sent
Raises:SpinnmanIOException – If there is an error sending the message
class spinnman.connections.udp_packet_connections.UDPConnection(local_host=None, local_port=None, remote_host=None, remote_port=None)

Bases: spinnman.connections.abstract_classes.Connection, spinnman.connections.abstract_classes.Listenable

Parameters:
  • local_host (str) – The local host name or IP address to bind to. If not specified defaults to bind to all interfaces, unless remote_host is specified, in which case binding is done to the IP address that will be used to send packets
  • local_port (int) – The local port to bind to, between 1025 and 65535. If not specified, defaults to a random unused local port
  • remote_host (str) – The remote host name or IP address to send packets to. If not specified, the socket will be available for listening only, and will throw and exception if used for sending
  • remote_port (int) – The remote port to send packets to. If remote_host is None, this is ignored. If remote_host is specified specified, this must also be specified for the connection to allow sending
Raises:

SpinnmanIOException – If there is an error setting up the communication channel

close()[source]

Closes the connection

get_receive_method()[source]

Get the method that receives for this connection.

is_connected()[source]

Determines if the medium is connected at this point in time

Returns:True if the medium is connected, False otherwise
Return type:bool
Raises:SpinnmanIOException – If there is an error when determining the connectivity of the medium.
is_ready_to_receive(timeout=0)[source]

Determines if there is an SCP packet to be read without blocking.

Parameters:timeout (int) – The time to wait before returning if the connection is not ready
Returns:True if there is an SCP packet to be read
Return type:bool
local_ip_address

The local IP address to which the connection is bound.

Returns:The local IP address as a dotted string, e.g., 0.0.0.0
Return type:str
local_port

The local port to which the connection is bound.

Returns:The local port number
Return type:int
receive(timeout=None)[source]

Receive data from the connection

Parameters:

timeout (float) – The timeout in seconds, or None to wait forever

Returns:

The data received as a bytestring

Return type:

bytes

Raises:
receive_with_address(timeout=None)[source]

Receive data from the connection along with the address where the data was received from

Parameters:

timeout (float) – The timeout, or None to wait forever

Returns:

A tuple of the data received and a tuple of the (address, port) received from

Return type:

tuple(bytes, tuple(str, int))

Raises:
remote_ip_address

The remote IP address to which the connection is connected.

Returns:The remote IP address as a dotted string, or None if not connected remotely
Return type:str
remote_port

The remote port to which the connection is connected.

Returns:The remote port, or None if not connected remotely
Return type:int
send(data)[source]

Send data down this connection

Parameters:data (bytes or bytearray) – The data to be sent
Raises:SpinnmanIOException – If there is an error sending the data
send_to(data, address)[source]

Send data down this connection

Parameters:
  • data (bytes or bytearray) – The data to be sent as a bytestring
  • address (tuple(str,int)) – A tuple of (address, port) to send the data to
Raises:

SpinnmanIOException – If there is an error sending the data

class spinnman.connections.udp_packet_connections.EIEIOConnection(local_host=None, local_port=None, remote_host=None, remote_port=None)

Bases: spinnman.connections.udp_packet_connections.UDPConnection, spinnman.connections.abstract_classes.Listenable

A UDP connection for sending and receiving raw EIEIO messages.

Parameters:
  • local_host (str) – The local host name or IP address to bind to. If not specified defaults to bind to all interfaces, unless remote_host is specified, in which case binding is done to the IP address that will be used to send packets
  • local_port (int) – The local port to bind to, between 1025 and 65535. If not specified, defaults to a random unused local port
  • remote_host (str) – The remote host name or IP address to send packets to. If not specified, the socket will be available for listening only, and will throw and exception if used for sending
  • remote_port (int) – The remote port to send packets to. If remote_host is None, this is ignored. If remote_host is specified specified, this must also be specified for the connection to allow sending
Raises:

SpinnmanIOException – If there is an error setting up the communication channel

get_receive_method()[source]

Get the method that receives for this connection.

receive_eieio_message(timeout=None)[source]

Receives an EIEIO message from this connection. Blocks until a message has been received, or a timeout occurs.

Parameters:

timeout (int) – The time in seconds to wait for the message to arrive; if not specified, will wait forever, or until the connection is closed

Returns:

an EIEIO message

Return type:

AbstractEIEIOMessage

Raises:
send_eieio_message(eieio_message)[source]

Sends an EIEIO message down this connection

Parameters:eieio_message (AbstractEIEIOMessage) – The EIEIO message to be sent
Raises:SpinnmanIOException – If there is an error sending the message
send_eieio_message_to(eieio_message, ip_address, port)[source]
class spinnman.connections.udp_packet_connections.IPAddressesConnection(local_host=None, local_port=54321)

Bases: spinnman.connections.udp_packet_connections.UDPConnection

A connection that detects any UDP packet that is transmitted by SpiNNaker boards prior to boot

receive_ip_address(timeout=None)[source]
class spinnman.connections.udp_packet_connections.SCAMPConnection(chip_x=255, chip_y=255, local_host=None, local_port=None, remote_host=None, remote_port=None)

Bases: spinnman.connections.udp_packet_connections.SDPConnection, spinnman.connections.abstract_classes.AbstractSCPConnection

A UDP connection to SCAMP on the board.

Parameters:
  • chip_x (int) – The x-coordinate of the chip on the board with this remote_host
  • chip_y (int) – The y-coordinate of the chip on the board with this remote_host
  • local_host (str) – The optional IP address or host name of the local interface to listen on
  • local_port (int) – The optional local port to listen on
  • remote_host (str) – The optional remote host name or IP address to send messages to. If not specified, sending will not be possible using this connection
  • remote_port (int) – The optional remote port number to send messages to. If not specified, sending will not be possible using this connection
chip_x

The x-coordinate of the chip at which messages sent down this connection will arrive at first

Return type:int
chip_y

The y-coordinate of the chip at which messages sent down this connection will arrive at first

Return type:int
get_scp_data(scp_request, x=None, y=None)[source]

Returns the data of an SCP request as it would be sent down this connection

Parameters:
  • x (int) – Optional: x-coordinate of where to send to
  • y (int) – Optional: y-coordinate of where to send to
receive_scp_response(timeout=1.0)[source]

Receives an SCP response from this connection. Blocks until a message has been received, or a timeout occurs.

Parameters:

timeout (int) – The time in seconds to wait for the message to arrive; if not specified, will wait forever, or until the connection is closed

Returns:

The SCP result, the sequence number, the data of the response and the offset at which the data starts (i.e., where the SDP header starts).

Return type:

tuple(SCPResult, int, bytes, int)

Raises:
receive_scp_response_with_address(timeout=1.0)[source]
send_scp_request(scp_request)[source]

Sends an SCP request down this connection

Messages must have the following properties:

  • source_port is None or 7
  • source_cpu is None or 31
  • source_chip_x is None or 0
  • source_chip_y is None or 0

tag in the message is optional; if not set, the default set in the constructor will be used. sequence in the message is optional; if not set, (sequence number last assigned + 1) % 65536 will be used

Parameters:scp_request (AbstractSCPRequest) – message packet to send
Raises:SpinnmanIOException – If there is an error sending the message
send_scp_request_to(scp_request, x, y, ip_address)[source]
update_chip_coordinates(x, y)[source]
class spinnman.connections.udp_packet_connections.SDPConnection(chip_x=None, chip_y=None, local_host=None, local_port=None, remote_host=None, remote_port=None)

Bases: spinnman.connections.udp_packet_connections.UDPConnection, spinnman.connections.abstract_classes.Listenable

Parameters:
  • chip_x (int) – The optional x-coordinate of the chip at the remote end of the connection. If not specified, it will not be possible to send SDP messages that require a response with this connection.
  • chip_y (int) – The optional y-coordinate of the chip at the remote end of the connection. If not specified, it will not be possible to send SDP messages that require a response with this connection.
  • local_host (str) – The optional IP address or host name of the local interface to listen on
  • local_port (int) – The optional local port to listen on
  • remote_host (str) – The optional remote host name or IP address to send messages to. If not specified, sending will not be possible using this connection
  • remote_port (int) – The optional remote port number to send messages to. If not specified, sending will not be possible using this connection
get_receive_method()[source]

Get the method that receives for this connection.

receive_sdp_message(timeout=None)[source]

Receives an SDP message from this connection. Blocks until the message has been received, or a timeout occurs.

Parameters:

timeout (int) – The time in seconds to wait for the message to arrive; if not specified, will wait forever, or until the connection is closed.

Returns:

The received SDP message

Return type:

SDPMessage

Raises:
send_sdp_message(sdp_message)[source]

Sends an SDP message down this connection

Parameters:sdp_message (SDPMessage) – The SDP message to be sent
Raises:SpinnmanIOException – If there is an error sending the message.
spinnman.connections.udp_packet_connections.update_sdp_header_for_udp_send(sdp_header, source_x, source_y)

Apply defaults to the SDP header for sending over UDP

Parameters:sdp_header (SDPHeader) – The SDP header values
Submodules
spinnman.connections.connection_listener module
spinnman.connections.scp_request_pipeline module
spinnman.connections.token_bucket module
Module contents
class spinnman.connections.ConnectionListener(connection, n_processes=4, timeout=1)

Bases: threading.Thread, spinn_utilities.abstract_context_manager.AbstractContextManager

Thread that listens to a connection and calls callbacks with new messages when they arrive.

Parameters:
  • connection (Listenable) – A connection to listen to
  • n_processes (int) – The number of threads to use when calling callbacks
  • timeout (float) – How long to wait for messages before checking to see if the connection is to be terminated.
add_callback(callback)[source]

Add a callback to be called when a message is received

Parameters:callback (callable) – A callable which takes a single parameter, which is the message received; the result of the callback will be ignored.
close()[source]

Closes the listener. Note that this does not close the provider of the messages; this instead marks the listener as closed. The listener will not truly stop until the get message call returns.

run()[source]

Implements the listening thread.

class spinnman.connections.SCPRequestPipeLine(connection, n_channels=1, intermediate_channel_waits=0, n_retries=10, packet_timeout=1.0)

Bases: object

Allows a set of SCP requests to be grouped together in a communication across a number of channels for a given connection.

This class implements an SCP windowing, first suggested by Andrew Mundy. This extends the idea by having both send and receive windows. These are represented by the n_channels and the intermediate_channel_waits parameters respectively. This seems to help with the timeout issue; when a timeout is received, all requests for which a reply has not been received can also timeout.

Parameters:
  • connection (SCAMPConnection) – The connection over which the communication is to take place
  • n_channels (int) – The number of requests to send before checking for responses. If None, this will be determined automatically
  • intermediate_channel_waits (int) – The number of outstanding responses to wait for before continuing sending requests. If None, this will be determined automatically
  • n_retries (int) – The number of times to resend any packet for any reason before an error is triggered
  • packet_timeout (float) – The number of elapsed seconds after sending a packet before it is considered a timeout.
finish()[source]

Indicate the end of the packets to be sent. This must be called to ensure that all responses are received and handled.

n_channels

The number of requests to send before checking for responses.

n_resent

The number of packets that have been resent.

n_retry_code_resent

The number of resends due to reasons for which automated retry is the correct response in-protocol.

n_timeouts

The number of timeouts that occurred.

send_request(request, callback, error_callback)[source]

Add an SCP request to the set to be sent

Parameters:
  • request (AbstractSCPRequest) – The SCP request to be sent
  • callback (callable) – A callback function to call when the response has been received; takes a SCPResponse as a parameter, or None if the response doesn’t need to be processed
  • error_callback (callable) – A callback function to call when an error is found when processing the message; takes the original AbstractSCPRequest, the exception caught and a list of tuples of (filename, line number, function name, text) as a traceback
class spinnman.connections.TokenBucket(tokens, fill_rate)

Bases: object

An implementation of the token bucket algorithm. Usage:

>>> bucket = TokenBucket(80, 0.5)
>>> print(bucket.consume(10))
True

Not thread safe.

Parameters:
  • tokens (int) – the total tokens in the bucket
  • fill_rate (float) – the rate in tokens/second that the bucket will be refilled.
consume(tokens, block=True)[source]

Consume tokens from the bucket. Returns True if there were sufficient tokens.

If there are not enough tokens and block is True, sleeps until the bucket is replenished enough to satisfy the deficiency.

If there are not enough tokens and block is False, returns False.

It is an error to consume more tokens than the bucket capacity.

Parameters:
  • tokens (int) –
  • block (bool) –
Return type:

bool

tokens

The number of tokens currently in the bucket.

spinnman.data package
Submodules
spinnman.data.spinnman_data_view module
spinnman.data.spinnman_data_writer module
class spinnman.data.spinnman_data_writer.SpiNNManDataWriter(state)[source]

Bases: spinn_machine.data.machine_data_writer.MachineDataWriter, spinnman.data.SpiNNManDataView

See UtilsDataWriter

This class is designed to only be used directly within the SpiNNMan repository unittests as all methods are available to subclasses

Creates a new writer clearing all previous data and sets the state

Parameters:state (Data_Status) – State writer should be in
set_transceiver(transceiver)[source]

Sets the transceiver object

Parameters:transceiver (Transceiver) –
Raises:TypeError – If the transceiver is not a Transceiver
Module contents
class spinnman.data.SpiNNManDataView

Bases: spinn_machine.data.MachineDataView

Adds the extra Methods to the View for SpiNNMan level.

See UtilsDataView for a more detailed description.

This class is designed to only be used directly within the SpiNNMan repository as all methods are available to subclasses

classmethod free_id(app_id)[source]

Frees up an app_id

previously transceiver.app_id_tracker.free_id(app_id)

Parameters:app_id (int) –
classmethod get_app_id()[source]

Gets the main app id used by the transceiver.

This method will create a new app_id if one has not yet been created.

Return type:int
classmethod get_new_id()[source]

Gets a new id from the current app_id_tracker

previously transceiver.app_id_tracker.get_new_id()

Return type:AppIdTracker
classmethod get_scamp_connection_selector()[source]

Gets the scamp connection selector from the transceiver

Semantic sugar for transceiver.scamp_connection_selector

Return type:MostDirectConnectionSelector
Raises:SpiNNUtilsException – If the transceiver is currently unavailable
classmethod get_transceiver()[source]

The transceiver description

Return type:Transceiver
Raises:SpiNNUtilsException – If the transceiver is currently unavailable
classmethod has_transceiver()[source]

Reports if a transceiver is currently set

Return type:bool
classmethod read_memory(x, y, base_address, length, cpu=0)[source]

Read some areas of memory (usually SDRAM) from the board.

Semantic sugar for transceiver.read_memory

Parameters:
  • x (int) – The x-coordinate of the chip where the memory is to be read from
  • y (int) – The y-coordinate of the chip where the memory is to be read from
  • base_address (int) – The address in SDRAM where the region of memory to be read starts
  • length (int) – The length of the data to be read in bytes
  • cpu (int) – the core ID used to read the memory of; should usually be 0 when reading from SDRAM, but may be other values when reading from DTCM.
Returns:

A bytearray of data read

Return type:

bytes

Raises:
classmethod write_memory(x, y, base_address, data, n_bytes=None, offset=0, cpu=0, is_filename=False)[source]

Write to the SDRAM on the board.

Semantic sugar for transceiver.read_memory

Parameters:
  • x (int) – The x-coordinate of the chip where the memory is to be written to
  • y (int) – The y-coordinate of the chip where the memory is to be written to
  • base_address (int) – The address in SDRAM where the region of memory is to be written
  • data (RawIOBase or bytes or bytearray or int or str) –

    The data to write. Should be one of the following:

    • An instance of RawIOBase
    • A bytearray/bytes
    • A single integer - will be written in little-endian byte order
    • A filename of a data file (in which case is_filename must be set to True)
  • n_bytes (int) –

    The amount of data to be written in bytes. If not specified:

    • If data is an RawIOBase, an error is raised
    • If data is a bytearray, the length of the bytearray will be used
    • If data is an int, 4 will be used
    • If data is a str, the length of the file will be used
  • offset (int) – The offset from which the valid data begins
  • cpu (int) – The optional CPU to write to
  • is_filename (bool) – True if data is a filename
Raises:
spinnman.messages package
Subpackages
spinnman.messages.eieio package
Subpackages
spinnman.messages.eieio.command_messages package
Submodules
spinnman.messages.eieio.command_messages.eieio_command_header module
spinnman.messages.eieio.command_messages.eieio_command_message module
spinnman.messages.eieio.command_messages.event_stop_request module
spinnman.messages.eieio.command_messages.host_data_read module
spinnman.messages.eieio.command_messages.host_data_read_ack module
spinnman.messages.eieio.command_messages.host_send_sequenced_data module
spinnman.messages.eieio.command_messages.notification_protocol_db_location module
spinnman.messages.eieio.command_messages.notification_protocol_pause_stop module
spinnman.messages.eieio.command_messages.notification_protocol_start_resume module
spinnman.messages.eieio.command_messages.padding_request module
spinnman.messages.eieio.command_messages.spinnaker_request_buffers module
spinnman.messages.eieio.command_messages.spinnaker_request_read_data module
spinnman.messages.eieio.command_messages.start_requests module
spinnman.messages.eieio.command_messages.stop_requests module
Module contents
class spinnman.messages.eieio.command_messages.EIEIOCommandHeader(command)

Bases: object

EIEIO header for command packets

bytestring

Get a bytestring of the header

Return type:bytes
command
static from_bytestring(data, offset)[source]

Read an EIEIO command header from a bytestring

Parameters:
  • data (bytes or bytearray) – The bytestring to read the data from
  • offset (int) – The offset where the valid data starts
Returns:

an EIEIO command header

Return type:

EIEIOCommandHeader

Raises:
class spinnman.messages.eieio.command_messages.EIEIOCommandMessage(eieio_command_header, data=None, offset=0)

Bases: spinnman.messages.eieio.AbstractEIEIOMessage

An EIEIO command message

Parameters:
  • eieio_command_header (EIEIOCommandHeader) – The header of the message
  • data (bytes) – Optional incoming data
  • offset (int) – Offset into the data where valid data begins
bytestring

The bytes of the message.

Return type:bytes
data
eieio_header

The header of the message.

Return type:EIEIOCommandHeader
static from_bytestring(command_header, data, offset)[source]
static get_min_packet_length()[source]
offset
class spinnman.messages.eieio.command_messages.EventStopRequest

Bases: spinnman.messages.eieio.command_messages.EIEIOCommandMessage

Packet used for the buffering input technique which causes the parser of the input packet to terminate its execution

class spinnman.messages.eieio.command_messages.HostDataRead(n_requests, sequence_no, channel, region_id, space_read)

Bases: spinnman.messages.eieio.command_messages.EIEIOCommandMessage

Packet sent by the host computer to the SpiNNaker system in the context of the buffering output technique to signal that the host has completed reading data from the output buffer, and that such space can be considered free to use again

bytestring

The bytes of the message.

Return type:bytes
channel(ack_id)[source]
static from_bytestring(command_header, data, offset)[source]
static get_min_packet_length()[source]
n_requests
region_id(ack_id)[source]
sequence_no
space_read(ack_id)[source]
class spinnman.messages.eieio.command_messages.HostSendSequencedData(region_id, sequence_no, eieio_data_message)

Bases: spinnman.messages.eieio.command_messages.EIEIOCommandMessage

Packet sent from the host to the SpiNNaker system in the context of buffering input mechanism to identify packet which needs to be stored in memory for future use

bytestring

The bytes of the message.

Return type:bytes
eieio_data_message
static from_bytestring(command_header, data, offset)[source]
static get_min_packet_length()[source]
region_id
sequence_no
class spinnman.messages.eieio.command_messages.NotificationProtocolDatabaseLocation(database_path=None)

Bases: spinnman.messages.eieio.command_messages.EIEIOCommandMessage

Packet which contains the path to the database created by the toolchain which is to be used by any software which interfaces with SpiNNaker. Also the acknowledgement of that message.

This message is not sent to SpiNNaker boards but rather to an auxiliary tool (e.g., data visualiser).

Parameters:database_path (str) – The location of the database. If None, this is an acknowledgement, stating that the database has now been read.
bytestring

The bytes of the message.

Return type:bytes
database_path
static from_bytestring(command_header, data, offset)[source]
class spinnman.messages.eieio.command_messages.NotificationProtocolPauseStop

Bases: spinnman.messages.eieio.command_messages.EIEIOCommandMessage

Packet which indicates that the toolchain has paused or stopped

This message is not sent to SpiNNaker boards but rather to an auxiliary tool (e.g., data visualiser).

static from_bytestring(command_header, data, offset)[source]
class spinnman.messages.eieio.command_messages.NotificationProtocolStartResume

Bases: spinnman.messages.eieio.command_messages.EIEIOCommandMessage

Packet which indicates that the toolchain has started or resumed.

This message is not sent to SpiNNaker boards but rather to an auxiliary tool (e.g., data visualiser).

static from_bytestring(command_header, data, offset)[source]
class spinnman.messages.eieio.command_messages.PaddingRequest

Bases: spinnman.messages.eieio.command_messages.EIEIOCommandMessage

Packet used to pad space in the buffering area, if needed

static get_min_packet_length()[source]
class spinnman.messages.eieio.command_messages.SpinnakerRequestBuffers(x, y, p, region_id, sequence_no, space_available)

Bases: spinnman.messages.eieio.command_messages.EIEIOCommandMessage

Message used in the context of the buffering input mechanism which is sent by the SpiNNaker system to the host computer to ask for more data to inject during the simulation

bytestring

The bytes of the message.

Return type:bytes
static from_bytestring(command_header, data, offset)[source]
static get_min_packet_length()[source]
p
region_id
sequence_no
space_available
x
y
class spinnman.messages.eieio.command_messages.HostDataReadAck(sequence_no)

Bases: spinnman.messages.eieio.command_messages.EIEIOCommandMessage

Packet sent by the host computer to the SpiNNaker system in the context of the buffering output technique to signal that the host has received a request to read data

bytestring

The bytes of the message.

Return type:bytes
static from_bytestring(command_header, data, offset)[source]
sequence_no
class spinnman.messages.eieio.command_messages.SpinnakerRequestReadData(x, y, p, region_id, sequence_no, n_requests, channel, start_address, space_to_be_read)

Bases: spinnman.messages.eieio.command_messages.EIEIOCommandMessage

Message used in the context of the buffering output mechanism which is sent from the SpiNNaker system to the host computer to signal that some data is available to be read

bytestring

The bytes of the message.

Return type:bytes
channel(request_id)[source]
static from_bytestring(command_header, data, offset)[source]
static get_min_packet_length()[source]
n_requests
p
region_id(request_id)[source]
sequence_no
space_to_be_read(request_id)[source]
start_address(request_id)[source]
x
y
class spinnman.messages.eieio.command_messages.StartRequests

Bases: spinnman.messages.eieio.command_messages.EIEIOCommandMessage

Packet used in the context of buffering input for the host computer to signal to the SpiNNaker system that, if needed, it is possible to send more “SpinnakerRequestBuffers” packet

class spinnman.messages.eieio.command_messages.StopRequests

Bases: spinnman.messages.eieio.command_messages.EIEIOCommandMessage

Packet used in the context of buffering input for the host computer to signal to the SpiNNaker system that to stop sending “SpinnakerRequestBuffers” packet

spinnman.messages.eieio.data_messages package
Submodules
spinnman.messages.eieio.data_messages.abstract_data_element module
spinnman.messages.eieio.data_messages.eieio_data_header module
spinnman.messages.eieio.data_messages.eieio_data_message module
spinnman.messages.eieio.data_messages.key_data_element module
spinnman.messages.eieio.data_messages.key_payload_data_element module
Module contents
class spinnman.messages.eieio.data_messages.AbstractDataElement

Bases: object

A marker interface for possible data elements in the EIEIO data packet

get_bytestring(eieio_type)[source]

Get a bytestring for the given type

Parameters:eieio_type (EIEIOType) – The type of the message being written
Returns:A bytestring for the element
Return type:bytes
Raises:SpinnmanInvalidParameterException – If the type is incompatible with the element
class spinnman.messages.eieio.data_messages.EIEIODataHeader(eieio_type, tag=0, prefix=None, prefix_type=<EIEIOPrefix.LOWER_HALF_WORD: 0>, payload_base=None, is_time=False, count=0)

Bases: object

EIEIO header for data packets

Parameters:
  • eieio_type (EIEIOType) – the type of message
  • tag (int) – the tag of the message (0 by default)
  • prefix (int or None) – the key prefix of the message or None if not prefixed
  • prefix_type (EIEIOPrefix) – the position of the prefix (upper or lower)
  • payload_base (int or None) – The base payload to be applied, or None if no base payload
  • is_time (bool) – True if the payloads should be taken to be timestamps, or False otherwise
  • count (int) – Count of the number of items in the packet
bytestring

Get a bytestring of the header

Returns:The header as a bytestring
Return type:bytes
count
eieio_type
static from_bytestring(data, offset)[source]

Read an eieio data header from a bytestring

Parameters:
  • data (bytes) – The bytestring to be read
  • offset (int) – The offset at which the data starts
Returns:

an EIEIO header

Return type:

EIEIODataHeader

static get_header_size(eieio_type, is_prefix=False, is_payload_base=False)[source]

Get the size of a header with the given parameters

Parameters:
  • eieio_type (EIEIOType) – the type of message
  • is_prefix (bool) – True if there is a prefix, False otherwise
  • is_payload_base (bool) – True if there is a payload base, False otherwise
Returns:

The size of the header in bytes

Return type:

int

increment_count()[source]
is_time
payload_base
prefix
prefix_type
reset_count()[source]
size
tag
class spinnman.messages.eieio.data_messages.EIEIODataMessage(eieio_header, data=None, offset=0)

Bases: spinnman.messages.eieio.AbstractEIEIOMessage

An EIEIO Data message.

Parameters:
  • eieio_header (EIEIODataHeader) – The header of the message
  • data (bytes) – Optional data contained within the packet
  • offset (int) – Optional offset where the valid data starts
add_element(element)[source]

Add an element to the message. The correct type of element must be added, depending on the header values

Parameters:

element (AbstractDataElement) – The element to be added

Raises:
add_key(key)[source]

Add a key to the packet

Parameters:key (int) – The key to add
Raises:SpinnmanInvalidParameterException – If the key is too big for the format, or the format expects a payload
add_key_and_payload(key, payload)[source]

Adds a key and payload to the packet

Parameters:
  • key (int) – The key to add
  • payload (int) – The payload to add
Raises:

SpinnmanInvalidParameterException – If the key or payload is too big for the format, or the format doesn’t expect a payload

bytestring

The bytes of the message.

Return type:bytes
static create(eieio_type, count=0, data=None, offset=0, key_prefix=None, payload_prefix=None, timestamp=None, prefix_type=<EIEIOPrefix.LOWER_HALF_WORD: 0>)[source]

Create a data message

Parameters:
  • eieio_type (EIEIOType) – The type of the message
  • count (int) – The number of items in the message
  • data (bytes) – The data in the message
  • offset (int) – The offset in the data where the actual data starts
  • key_prefix (int) – The prefix of the keys
  • payload_prefix (int) – The prefix of the payload
  • timestamp (int) – The timestamp of the packet
  • prefix_type (EIEIOPrefix) – The type of the key prefix if 16-bits
eieio_header

The header of the message.

Return type:EIEIODataHeader
get_min_packet_length()[source]

Get the minimum length of a message instance in bytes

Return type:int
is_next_element

Determine if there is another element to be read

Returns:True if the message was created with data, and there are more elements to be read
Return type:bool
max_n_elements

The maximum number of elements that can fit in the packet

Return type:int
static min_packet_length(eieio_type, is_prefix=False, is_payload_base=False, is_timestamp=False)[source]

The minimum length of a message with the given header, in bytes

Parameters:
  • eieio_type (EIEIOType) – the type of message
  • is_prefix (bool) – True if there is a prefix, False otherwise
  • is_payload_base (bool) – True if there is a payload base, False otherwise
  • is_timestamp (bool) – True if there is a timestamp, False otherwise
Returns:

The minimum size of the packet in bytes

Return type:

int

n_elements

The number of elements in the packet

next_element

The next element to be read, or None if no more elements. The exact type of element returned depends on the packet type

Return type:AbstractDataElement
size

The size of the packet with the current contents

class spinnman.messages.eieio.data_messages.KeyDataElement(key)

Bases: spinnman.messages.eieio.data_messages.AbstractDataElement

A data element that contains just a key

get_bytestring(eieio_type)[source]

Get a bytestring for the given type

Parameters:eieio_type (EIEIOType) – The type of the message being written
Returns:A bytestring for the element
Return type:bytes
Raises:SpinnmanInvalidParameterException – If the type is incompatible with the element
key
class spinnman.messages.eieio.data_messages.KeyPayloadDataElement(key, payload, payload_is_timestamp=False)

Bases: spinnman.messages.eieio.data_messages.AbstractDataElement

A data element that contains a key and a payload

get_bytestring(eieio_type)[source]

Get a bytestring for the given type

Parameters:eieio_type (EIEIOType) – The type of the message being written
Returns:A bytestring for the element
Return type:bytes
Raises:SpinnmanInvalidParameterException – If the type is incompatible with the element
key
payload
payload_is_timestamp
Submodules
spinnman.messages.eieio.create_eieio_command module
spinnman.messages.eieio.create_eieio_data module
spinnman.messages.eieio.eieio_message module
spinnman.messages.eieio.eieio_prefix module
spinnman.messages.eieio.eieio_type module
Module contents
class spinnman.messages.eieio.EIEIOPrefix(value, doc='')

Bases: enum.Enum

Possible prefixing of keys in EIEIO packets

LOWER_HALF_WORD = 0
UPPER_HALF_WORD = 1
class spinnman.messages.eieio.EIEIOType(value, key_bytes, payload_bytes, doc='')

Bases: enum.Enum

Possible types of EIEIO packets

KEY_16_BIT = 0
KEY_32_BIT = 2
KEY_PAYLOAD_16_BIT = 1
KEY_PAYLOAD_32_BIT = 3
key_bytes

The number of bytes used by each key element

Return type:int
max_value

The maximum value of the key or payload (if there is a payload)

Return type:int
payload_bytes

The number of bytes used by each payload element

Return type:int
spinnman.messages.eieio.read_eieio_command_message(data, offset)

Reads the content of an EIEIO command message and returns an object identifying the command which was contained in the packet, including any parameter, if required by the command

Parameters:
  • data (bytes) – data received from the network as a bytestring
  • offset (int) – offset at which the parsing operation should start
Returns:

an object which inherits from EIEIOCommandMessage which contains parsed data received from the network

Return type:

EIEIOCommandMessage

spinnman.messages.eieio.read_eieio_data_message(data, offset)

Reads the content of an EIEIO data message and returns an object identifying the data which was contained in the packet

Parameters:
  • data (bytes) – data received from the network as a bytestring
  • offset (int) – offset at which the parsing operation should start
Returns:

an object which inherits from EIEIODataMessage which contains parsed data received from the network

Return type:

EIEIODataMessage

class spinnman.messages.eieio.AbstractEIEIOMessage

Bases: object

Interface for an EIEIOMessage

bytestring

The bytes of the message.

Return type:bytes
eieio_header

The header of the message.

spinnman.messages.scp package
Subpackages
spinnman.messages.scp.abstract_messages package
Submodules
spinnman.messages.scp.abstract_messages.bmp_request module
spinnman.messages.scp.abstract_messages.bmp_response module
spinnman.messages.scp.abstract_messages.scp_request module
spinnman.messages.scp.abstract_messages.scp_response module
Module contents
class spinnman.messages.scp.abstract_messages.BMPRequest(boards, scp_request_header, argument_1=None, argument_2=None, argument_3=None, data=None)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

An SCP request intended to be sent to a BMP.

Parameters:
  • boards (int or list(int) or tuple(int)) – The board or boards to be addressed by this request
  • scp_request_header (SCPRequestHeader) – The SCP request header
  • argument_1 (int) – The optional first argument
  • argument_2 (int) – The optional second argument
  • argument_3 (int) – The optional third argument
  • data (bytes) – The optional data to be sent
static get_board_mask(boards)[source]

Get the board mask given a board ID or collection of board IDs

static get_first_board(boards)[source]

Get the first board ID given a board ID or collection of board IDs

class spinnman.messages.scp.abstract_messages.BMPResponse

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPResponse

Represents an SCP request thats tailored for the BMP connection.

class spinnman.messages.scp.abstract_messages.AbstractSCPRequest(sdp_header, scp_request_header, argument_1=None, argument_2=None, argument_3=None, data=None)

Bases: object

Represents an Abstract SCP Request

Parameters:
  • sdp_header (SDPHeader) – The SDP header of the request
  • scp_request_header (SCPRequestHeader) – The SCP header of the request
  • argument_1 (int) – The first argument, or None if no first argument
  • argument_2 (int) – The second argument, or None if no second argument
  • argument_3 (int) – The third argument, or None if no third argument
  • data (bytearray or bytes or None) – The optional data, or None if no data
DEFAULT_DEST_X_COORD = 255
DEFAULT_DEST_Y_COORD = 255
argument_1

The first argument, or None if no first argument

Return type:int
argument_2

The second argument, or None if no second argument

Return type:int
argument_3

The third argument, or None if no third argument

Return type:int
bytestring

The request as a bytestring

Return type:bytes
data

The data, or None if no data

Return type:bytearray
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
scp_request_header

The SCP request header of the message

Return type:SCPRequestHeader
sdp_header

The SDP header of the message

Return type:SDPHeader
class spinnman.messages.scp.abstract_messages.AbstractSCPResponse

Bases: object

Represents an abstract SCP Response.

read_bytestring(data, offset)[source]

Reads a packet from a bytestring of data

Parameters:
  • data (bytes) – The bytestring to be read
  • offset (int) – The offset in the data from which the response should be read
read_data_bytestring(data, offset)[source]

Reads the remainder of the data following the header

Parameters:
  • data (bytes) – The bytestring to read from
  • offset (int) – The offset into the data after the headers
scp_response_header

The SCP header from the response

Return type:SCPResponseHeader
sdp_header

The SDP header from the response

Return type:SDPHeader
spinnman.messages.scp.enums package
Submodules
spinnman.messages.scp.enums.alloc_free module
spinnman.messages.scp.enums.bmp_info module
spinnman.messages.scp.enums.iptag_command module
spinnman.messages.scp.enums.led_action module
spinnman.messages.scp.enums.power_command module
spinnman.messages.scp.enums.scp_command module
spinnman.messages.scp.enums.scp_result module
spinnman.messages.scp.enums.signal module
Module contents
class spinnman.messages.scp.enums.AllocFree(value, doc='')

Bases: enum.Enum

The SCP Allocation and Free codes

ALLOC_ROUTING = 3
ALLOC_SDRAM = 0
FREE_ROUTING_BY_APP_ID = 5
FREE_ROUTING_BY_POINTER = 4
FREE_SDRAM_BY_APP_ID = 2
FREE_SDRAM_BY_POINTER = 1
class spinnman.messages.scp.enums.BMPInfo(value, doc='')

Bases: enum.Enum

The SCP BMP Information Types

ADC = 3
CAN_STATUS = 2
IP_ADDR = 4
SERIAL = 0
class spinnman.messages.scp.enums.SCPCommand(value, doc='')

Bases: enum.Enum

The SCP Commands

CMD_ALLOC = 28
CMD_APLX = 4
CMD_APP_COPY_RUN = 21
CMD_AR = 19
CMD_AS = 24
CMD_BMP_INFO = 48
CMD_BMP_POWER = 57
CMD_DPRI = 30
CMD_FFD = 23
CMD_FILL = 5
CMD_FLASH_COPY = 49
CMD_FLASH_ERASE = 50
CMD_FLASH_WRITE = 51
CMD_INFO = 31
CMD_IPTAG = 26
CMD_LED = 25
CMD_NNP = 20
CMD_READ = 2
CMD_REMAP = 16
CMD_RESET = 55
CMD_RTR = 29
CMD_RUN = 1
CMD_SIG = 22
CMD_SROM = 27
CMD_SYNC = 32
CMD_TUBE = 64
CMD_VER = 0
CMD_WRITE = 3
class spinnman.messages.scp.enums.IPTagCommand(value, doc='')

Bases: enum.Enum

SCP IP tag Commands

CLR = 3
GET = 2
NEW = 0
SET = 1
TTO = 4
class spinnman.messages.scp.enums.LEDAction(value, doc='')

Bases: enum.Enum

The SCP LED actions

OFF = 2
ON = 3
TOGGLE = 1
class spinnman.messages.scp.enums.PowerCommand(value, doc='')

Bases: enum.Enum

The SCP Power Commands

POWER_OFF = 0
POWER_ON = 1
class spinnman.messages.scp.enums.SCPResult(value, doc='')

Bases: enum.Enum

The SCP Result codes

RC_ARG = 132
RC_BUF = 138
RC_CMD = 131
RC_CPU = 136
RC_DEAD = 137
RC_LEN = 129
RC_OK = 128
RC_P2P_BUSY = 141
RC_P2P_NOREPLY = 139
RC_P2P_REJECT = 140
RC_P2P_TIMEOUT = 142
RC_PKT_TX = 143
RC_PORT = 133
RC_ROUTE = 135
RC_SUM = 130
RC_TIMEOUT = 134
class spinnman.messages.scp.enums.Signal(value, signal_type, doc='')

Bases: enum.Enum

SCP Signals

Parameters:
  • value (int) – The value used for the signal
  • signal_type (SignalType) – The “type” of the signal
CONTINUE = 7
EXIT = 8
INITIALISE = 0
PAUSE = 6
POWER_DOWN = 1
START = 3
STOP = 2
SYNC0 = 4
SYNC1 = 5
TIMER = 9
USER_0 = 10
USER_1 = 11
USER_2 = 12
USER_3 = 13
signal_type
class spinnman.messages.scp.enums.SignalType

Bases: enum.Enum

The type of signal, determined by how it is transmitted

MULTICAST = 0
NEAREST_NEIGHBOUR = 2
POINT_TO_POINT = 1
spinnman.messages.scp.impl package
Submodules
spinnman.messages.scp.impl.app_copy_run module
spinnman.messages.scp.impl.app_stop module
spinnman.messages.scp.impl.application_run module
spinnman.messages.scp.impl.bmp_get_version module
spinnman.messages.scp.impl.bmp_set_led module
spinnman.messages.scp.impl.check_ok_response module
spinnman.messages.scp.impl.count_state module
spinnman.messages.scp.impl.count_state_response module
class spinnman.messages.scp.impl.count_state_response.CountStateResponse[source]

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPResponse

An SCP response to a request for the number of cores in a given state

count

The count of the number of cores with the requested state

Return type:int
read_data_bytestring(data, offset)[source]

Reads the remainder of the data following the header

Parameters:
  • data (bytes) – The bytestring to read from
  • offset (int) – The offset into the data after the headers
spinnman.messages.scp.impl.do_sync module
spinnman.messages.scp.impl.fill_request module
spinnman.messages.scp.impl.fixed_route_init module
spinnman.messages.scp.impl.fixed_route_read module
spinnman.messages.scp.impl.flood_fill_data module
spinnman.messages.scp.impl.flood_fill_end module
spinnman.messages.scp.impl.flood_fill_start module
spinnman.messages.scp.impl.get_chip_info module
spinnman.messages.scp.impl.get_chip_info_response module
class spinnman.messages.scp.impl.get_chip_info_response.GetChipInfoResponse[source]

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPResponse

An SCP response to a request for the version of software running

chip_info

The chip information received

Return type:ChipSummaryInfo
read_data_bytestring(data, offset)[source]

Reads the remainder of the data following the header

Parameters:
  • data (bytes) – The bytestring to read from
  • offset (int) – The offset into the data after the headers
spinnman.messages.scp.impl.get_version module
spinnman.messages.scp.impl.get_version_response module
class spinnman.messages.scp.impl.get_version_response.GetVersionResponse[source]

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPResponse

An SCP response to a request for the version of software running

read_data_bytestring(data, offset)[source]

Reads the remainder of the data following the header

Parameters:
  • data (bytes) – The bytestring to read from
  • offset (int) – The offset into the data after the headers
version_info

The version information received

Return type:VersionInfo
spinnman.messages.scp.impl.iptag_clear module
spinnman.messages.scp.impl.iptag_get module
spinnman.messages.scp.impl.iptag_get_info module
spinnman.messages.scp.impl.iptag_get_info_response module
class spinnman.messages.scp.impl.iptag_get_info_response.IPTagGetInfoResponse[source]

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPResponse

An SCP response to a request for information about IP tags

fixed_size

The count of the number of fixed IP tag entries

Return type:int
pool_size

The count of the IP tag pool size

Return type:int
read_data_bytestring(data, offset)[source]

Reads the remainder of the data following the header

Parameters:
  • data (bytes) – The bytestring to read from
  • offset (int) – The offset into the data after the headers
transient_timeout

The timeout for transient IP tags (i.e. responses to SCP commands)

Return type:int
spinnman.messages.scp.impl.iptag_set module
spinnman.messages.scp.impl.iptag_set_tto module
spinnman.messages.scp.impl.read_adc module
spinnman.messages.scp.impl.read_fpga_register module
spinnman.messages.scp.impl.read_memory module
spinnman.messages.scp.impl.reverse_iptag_set module
spinnman.messages.scp.impl.router_alloc module
spinnman.messages.scp.impl.router_clear module
spinnman.messages.scp.impl.router_init module
spinnman.messages.scp.impl.sdram_alloc module
spinnman.messages.scp.impl.sdram_de_alloc module
spinnman.messages.scp.impl.send_signal module
spinnman.messages.scp.impl.set_led module
spinnman.messages.scp.impl.set_power module
spinnman.messages.scp.impl.write_fpga_register module
spinnman.messages.scp.impl.write_memory module
Module contents
class spinnman.messages.scp.impl.AppStop(app_id)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

An SCP Request to stop an application

Parameters:app_id (int) – The ID of the application, between 0 and 255
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.ApplicationRun(app_id, x, y, processors, wait=False)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

An SCP request to run an application loaded on a chip

Parameters:
  • app_id (int) – The ID of the application to run, between 16 and 255
  • x (int) – The x-coordinate of the chip to run on, between 0 and 255
  • y (int) – The y-coordinate of the chip to run on, between 0 and 255
  • processors (list(int)) – The processors on the chip where the executable should be started, between 1 and 17
  • wait (bool) – True if the processors should enter a “wait” state on starting
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.AppCopyRun(x, y, link, size, app_id, processors, chksum, wait=False)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

An SCP request to copy an application and start it

Parameters:
  • x (int) – The x-coordinate of the chip to read from, between 0 and 255
  • y (int) – The y-coordinate of the chip to read from, between 0 and 255
  • link (int) – The ID of the link from which to copy
  • size (int) – The number of bytes to read, must be divisible by 4
  • app_id (int) – The app to associate the copied binary with
  • processors (list(int)) – The processors to start on the chip
  • chksum (int) – The checksum of the data to copy
  • wait (bool) – Whether to start in wait mode or not
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.BMPSetLed(led, action, boards)

Bases: spinnman.messages.scp.abstract_messages.BMPRequest

Set the LED(s) of a board to either on, off or toggling

This class is currently deprecated and untested as there is no known use except for Transceiver.set_led which is itself deprecated.

Parameters:
  • led (int or list(int)) – Number of the LED or an iterable of LEDs to set the state of (0-7)
  • action (LEDAction) – State to set the LED to, either on, off or toggle
  • boards (int or list(int)) – Specifies the board to control the LEDs of. This may also be an iterable of multiple boards (in the same frame).
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.BMPGetVersion(board)

Bases: spinnman.messages.scp.abstract_messages.BMPRequest

An SCP request to read the version of software running on a core

Parameters:board (int) – The board to get the version from
Raises:SpinnmanInvalidParameterException
  • If the chip coordinates are out of range
  • If the processor is out of range
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.CheckOKResponse(operation, command)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPResponse

An SCP response to a request which returns nothing other than OK

Parameters:
  • operation (str) – The operation being performed
  • command (str or Enum or int) – The command that was sent
read_data_bytestring(data, offset)[source]

Reads the remainder of the data following the header

Parameters:
  • data (bytes) – The bytestring to read from
  • offset (int) – The offset into the data after the headers
class spinnman.messages.scp.impl.GetChipInfo(x, y, with_size=False)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

An SCP request to read the chip information from a core

Parameters:
  • x (int) – The x-coordinate of the chip to read from, between 0 and 255
  • y (int) – The y-coordinate of the chip to read from, between 0 and 255
  • with_size (bool) – Whether the size should be included in the response
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.CountState(app_id, state)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

An SCP Request to get a count of the cores in a particular state

Parameters:
  • app_id (int) – The ID of the application, between 0 and 255
  • state (CPUState) – The state to count
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.DoSync(do_sync)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

An SCP Request to control synchronization

Parameters:do_sync (bool) – Whether to synchronize or not
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.FloodFillData(nearest_neighbour_id, block_no, base_address, data, offset=0, length=None)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

A request to start a flood fill of data

Parameters:
  • nearest_neighbour_id (int) – The ID of the packet, between 0 and 127
  • block_no (int) – Which block this block is, between 0 and 255
  • base_address (int) – The base address where the data is to be loaded
  • data (bytes) – The data to load, between 4 and 256 bytes and the size must be divisible by 4
bytestring

The request as a bytestring

Return type:bytes
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.FillRequest(x, y, base_address, data, size)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

An SCP request to fill a region of memory on a chip with repeated data

Parameters:
  • x (int) – The x-coordinate of the chip to read from, between 0 and 255
  • y (int) – The y-coordinate of the chip to read from, between 0 and 255
  • base_address (int) – The positive base address to start the fill from
  • data (int) – The data to fill in the space with
  • size (int) – The number of bytes to fill in
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.FloodFillEnd(nearest_neighbour_id, app_id=0, processors=None, wait=False)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

A request to start a flood fill of data

Parameters:
  • nearest_neighbour_id (int) – The ID of the packet, between 0 and 127
  • app_id (int) – The application ID to start using the data, between 16 and 255. If not specified, no application is started
  • processors (list(int)) – A list of processors on which to start the application, each between 1 and 17. If not specified, no application is started.
  • wait (bool) – True if the binary should go into a “wait” state before executing
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.FloodFillStart(nearest_neighbour_id, n_blocks, x=None, y=None)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

A request to start a flood fill of data

Parameters:
  • nearest_neighbour_id (int) – The ID of the packet, between 0 and 127
  • n_blocks (int) – The number of blocks of data that will be sent, between 0 and 255
  • x (int) – The x-coordinate of the chip to load the data on to. If not specified, the data will be loaded on to all chips
  • y (int) – The y-coordinate of the chip to load the data on to. If not specified, the data will be loaded on to all chips
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.IPTagClear(x, y, tag)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

An SCP Request to clear an IP Tag

Parameters:
  • x (int) – The x-coordinate of a chip, between 0 and 255
  • y (int) – The y-coordinate of a chip, between 0 and 255
  • tag (int) – The tag, between 0 and 7
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.IPTagGet(x, y, tag)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

An SCP Request to get an IP tag

Parameters:
  • x (int) – The x-coordinate of a chip, between 0 and 255
  • y (int) – The y-coordinate of a chip, between 0 and 255
  • tag (int) – The tag to get details of, between 0 and 7
  • tag – The tag, between 0 and 7
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.IPTagGetInfo(x, y)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

An SCP Request information about IP tags

Parameters:
  • x (int) – The x-coordinate of a chip, between 0 and 255
  • y (int) – The y-coordinate of a chip, between 0 and 255
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.IPTagSet(x, y, host, port, tag, strip, use_sender=False)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

An SCP Request to set an IP Tag

Parameters:
  • x (int) – The x-coordinate of a chip, between 0 and 255
  • y (int) – The y-coordinate of a chip, between 0 and 255
  • or list[int] host (bytearray) – The host address, as an array of 4 bytes
  • port (int) – The port, between 0 and 65535
  • tag (int) – The tag, between 0 and 7
  • strip (bool) – if the SDP header should be striped from the packet
  • use_sender (bool) – if the sender IP address and port should be used
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.IPTagSetTTO(x, y, tag_timeout)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

An SCP request to set the transient timeout for future SCP requests

Parameters:
  • x (int) – The x-coordinate of the chip to run on, between 0 and 255
  • y (int) – The y-coordinate of the chip to run on, between 0 and 255
  • tag_timeout (IPTAG_TIME_OUT_WAIT_TIMES) – The timeout value
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.SetLED(x, y, cpu, led_states)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

A request to change the state of an SetLED

This class is currently deprecated and untested as there is no known use except for Transceiver.set_led which is itself deprecated.

Parameters:
  • x (int) – The x-coordinate of the chip, between 0 and 255
  • y (int) – The y-coordinate of the chip, between 0 and 255
  • cpu (int) – The CPU-number to use to set the SetLED.
  • led_states (dict(int,int)) – A dictionary mapping SetLED index to state with 0 being off, 1 on and 2 inverted.
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.SetPower(power_command, boards, delay=0.0, board_to_send_to=0)

Bases: spinnman.messages.scp.abstract_messages.BMPRequest

An SCP request for the BMP to power on or power off a rack of boards

Note

There is currently a bug in the BMP that means some boards don’t respond to power commands not sent to BMP 0. Thus changing the board_to_send_to parameter is not recommended!

Parameters:
  • power_command (PowerCommand) – The power command being sent
  • boards (int or list(int)) – The boards on the same backplane to power on or off
  • delay (float) – Number of seconds delay between power state changes of the different boards.
  • board_to_send_to (int) –

    The optional board to send the command to if this is to be sent to a frame of boards.

    Note

    Leave this at the default because of hardware bugs.

get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.ReadADC(board)

Bases: spinnman.messages.scp.abstract_messages.BMPRequest

SCP Request for the data from the BMP including voltages and temperature.

This class is currently deprecated and untested as there is no known use except for Transceiver.read_adc_data which is itself deprecated.

Parameters:board (int) – which board to request the ADC register from
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.ReadFPGARegister(fpga_num, register, board)

Bases: spinnman.messages.scp.abstract_messages.BMPRequest

Requests the data from a FPGA’s register

Sets up a read FPGA register request.

Parameters:
  • fpga_num (int) – FPGA number (0, 1 or 2) to communicate with.
  • register (int) – Register address to read to (will be rounded down to the nearest 32-bit word boundary).
  • board (int) – which board to request the FPGA register from
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

An SCP request to read a region of memory via a link on a chip

Parameters:
  • x (int) – The x-coordinate of the chip to read from, between 0 and 255
  • y (int) – The y-coordinate of the chip to read from, between 0 and 255
  • link (int) – The ID of the link down which to send the query
  • base_address (int) – The positive base address to start the read from
  • size (int) – The number of bytes to read, between 1 and 256
  • cpu (int) – The CPU core to use, normally 0 (or if a BMP, the board slot number)
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.ReadMemory(x, y, base_address, size, cpu=0)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

An SCP request to read a region of memory on a chip

Parameters:
  • x (int) – The x-coordinate of the chip to read from, between 0 and 255
  • y (int) – The y-coordinate of the chip to read from, between 0 and 255
  • base_address (int) – The positive base address to start the read from
  • size (int) – The number of bytes to read, between 1 and 256
Raises:

SpinnmanInvalidParameterException

  • If the chip coordinates are out of range
  • If the base address is not a positive number
  • If the size is out of range

get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.ReverseIPTagSet(x, y, destination_x, destination_y, destination_p, port, tag, sdp_port)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

An SCP Request to set an IP Tag

Parameters:
  • x (int) – The x-coordinate of a chip, between 0 and 255
  • y (int) – The y-coordinate of a chip, between 0 and 255
  • destination_x (int) – The x-coordinate of the destination chip, between 0 and 255
  • destination_y (int) – The y-coordinate of the destination chip, between 0 and 255
  • destination_p (int) – The ID of the destination processor, between 0 and 17
  • port (int) – The port, between 0 and 65535
  • tag (int) – The tag, between 0 and 7
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.RouterAlloc(x, y, app_id, n_entries)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

An SCP Request to allocate space for routing entries

Parameters:
  • x (int) – The x-coordinate of the chip to allocate on, between 0 and 255
  • y (int) – The y-coordinate of the chip to allocate on, between 0 and 255
  • app_id (int) – The ID of the application, between 0 and 255
  • n_entries (int) – The number of entries to allocate
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.RouterClear(x, y)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

A request to clear the router on a chip

Parameters:
  • x (int) – The x-coordinate of the chip, between 0 and 255
  • y (int) – The y-coordinate of the chip, between 0 and 255
Raises:

SpinnmanInvalidParameterException

  • If x is out of range
  • If y is out of range

get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.RouterInit(x, y, n_entries, table_address, base_address, app_id)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

A request to initialize the router on a chip

Parameters:
  • x (int) – The x-coordinate of the chip, between 0 and 255
  • y (int) – The y-coordinate of the chip, between 0 and 255
  • n_entries (int) – The number of entries in the table, more than 0
  • table_address (int) – The allocated table address
  • base_address (int) – The base_address containing the entries
  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.
Raises:

SpinnmanInvalidParameterException

  • If x is out of range
  • If y is out of range
  • If n_entries is 0 or less
  • If table_address is not positive
  • If base_address is not positive

get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.SDRAMAlloc(x, y, app_id, size, tag=None, retry_tag=True)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

An SCP Request to allocate space in the SDRAM space

Parameters:
  • x (int) – The x-coordinate of the chip to allocate on, between 0 and 255
  • y (int) – The y-coordinate of the chip to allocate on, between 0 and 255
  • app_id (int) – The ID of the application, between 0 and 255
  • size (int) – The size in bytes of memory to be allocated
  • tag (int) – The tag for the SDRAM, a 8-bit (chip-wide) tag that can be looked up by a SpiNNaker application to discover the address of the allocated block. If 0 then no tag is applied.
  • retry_tag (bool) – If a tag is used, add a safety check to retry the tag. This can avoid issues with re-allocating memory on a retry message.
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.SDRAMDeAlloc(x, y, app_id, base_address=None)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

An SCP Request to free space in the SDRAM

Parameters:
  • x (int) – The x-coordinate of the chip to allocate on, between 0 and 255
  • y (int) – The y-coordinate of the chip to allocate on, between 0 and 255
  • app_id (int) – The ID of the application, between 0 and 255
  • base_address (int or None) – The start address in SDRAM to which the block needs to be deallocated, or none if deallocating via app_id
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.SendSignal(app_id, signal)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

An SCP Request to send a signal to cores

Parameters:
  • app_id (int) – The ID of the application, between 0 and 255
  • signal (Signal) – The signal to send
Raises:

SpinnmanInvalidParameterException – If app_id is out of range

get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.GetVersion(x, y, p)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

An SCP request to read the version of software running on a core

Parameters:
  • x (int) – The x-coordinate of the chip to read from, between 0 and 255
  • y (int) – The y-coordinate of the chip to read from, between 0 and 255
  • p (int) – The ID of the processor to read the version from, between 0 and 31
Raises:

SpinnmanInvalidParameterException

  • If the chip coordinates are out of range
  • If the processor is out of range

get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.WriteFPGARegister(fpga_num, addr, value, board)

Bases: spinnman.messages.scp.abstract_messages.BMPRequest

A request for writing a word to a FPGA (SPI) register.

See the SpI/O project’s spinnaker_fpga design’s README for a listing of FPGA registers. The SpI/O project can be found on GitHub at: https://github.com/SpiNNakerManchester/spio/

Parameters:
  • fpga_num (int) – FPGA number (0, 1 or 2) to communicate with.
  • addr (int) – Register address to read or write to (will be rounded down to the nearest 32-bit word boundary).
  • value (int) – A 32-bit int value to write to the register
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.FixedRouteRead(x, y, app_id)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

Gets a fixed route entry

Parameters:
  • x (int) – The x-coordinate of the chip, between 0 and 255, this is not checked due to speed restrictions
  • y (int) – The y-coordinate of the chip, between 0 and 255, this is not checked due to speed restrictions
  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.
Raises:

SpinnmanInvalidParameterException

  • If x is out of range
  • If y is out of range

get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

A request to write memory on a neighbouring chip

Parameters:
  • x (int) – The x-coordinate of the chip whose neighbour will be written to, between 0 and 255
  • y (int) – The y-coordinate of the chip whose neighbour will be written to, between 0 and 255
  • cpu (int) – The CPU core to use, normally 0 (or if a BMP, the board slot number)
  • link (int) – The link number to write to between 0 and 5 (or if a BMP, the FPGA between 0 and 2)
  • base_address (int) – The base_address to start writing to
  • data (bytes) – Up to 256 bytes of data to write
bytestring

The request as a bytestring

Return type:bytes
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.WriteMemory(x, y, base_address, data, cpu=0)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

A request to write memory on a chip

Parameters:
  • x (int) – The x-coordinate of the chip, between 0 and 255; this is not checked due to speed restrictions
  • y (int) – The y-coordinate of the chip, between 0 and 255; this is not checked due to speed restrictions
  • base_address (int) – The base_address to start writing to the base address is not checked to see if its not valid
  • data (bytearray or bytes) – between 1 and 256 bytes of data to write; this is not checked due to speed restrictions
bytestring

The request as a bytestring

Return type:bytes
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.messages.scp.impl.FixedRouteInit(x, y, entry, app_id)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

Sets a fixed route entry

Parameters:
  • x (int) – The x-coordinate of the chip, between 0 and 255, this is not checked due to speed restrictions
  • y (int) – The y-coordinate of the chip, between 0 and 255, this is not checked due to speed restrictions
  • entry (int) – the fixed route entry converted for writing
  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.
Raises:

SpinnmanInvalidParameterException

  • If x is out of range
  • If y is out of range

get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
Submodules
spinnman.messages.scp.scp_request_header module
spinnman.messages.scp.scp_response_header module
Module contents
class spinnman.messages.scp.SCPRequestHeader(command, sequence=0)

Bases: object

Represents the header of an SCP Request Each optional parameter in the constructor can be set to a value other than None once, after which it is immutable. It is an error to set a parameter that is not currently None.

Parameters:
  • command (SCPCommand) – The SCP command
  • sequence (int) – The number of the SCP packet in order of all packets sent or received, between 0 and 65535
Raises:

SpinnmanInvalidParameterException – If one of the parameters is incorrect

bytestring

The header as a bytestring

Return type:bytes
command

The command of the SCP packet

Return type:SCPCommand
sequence

The sequence number of the SCP packet, between 0 and 65535

Return type:int
class spinnman.messages.scp.SCPResponseHeader(result=None, sequence=None)

Bases: object

Represents the header of an SCP Response

Parameters:
static from_bytestring(data, offset)[source]

Read a header from a bytestring

Parameters:
  • data (bytes) – The bytestring to read from
  • offset (int) –
result

The result of the SCP response

Returns:The result
Return type:SCPResult
sequence

The sequence number of the SCP response

Returns:The sequence number of the packet, between 0 and 65535
Return type:int
spinnman.messages.sdp package
Submodules
spinnman.messages.sdp.sdp_flag module
spinnman.messages.sdp.sdp_header module
spinnman.messages.sdp.sdp_message module
Module contents
class spinnman.messages.sdp.SDPFlag(value, doc='')

Bases: enum.Enum

SDPFlag for the message

REPLY_EXPECTED = 135
REPLY_EXPECTED_NO_P2P = 167
REPLY_NOT_EXPECTED = 7
REPLY_NOT_EXPECTED_NO_P2P = 39
class spinnman.messages.sdp.SDPHeader(flags=None, tag=None, destination_port=None, destination_cpu=None, destination_chip_x=None, destination_chip_y=None, source_port=None, source_cpu=None, source_chip_x=None, source_chip_y=None)

Bases: object

Represents the header of an SDP message. Each optional parameter in the constructor can be set to a value other than None once, after which it is immutable. It is an error to set a parameter that is not currently None.

Parameters:
  • flags (SDPFlag) – Any flags for the packet
  • tag (int) – The IP tag of the packet between 0 and 255, or None if it is to be set later
  • destination_port (int) – The destination port of the packet between 0 and 7
  • destination_cpu (int) – The destination processor ID within the chip between 0 and 31
  • destination_chip_x (int) – The x-coordinate of the destination chip between 0 and 255
  • destination_chip_y (int) – The y-coordinate of the destination chip between 0 and 255
  • source_port (int) – The source port of the packet between 0 and 7, or None if it is to be set later
  • source_cpu (int) – The source processor ID within the chip between 0 and 31, or None if it is to be set later
  • source_chip_x (int) – The x-coordinate of the source chip between 0 and 255, or None if it is to be set later
  • source_chip_y (int) – The y-coordinate of the source chip between 0 and 255, or None if it is to be set later
bytestring

The header as a bytestring

Return type:bytes
destination_chip_x

The x-coordinate of the destination chip of the packet, between 0 and 255 (settable)

Return type:int
destination_chip_y

The y-coordinate of the destination chip of the packet, between 0 and 255 (settable)

Return type:int
destination_cpu

The core on the destination chip, between 0 and 31 (settable)

Return type:int
destination_port

The destination SDP port of the packet, between 0 and 7 (settable)

Return type:int
flags

The flags of the packet (settable)

Return type:SDPFlag
static from_bytestring(data, offset)[source]

Read the header from a bytestring.

Parameters:
  • data (bytes or bytearray) – The bytestring to read the header from
  • offset (int) – The offset into the data from which to start reading
get_physical_cpu_id()[source]
source_chip_x

The x-coordinate of the source chip of the packet, between 0 and 255 (settable)

Return type:int
source_chip_y

The y-coordinate of the source chip of the packet, between 0 and 255 (settable)

Return type:int
source_cpu

The core on the source chip, between 0 and 31 (settable)

Return type:int
source_port

The source SDP port of the packet, between 0 and 7 (settable)

Return type:int
tag

The tag of the packet, between 0 and 255 (settable)

Return type:int
class spinnman.messages.sdp.SDPMessage(sdp_header, data=None, offset=0)

Bases: object

Wraps up an SDP message with a header and optional data.

Parameters:
  • sdp_header (SDPHeader) – The header of the message
  • data (bytes or bytearray or None) – The data of the SDP packet, or None if no data
  • offset (int) – The offset where the valid data starts
bytestring

The bytestring of the message

Return type:bytes
data

The data in the packet

Return type:bytes or bytearray or None
static from_bytestring(data, offset)[source]
Parameters:
Return type:

SDPMessage

offset

The offset where the valid data starts

Return type:int
sdp_header

The header of the packet

Return type:SDPHeader
spinnman.messages.spinnaker_boot package
Subpackages
spinnman.messages.spinnaker_boot.boot_data package
Module contents

This package contains no Python code.

Submodules
spinnman.messages.spinnaker_boot.spinnaker_boot_message module
spinnman.messages.spinnaker_boot.spinnaker_boot_messages module
spinnman.messages.spinnaker_boot.spinnaker_boot_op_code module
spinnman.messages.spinnaker_boot.system_variable_boot_values module
class spinnman.messages.spinnaker_boot.system_variable_boot_values.SystemVariableBootValues(hardware_version=None, led_0=None)[source]

Bases: object

Default values of the system variables that get passed to SpiNNaker during boot

bytestring
set_value(system_variable_definition, value)[source]
Module contents
class spinnman.messages.spinnaker_boot.SpinnakerBootMessage(opcode, operand_1, operand_2, operand_3, data=None, offset=0)

Bases: object

A message used for booting the board

Parameters:
  • opcode (SpinnakerBootOpCode) – The operation of this packet
  • operand_1 (int) – The first operand
  • operand_2 (int) – The second operand
  • operand_3 (int) – The third operand
  • data (bytes or bytearray) – The optional data, up to 256 words
  • offset (int) – The offset of the valid data
Raises:

SpinnmanInvalidParameterException – If the opcode is not a valid value

bytestring

The message as a bytestring

Return type:bytes
data

The data, or None if no data

Return type:bytes or bytearray
static from_bytestring(data, offset)[source]
Parameters:
Return type:

SpinnakerBootMessage

opcode

The operation of this packet

Return type:SpinnakerBootOpCode
operand_1

The first operand

Return type:int
operand_2

The second operand

Return type:int
operand_3

The third operand

Return type:int
class spinnman.messages.spinnaker_boot.SpinnakerBootMessages(board_version=None, extra_boot_values=None)

Bases: object

Represents a set of boot messages to be sent to boot the board

Builds the boot messages needed to boot the SpiNNaker machine

Parameters:
Raises:
messages

An iterable of message to be sent.

Return type:iterable(SpinnakerBootMessage)
class spinnman.messages.spinnaker_boot.SpinnakerBootOpCode(value, doc='')

Bases: enum.Enum

Boot message Operation Codes

FLOOD_FILL_BLOCK = 3
FLOOD_FILL_CONTROL = 5
FLOOD_FILL_START = 1
HELLO = 65
class spinnman.messages.spinnaker_boot.SystemVariableDefinition(offset, data_type, default, array_size, doc)

Bases: enum.Enum

Defines the system variables available.

Parameters:
  • data_type (_DataType) – The data type of the variable
  • offset (int) – The offset from the start of the system variable structure where the variable is found
  • default (object) – The default value assigned to the variable if not overridden
  • array_size (int or None) – The length of the array, or None if not an array
allocated_tag_table_address = _Definition(offset=220, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The address of the allocated tag table')
app_data_table_address = _Definition(offset=228, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The address of the application data table')
array_size
board_info = _Definition(offset=248, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='A pointer to the board information structure')
board_test_flags = _Definition(offset=103, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='Board testing flags')
boot_signature = _Definition(offset=92, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The boot signature')
clock_divisor = _Definition(offset=14, data_type=<_DataType.BYTE: 1>, default=51, array_size=None, doc='The clock divisors for system & router clocks')
clock_drift = _Definition(offset=56, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The clock drift')
clock_milliseconds = _Definition(offset=16, data_type=<_DataType.LONG: 8>, default=0, array_size=None, doc='The time since startup in milliseconds')
cpu_clock_mhz = _Definition(offset=36, data_type=<_DataType.SHORT: 2>, default=200, array_size=None, doc='The CPU clock frequency in MHz')
cpu_information_base_address = _Definition(offset=204, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The base address of the CPU information blocks')
data_type
debug_x = _Definition(offset=5, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='The x-coordinate of the chip to send debug messages to')
debug_y = _Definition(offset=4, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='The y-coordinate of the chip to send debug messages to')
default
ethernet_ip_address = _Definition(offset=240, data_type=<_DataType.BYTE_ARRAY: 16>, default=b'\x00\x00\x00\x00', array_size=4, doc='The IP address of the chip')
first_free_router_entry = _Definition(offset=224, data_type=<_DataType.SHORT: 2>, default=0, array_size=None, doc='The ID of the first free router entry')
fixed_route_copy = _Definition(offset=244, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='A (virtual) copy of the router FR register')
hardware_version = _Definition(offset=10, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='The version of the hardware in use')
iobuf_size = _Definition(offset=80, data_type=<_DataType.INT: 4>, default=16384, array_size=None, doc='The size of the iobuf buffer in bytes')
is_ethernet_available = _Definition(offset=11, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='Indicates if Ethernet is available on this chip')
is_peer_to_peer_available = _Definition(offset=6, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='Indicates if peer-to-peer is working on the chip')
is_root_chip = _Definition(offset=64, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='Indicates if this is the root chip')
last_biff_id = _Definition(offset=102, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='Last ID used in BIFF packet')
led_0 = _Definition(offset=48, data_type=<_DataType.INT: 4>, default=1, array_size=None, doc='The first part of the LED definitions')
led_1 = _Definition(offset=52, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The last part of the LED definitions')
led_half_period_10_ms = _Definition(offset=43, data_type=<_DataType.BYTE: 1>, default=1, array_size=None, doc='The LED half-period in 10 ms units, or 1 to show load')
lock = _Definition(offset=100, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='The lock')
log_peer_to_peer_sequence_length = _Definition(offset=13, data_type=<_DataType.BYTE: 1>, default=4, array_size=None, doc='Log (base 2) of the peer-to-peer sequence length')
ltpc_period = _Definition(offset=26, data_type=<_DataType.SHORT: 2>, default=0, array_size=None, doc='')
monitor_mailbox_flags = _Definition(offset=236, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The monitor incoming mailbox flags')
n_active_peer_to_peer_addresses = _Definition(offset=226, data_type=<_DataType.SHORT: 2>, default=0, array_size=None, doc='The number of active peer-to-peer addresses')
n_scamp_working_cores = _Definition(offset=189, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='The number of SCAMP working cores')
n_shared_message_buffers = _Definition(offset=65, data_type=<_DataType.BYTE: 1>, default=7, array_size=None, doc='The number of shared message buffers')
n_working_cores = _Definition(offset=188, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='The number of working cores')
nearest_ethernet_x = _Definition(offset=9, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='The y-coordinate of the nearest chip with Ethernet')
nearest_ethernet_y = _Definition(offset=8, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='The x-coordinate of the nearest chip with Ethernet')
nearest_neighbour_delay_us = _Definition(offset=66, data_type=<_DataType.BYTE: 1>, default=20, array_size=None, doc='The delay between nearest-neighbour packets in microseconds')
nearest_neighbour_forward = _Definition(offset=40, data_type=<_DataType.BYTE: 1>, default=63, array_size=None, doc='Nearest-Neighbour forward parameter')
nearest_neighbour_last_id = _Definition(offset=7, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='The last ID used in nearest neighbour transaction')
nearest_neighbour_memory_pointer = _Definition(offset=96, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The memory pointer for nearest neighbour global operations')
nearest_neighbour_retry = _Definition(offset=41, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='Nearest-Neighbour retry parameter')
netinit_bc_wait_time = _Definition(offset=44, data_type=<_DataType.BYTE: 1>, default=50, array_size=None, doc='The time to wait after last BC during network initialisation in 10 ms units')
netinit_phase = _Definition(offset=45, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='The phase of boot process (see enum netinit_phase_e)')
offset
p2p_b_repeats = _Definition(offset=12, data_type=<_DataType.BYTE: 1>, default=4, array_size=None, doc='Number of times to send out P2PB packets')
p2p_root_x = _Definition(offset=47, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='The x-coordinate of the chip from which the system was booted')
p2p_root_y = _Definition(offset=46, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='The y-coordinate of the chip from which the system was booted')
padding_2 = _Definition(offset=68, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='A word of padding')
padding_3 = _Definition(offset=190, data_type=<_DataType.SHORT: 2>, default=0, array_size=None, doc='A short of padding')
padding_4 = _Definition(offset=252, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='A word of padding')
peer_to_peer_hop_table_address = _Definition(offset=216, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The address of the peer-to-peer hop tables')
physical_to_virtual_core_map = _Definition(offset=148, data_type=<_DataType.BYTE_ARRAY: 16>, default=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', array_size=20, doc='The physical core ID to virtual core ID map')
random_seed = _Definition(offset=60, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The random seed')
router_table_copy_address = _Definition(offset=212, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The address of the copy of the routing tables')
router_time_phase_timer = _Definition(offset=32, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The router time-phase timer')
sdram_base_address = _Definition(offset=192, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The base address of SDRAM')
sdram_clock_frequency_mhz = _Definition(offset=38, data_type=<_DataType.SHORT: 2>, default=130, array_size=None, doc='The SDRAM clock frequency in MHz')
sdram_heap_address = _Definition(offset=76, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The base address of the user SDRAM heap')
shared_message_buffer_address = _Definition(offset=232, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The address of the shared message buffers')
shared_message_count_in_use = _Definition(offset=108, data_type=<_DataType.SHORT: 2>, default=0, array_size=None, doc='The number of shared message buffers in use')
shared_message_first_free_address = _Definition(offset=104, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='Pointer to the first free shared message buffer')
shared_message_maximum_used = _Definition(offset=110, data_type=<_DataType.SHORT: 2>, default=0, array_size=None, doc='The maximum number of shared message buffers used')
software_watchdog_count = _Definition(offset=67, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='The number of watch dog timeouts before an error is raised')
status_map = _Definition(offset=128, data_type=<_DataType.BYTE_ARRAY: 16>, default=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', array_size=20, doc='The status map set during SCAMP boot')
system_buffer_words = _Definition(offset=88, data_type=<_DataType.INT: 4>, default=32768, array_size=None, doc='The size of the system buffer in words')
system_ram_base_address = _Definition(offset=196, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The base address of System RAM')
system_ram_heap_address = _Definition(offset=72, data_type=<_DataType.INT: 4>, default=1024, array_size=None, doc='The base address of the system SDRAM heap')
system_sdram_base_address = _Definition(offset=200, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The base address of System SDRAM')
system_sdram_bytes = _Definition(offset=84, data_type=<_DataType.INT: 4>, default=8388608, array_size=None, doc='The size of the system SDRAM in bytes')
system_sdram_heap_address = _Definition(offset=208, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The base address of the system SDRAM heap')
time_milliseconds = _Definition(offset=24, data_type=<_DataType.SHORT: 2>, default=0, array_size=None, doc='The number of milliseconds in the current second')
time_phase_scale = _Definition(offset=15, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='The time-phase scaling factor')
unix_timestamp = _Definition(offset=28, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The time in seconds since midnight, 1st January 1970')
user_temp_0 = _Definition(offset=112, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The first user variable')
user_temp_1 = _Definition(offset=116, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The second user variable')
user_temp_2 = _Definition(offset=120, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The third user variable')
user_temp_4 = _Definition(offset=124, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The fourth user variable')
virtual_to_physical_core_map = _Definition(offset=168, data_type=<_DataType.BYTE_ARRAY: 16>, default=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', array_size=20, doc='The virtual core ID to physical core ID map')
x = _Definition(offset=1, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='The x-coordinate of the chip')
x_size = _Definition(offset=3, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='The number of chips in the x-dimension')
y = _Definition(offset=0, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='The y-coordinate of the chip')
y_size = _Definition(offset=2, data_type=<_DataType.BYTE: 1>, default=0, array_size=None, doc='The number of chips in the y-dimension')
Submodules
spinnman.messages.multicast_message module
class spinnman.messages.multicast_message.MulticastMessage(key, payload=None)[source]

Bases: object

A SpiNNaker Multicast message.

A multicast message has a key (determining the target locations) and an optional payload.

Parameters:
  • key (int) – The key of the packet
  • payload (int) – The optional payload of the packet
key

The key of the packet

Returns:The key
Return type:int
payload

The payload of the packet if there is one, or None if there is no payload

Return type:int or None
Module contents
spinnman.model package
Subpackages
spinnman.model.enums package
Submodules
spinnman.model.enums.cpu_state module
spinnman.model.enums.diagnostic_filter_default_routing_status module
spinnman.model.enums.diagnostic_filter_destination module
spinnman.model.enums.diagnostic_filter_emergency_routing_status module
spinnman.model.enums.diagnostic_filter_packet_type module
spinnman.model.enums.diagnostic_filter_payload_status module
spinnman.model.enums.diagnostic_filter_source module
spinnman.model.enums.mailbox_command module
spinnman.model.enums.p2p_table_route module
spinnman.model.enums.router_error module
spinnman.model.enums.run_time_error module
Module contents
class spinnman.model.enums.CPUState(value, doc='')

Bases: enum.Enum

SARK CPU States

CPU_STATE_12 = 12
CPU_STATE_13 = 13
CPU_STATE_14 = 14
C_MAIN = 6
DEAD = 0
FINISHED = 11
IDLE = 15
INITIALISING = 4
PAUSED = 10
POWERED_DOWN = 1
READY = 5
RUNNING = 7
RUN_TIME_EXCEPTION = 2
SYNC0 = 8
SYNC1 = 9
WATCHDOG = 3
class spinnman.model.enums.DiagnosticFilterDefaultRoutingStatus(value, doc='')

Bases: enum.Enum

Default routing flags for the diagnostic filters. Note that only one has to match for the counter to be incremented

DEFAULT_ROUTED = 0
NON_DEFAULT_ROUTED = 1
class spinnman.model.enums.DiagnosticFilterDestination(value, doc='')

Bases: enum.Enum

Destination flags for the diagnostic filters. Note that only one has to match for the counter to be incremented

DUMP = 0
LOCAL = 1
LOCAL_MONITOR = 2
class spinnman.model.enums.DiagnosticFilterEmergencyRoutingStatus(value, doc='')

Bases: enum.Enum

Emergency routing status flags for the diagnostic filters. Note that only one has to match for the counter to be incremented

FIRST_STAGE = 2
FIRST_STAGE_COMBINED = 1
NORMAL = 0
SECOND_STAGE = 3
class spinnman.model.enums.DiagnosticFilterPacketType(value, doc='')

Bases: enum.Enum

Packet type flags for the diagnostic filters. Note that only one has to match for the counter to be incremented

FIXED_ROUTE = 3
MULTICAST = 0
NEAREST_NEIGHBOUR = 2
POINT_TO_POINT = 1
class spinnman.model.enums.DiagnosticFilterPayloadStatus(value, doc='')

Bases: enum.Enum

Payload flags for the diagnostic filters. Note that only one has to match for the counter to be incremented

WITHOUT_PAYLOAD = 1
WITH_PAYLOAD = 0
class spinnman.model.enums.DiagnosticFilterSource(value, doc='')

Bases: enum.Enum

Source flags for the diagnostic filters. Note that only one has to match for the counter to be incremented

LOCAL = 0
NON_LOCAL = 1
class spinnman.model.enums.MailboxCommand(value, doc='')

Bases: enum.Enum

Commands sent between an application and the monitor processor

SHM_CMD = 4
SHM_IDLE = 0
SHM_MSG = 1
SHM_NOP = 2
SHM_SIGNAL = 3
class spinnman.model.enums.P2PTableRoute(value, doc='')

Bases: enum.Enum

P2P Routing table routes

EAST = 0
MONITOR = 7
NONE = 6
NORTH = 2
NORTH_EAST = 1
SOUTH = 5
SOUTH_WEST = 4
WEST = 3
class spinnman.model.enums.RouterError(value, doc='')

Bases: enum.Enum

Router error flags

ERROR = 2147483648
FRAMING = 268435456
OVERFLOW = 1073741824
PARITY = 536870912
TIMESTAMP = 134217728
class spinnman.model.enums.RunTimeError(value, doc='')

Bases: enum.Enum

SARK Run time errors

ABORT = 9
API = 19
DABT = 5
DIVBY0 = 11
ENABLE = 15
EVENT = 12
FIQ = 7
IOBUF = 14
IRQ = 6
MALLOC = 10
NONE = 0
NULL = 16
PABT = 4
PKT = 17
RESET = 1
SARK_VERSRION_INCORRECT = 20
SVC = 3
SWERR = 13
TIMER = 18
UNDEF = 2
VIC = 8
Submodules
spinnman.model.adc_info module
spinnman.model.bmp_connection_data module
spinnman.model.chip_info module
spinnman.model.chip_summary_info module
spinnman.model.cpu_info module
spinnman.model.cpu_infos module
spinnman.model.diagnostic_filter module
spinnman.model.executable_targets module
spinnman.model.heap_element module
spinnman.model.io_buffer module
spinnman.model.machine_dimensions module
spinnman.model.p2p_table module
spinnman.model.router_diagnostics module
spinnman.model.version_info module
Module contents
class spinnman.model.ADCInfo(adc_data, offset)

Bases: object

Container for the ADC data thats been retrieved from an FPGA.

Parameters:adc_data (bytes) – bytes from an SCP packet containing ADC information
Raises:SpinnmanInvalidParameterException – If the message does not contain valid ADC information
fan_0

fan 0

Return type:float or None
fan_1

fan 1

Return type:float or None
temp_btm

temperature bottom

Return type:float
temp_ext_0

temperature external 0

Return type:float or None
temp_ext_1

temperature external 1

Return type:float or None
temp_top

temperature top

Return type:float
voltage_1_2a

Actual voltage of the 1.2V a supply rail

Return type:float
voltage_1_2b

Actual voltage of the 1.2V b supply rail

Return type:float
voltage_1_2c

Actual voltage of the 1.2V c supply rail

Return type:float
voltage_1_8

Actual voltage of the 1.8V supply rail

Return type:float
voltage_3_3

Actual voltage of the 3.3V supply rail

Return type:float
voltage_supply

Actual voltage of the main power supply (nominally 12V).

Return type:float
class spinnman.model.BMPConnectionData(cabinet, frame, ip_address, boards, port_num)

Bases: object

Contains the details of a BMP connection

boards

The boards to be addressed.

Return type:iterable(int)
cabinet

Get the cabinet number.

Return type:int
frame

Get the frame number.

Return type:int
ip_address

Get the IP address of the BMP.

Return type:str
port_num

The port number associated with this BMP connection.

Returns:The port number
class spinnman.model.ChipInfo(system_data, offset)

Bases: object

Represents the system variables for a chip, received from the chip SDRAM

Parameters:
  • system_data (bytes) – An bytestring retrieved from SDRAM on the board
  • offset (int) – The offset into the bytestring where the actual data starts
Raises:

SpinnmanInvalidParameterException – If the data doesn’t contain valid system data information

cpu_clock_mhz

The speed of the CPU clock in MHz

Return type:int
cpu_information_base_address

The base address of the CPU information structure

Return type:int
first_free_router_entry

The ID of the first free routing entry on the chip

Return type:int
iobuf_size

The size of the iobuf buffers in bytes

Return type:int
ip_address

The IP address of the chip, or None if no Ethernet

Return type:str
is_ethernet_available

True if the Ethernet is running on this chip, False otherwise

Return type:bool

The links that are available on the chip

Return type:iterable(int)
nearest_ethernet_x

The x-coordinate of the nearest chip with Ethernet

Return type:int
nearest_ethernet_y

The y-coordinate of the nearest chip with Ethernet

Return type:int
physical_to_virtual_core_map

The physical core ID to virtual core ID map; entries with a value of 0xFF are non-operational cores

Return type:bytearray
router_table_copy_address()[source]

The address of the copy of the router table

Return type:int
sdram_base_address

The base address of the user region of SDRAM on the chip

Return type:int
sdram_heap_address

The address of the base of the heap in SDRAM

Return type:int
system_ram_heap_address

The address of the base of the heap in system RAM

Return type:int
system_sdram_base_address

The base address of the System SDRAM region on the chip

Return type:int
virtual_core_ids

A list of available cores by virtual core ID (including the monitor)

Return type:iterable(int)
virtual_to_physical_core_map

The virtual core ID to physical core ID map; entries with a value of 0xFF are non-operational cores

Return type:bytearray
x

The x-coordinate of the chip

Return type:int
x_size

The number of chips in the x-dimension

Return type:int
y

The y-coordinate of the chip

Return type:int
y_size

The number of chips in the y-dimension

Return type:int
class spinnman.model.ChipSummaryInfo(chip_summary_data, offset, x, y)

Bases: object

Represents the chip summary information read via an SCP command

Parameters:
  • chip_summary_data (bytes) – The data from the SCP response
  • offset (int) – The offset into the data where the data starts
  • x (int) – The x-coordinate of the chip that this data is from
  • y (int) – The y-coordinate of the chip that this data is from
clear_ethernet_ip_address()[source]

Forces the Ethernet IP address to None, in case of an errant chip

core_states

The state of the cores on the chip (list of one per core)

Return type:list(CPUState)
ethernet_ip_address

The IP address of the Ethernet if up, or None if not

Return type:str
is_ethernet_available

Determines if the Ethernet connection is available on this chip

Return type:bool
largest_free_sdram_block

The size of the largest block of free SDRAM in bytes

Return type:int
largest_free_sram_block

The size of the largest block of free SRAM in bytes

Return type:int
n_cores

The number of cores working on the chip (including monitors)

Return type:int
n_free_multicast_routing_entries

The number of multicast routing entries free on this chip

Return type:int
nearest_ethernet_x

The x coordinate of the nearest Ethernet chip

Return type:int
nearest_ethernet_y

The y coordinate of the nearest Ethernet chip

Return type:int

The link to the parent of the chip in the tree of chips from root

Return type:int

The IDs of the working links outgoing from this chip

Return type:list(int)
x

The x-coordinate of the chip that this data is from

Return type:int
y

The y-coordinate of the chip that this data is from

Return type:int
class spinnman.model.CPUInfo(x, y, p, cpu_data, offset)

Bases: object

Represents information about the state of a CPU.

Parameters:
  • x (int) – The x-coordinate of a chip
  • y (int) – The y-coordinate of a chip
  • p (int) – The ID of a core on the chip
  • cpu_data (bytes) – A bytestring received from SDRAM on the board
  • offset (int) –
application_id

The ID of the application running on the core.

Returns:The ID of the application
Return type:int
application_mailbox_command

The command currently in the mailbox being sent from the monitor processor to the application.

Returns:The command
Return type:MailboxCommand
application_mailbox_data_address

The address of the data in SDRAM for the application mailbox.

Returns:The address of the data
Return type:int
application_name

The name of the application running on the core.

Returns:The name of the application
Return type:str
iobuf_address

The address of the IOBUF buffer in SDRAM.

Returns:The address
Return type:int

The current link register value (LR).

Returns:The LR value
Return type:int
monitor_mailbox_command

The command currently in the mailbox being sent from the application to the monitor processor.

Returns:The command
Return type:MailboxCommand
monitor_mailbox_data_address

The address of the data in SDRAM of the monitor mailbox.

Returns:The address of the data
Return type:int
p

The ID of the core on the chip.

Returns:The ID of the core
Return type:int
physical_cpu_id

The physical ID of this processor.

Returns:The physical ID of the processor
Return type:int
processor_state_register

The value in the processor state register (PSR).

Returns:The PSR value
Return type:int
registers

The current register values (r0 - r7).

Returns:An array of 8 values, one for each register
Return type:list(int)
run_time_error

The reason for a run time error.

Returns:The run time error
Return type:RunTimeError
software_error_count

The number of software errors counted.

Returns:The number of software errors
Return type:int
software_source_filename_address

The address of the filename of the software source.

Returns:The filename
Return type:str
software_source_line_number

The line number of the software source.

Returns:The line number
Return type:int
software_version

The software version.

Returns:The software version
Return type:int
stack_pointer

The current stack pointer value (SP).

Returns:The SP value
Return type:int
state

The current state of the core.

Returns:The state of the core
Return type:CPUState
time

The time at which the application started.

Returns:The time in seconds since 00:00:00 on the 1st January 1970
Return type:int
user

The current user values (user0 - user3).

Returns:An array of 4 values, one for each user value
Return type:list(int)
x

The x-coordinate of the chip containing the core.

Returns:The x-coordinate of the chip
Return type:int
y

The y-coordinate of the chip containing the core.

Returns:The y-coordinate of the chip
Return type:int
class spinnman.model.CPUInfos

Bases: object

A set of CPU information objects.

add_processor(x, y, processor_id, cpu_info)[source]

Add a processor on a given chip to the set.

Parameters:
  • x (int) – The x-coordinate of the chip
  • y (int) – The y-coordinate of the chip
  • processor_id (int) – A processor ID
  • cpu_info (CPUInfo) – The CPU information for the core
cpu_infos

The one per core core info.

Returns:iterable of x,y,p core info
get_cpu_info(x, y, p)[source]

Get the information for the given core on the given chip

is_core(x, y, p)[source]

Determine if there is a CPU Info for x, y, p

items()[source]
iteritems()[source]

Get an iterable of (x, y, p), cpu_info

iterkeys()[source]

Get an iterable of (x, y, p).

itervalues()[source]

Get an iterable of cpu_info.

keys()[source]
values()[source]
class spinnman.model.DiagnosticFilter(enable_interrupt_on_counter_event, match_emergency_routing_status_to_incoming_packet, destinations, sources, payload_statuses, default_routing_statuses, emergency_routing_statuses, packet_types)

Bases: object

A router diagnostic counter filter, which counts packets passing through the router with certain properties. The counter will be incremented so long as the packet matches one of the values in each field i.e. one of each of the destinations, sources, payload_statuses, default_routing_statuses, emergency_routing_statuses and packet_types.

Parameters:
  • enable_interrupt_on_counter_event (bool) – Indicates whether an interrupt should be raised when this rule matches
  • match_emergency_routing_status_to_incoming_packet (bool) – Indicates whether the emergency routing statuses should be matched against packets arriving at this router (if True), or if they should be matched against packets leaving this router (if False)
  • destinations (list(DiagnosticFilterDestination)) – Increment the counter if one or more of the given destinations match
  • sources (list(DiagnosticFilterSource)) – Increment the counter if one or more of the given sources match (or None or empty list to match all)
  • payload_statuses (list(DiagnosticFilterPayloadStatus)) – Increment the counter if one or more of the given payload statuses match (or None or empty list to match all)
  • default_routing_statuses (list(DiagnosticFilterDefaultRoutingStatus)) – Increment the counter if one or more of the given default routing statuses match (or None or empty list to match all)
  • emergency_routing_statuses (list(DiagnosticFilterEmergencyRoutingStatus)) – Increment the counter if one or more of the given emergency routing statuses match (or None or empty list to match all)
  • packet_types (list(DiagnosticFilterPacketType)) – Increment the counter if one or more of the given packet types match (or None or empty list to match all)
default_routing_statuses
destinations
emergency_routing_statuses
enable_interrupt_on_counter_event
filter_word

A word of data that can be written to the router to set up the filter

match_emergency_routing_status_to_incoming_packet
packet_types
payload_statuses
static read_from_int(int_value)[source]
sources
class spinnman.model.ExecutableTargets

Bases: object

Encapsulate the binaries and cores on which to execute them.

add_processor(binary, chip_x, chip_y, chip_p, executable_type=None)[source]

Add a processor to the executable targets

Parameters:
  • binary (str) – the binary path for executable
  • chip_x (int) – the coordinate on the machine in terms of x for the chip
  • chip_y (int) – the coordinate on the machine in terms of y for the chip
  • chip_p (int) – the processor ID to place this executable on
  • executable_type (ExecutableType) – the executable type for locating n cores of
add_subsets(binary, subsets, executable_type=None)[source]

Add core subsets to a binary

Parameters:
  • binary (str) – the path to the binary needed to be executed
  • subsets (CoreSubsets) – the subset of cores that the binary needs to be loaded on
  • executable_type (ExecutableType) – The type of this executable. None means don’t record it.
all_core_subsets

All the core subsets for all the binaries

Return type:CoreSubsets
binaries

The binaries of the executables

Return type:iterable(str)
executable_types_in_binary_set()[source]

get the executable types in the set of binaries

Returns:iterable of the executable types in this binary set.
Return type:iterable(ExecutableType)
get_binaries_of_executable_type(executable_type)[source]

get the binaries of a given a executable type

Parameters:executable_type (ExecutableType) – the executable type enum value
Returns:iterable of binaries with that executable type
Return type:iterable(str)
get_cores_for_binary(binary)[source]

Get the cores that a binary is to run on

Parameters:binary (str) – The binary to find the cores for
get_n_cores_for_executable_type(executable_type)[source]

get the number of cores that the executable type is using

Parameters:executable_type (ExecutableType) – the executable type for locating n cores of
Returns:the number of cores using this executable type
Return type:int
known(binary, chip_x, chip_y, chip_p)[source]
Parameters:
  • binary (str) –
  • chip_x (int) –
  • chip_y (int) –
  • chip_p (int) –
Return type:

bool

total_processors

The total number of cores to be loaded

Return type:int
class spinnman.model.HeapElement(block_address, next_address, free)

Bases: object

An element of one of the heaps on SpiNNaker.

Parameters:
  • block_address (int) – The address of this element on the heap
  • next_address (int) – The address of the next element on the heap
  • free (int) – The “free” element of the block as read from the heap
app_id

The application ID of the block if allocated, or None if not

Return type:int or None
block_address

The address of the block

Return type:int
is_free

True if this block is a free block, False otherwise

Return type:bool
next_address

The address of the next block, or 0 if none

Return type:int
size

The usable size of this block (not including the header)

Return type:int
tag

The tag of the block if allocated, or None if not

Return type:int or None
class spinnman.model.IOBuffer(x, y, p, iobuf)

Bases: object

The contents of IOBUF for a core

Parameters:
  • x (int) – The x-coordinate of a chip
  • y (int) – The y-coordinate of a chip
  • p (int) – The p-coordinate of a chip
  • iobuf (str) – The contents of the buffer for the chip
iobuf

The contents of the buffer

Return type:str
p

The ID of the core on the chip

Return type:int
x

The x-coordinate of the chip containing the core

Return type:int
y

The y-coordinate of the chip containing the core

Return type:int
class spinnman.model.MachineDimensions(width, height)

Bases: object

Represents the size of a machine in chips

Parameters:
  • width (int) – The width of the machine in chips
  • height (int) – The height of the machine in chips
height

The height of the machine in chips

Return type:int
width

The width of the machine in chips

Return type:int
class spinnman.model.P2PTable(width, height, column_data)

Bases: object

Represents a P2P routing table read from the machine.

Parameters:
  • width (int) –
  • height (int) –
  • column_data (bytes) –
static get_column_offset(column)[source]

Get the offset of the next column in the table from the P2P base address.

Parameters:column (int) – The column to be read
static get_n_column_bytes(height)[source]

Get the number of bytes to be read for each column of the table.

Parameters:height (int) – The height of the machine
get_route(x, y)[source]

Get the route to follow from this chip to the given chip.

Parameters:
  • x (int) – The x-coordinate of the chip to find the route to
  • y (int) – The y-coordinate of the chip to find the route to
Return type:

P2PTableRoute

height

The height of the machine that this table represents.

Return type:int
is_route(x, y)[source]

Determines if there is a route in the P2P table to the given chip.

Parameters:
  • x (int) – The x-coordinate of the chip to look up
  • y (int) – The y-coordinate of the chip to look up
Return type:

bool

iterchips()[source]

Get an iterator of tuples of (x, y) coordinates in the table

Return type:iterable(tuple(int,int))
width

The width of the machine that this table represents.

Return type:int
class spinnman.model.RouterDiagnostics(control_register, error_status, register_values)

Bases: object

Represents a set of diagnostic information available from a chip router.

Parameters:
  • control_register (int) – The value of the control register
  • error_status (int) – The value of the error_status
  • register_values (list(int)) – The values of the 16 router registers
Raises:

SpinnmanInvalidParameterException – If the number of register values is not 16

error_count

The count of errors

Return type:int
error_status

The error status

Return type:int
errors_set

A list of errors that have been detected

Return type:list(RouterError)
mon

The “mon” part of the control register

Return type:int
n_dropped_fixed_route_packets

The number of fixed-route packets received that were dropped.

Return type:int
n_dropped_multicast_packets

The number of multicast packets received that were dropped.

Return type:int
n_dropped_nearest_neighbour_packets

The number of nearest-neighbour packets received that were dropped.

Return type:int
n_dropped_peer_to_peer_packets

The number of peer-to-peer packets received that were dropped.

Return type:int
n_external_fixed_route_packets

The number of fixed-route packets received from external links.

Return type:int
n_external_multicast_packets

The number of multicast packets received from external links.

Return type:int
n_external_nearest_neighbour_packets

The number of nearest-neighbour packets received from external links.

Return type:int
n_external_peer_to_peer_packets

The number of peer-to-peer packets received from external links.

Return type:int
n_local_fixed_route_packets

The number of fixed-route packets received from local cores.

Return type:int
n_local_multicast_packets

The number of multicast packets received from local cores.

Return type:int
n_local_nearest_neighbour_packets

The number of nearest-neighbour packets received from local cores.

Return type:int
n_local_peer_to_peer_packets

The number of peer-to-peer packets received from local cores.

Return type:int
registers

The values in all of the registers. Can be used to directly access the registers if they have been programmed to give different values

Returns:An array of 16 values
Return type:array(int)
user_0

The number of packets counted by the user 0 router diagnostic filter.

Return type:int
user_1

The number of packets counted by the user 1 router diagnostic filter.

Return type:int
user_2

The number of packets counted by the user 2 router diagnostic filter.

Return type:int
user_3

The number of packets counted by the user 3 router diagnostic filter.

Return type:int
user_registers

The values in the user control registers.

Returns:An array of 4 values
Return type:list(int)
wait_1

The “wait_1” part of the control register

Return type:int
wait_2

The “wait_2” part of the control register

Return type:int
class spinnman.model.VersionInfo(version_data, offset=0)

Bases: object

Decodes SC&MP/SARK version information as returned by the SVER command.

Parameters:
  • version_data (bytes) – bytes from an SCP packet containing version information
  • offset (int) – the offset in the bytes from an SCP packet containing version information
Raises:

SpinnmanInvalidParameterException – If the message does not contain valid version information

build_date

The build date of the software, in seconds since 1st January 1970

Return type:int
hardware

The hardware being run on.

Return type:str
name

The name of the software.

Return type:str
p

The processor ID of the processor where the information was obtained.

Return type:int
version_number

The version number of the software.

Return type:tuple(int, int, int)
version_string

The version information as text.

Return type:str
x

The x-coordinate of the chip where the information was obtained.

Return type:int
y

The y-coordinate of the chip where the information was obtained.

Return type:int
spinnman.processes package
Submodules
spinnman.processes.abstract_multi_connection_process module
spinnman.processes.abstract_multi_connection_process_connection_selector module
spinnman.processes.application_copy_run_process module
spinnman.processes.application_run_process module
spinnman.processes.de_alloc_sdram_process module
spinnman.processes.fixed_connection_selector module
spinnman.processes.get_cpu_info_process module
spinnman.processes.get_heap_process module
spinnman.processes.get_machine_process module
spinnman.processes.get_routes_process module
spinnman.processes.get_tags_process module
spinnman.processes.get_version_process module
spinnman.processes.load_fixed_route_routing_entry_process module
spinnman.processes.load_routes_process module
spinnman.processes.malloc_sdram_process module
spinnman.processes.most_direct_connection_selector module
spinnman.processes.read_fixed_route_routing_entry_process module
spinnman.processes.read_iobuf_process module
spinnman.processes.read_memory_process module
spinnman.processes.read_router_diagnostics_process module
spinnman.processes.round_robin_connection_selector module
spinnman.processes.send_single_command_process module
spinnman.processes.write_memory_flood_process module
spinnman.processes.write_memory_process module
Module contents
class spinnman.processes.AbstractMultiConnectionProcessConnectionSelector

Bases: object

A connection selector for multi-connection processes

get_next_connection(message)[source]

Get the index of the next connection for the process from a list of connections.

Parameters:message (AbstractSCPRequest) – The SCP message to be sent
Return type:SCAMPConnection
class spinnman.processes.FixedConnectionSelector(connection)

Bases: spinnman.processes.AbstractMultiConnectionProcessConnectionSelector

A connection selector that only uses a single connection.

Parameters:connection (SCAMPConnection) – The connection to be used
get_next_connection(message)[source]

Get the index of the next connection for the process from a list of connections.

Parameters:message (AbstractSCPRequest) – The SCP message to be sent
Return type:SCAMPConnection
class spinnman.processes.MostDirectConnectionSelector(connections)

Bases: spinnman.processes.AbstractMultiConnectionProcessConnectionSelector

A selector that goes for the most direct connection for the message.

Parameters:connections (list(SCAMPConnection)) – The connections to be used
get_next_connection(message)[source]

Get the index of the next connection for the process from a list of connections.

Parameters:message (AbstractSCPRequest) – The SCP message to be sent
Return type:SCAMPConnection
class spinnman.processes.RoundRobinConnectionSelector(connections)

Bases: spinnman.processes.AbstractMultiConnectionProcessConnectionSelector

A connection selector that just spreads work as evenly as possible.

Parameters:connections (list(SCAMPConnection)) – The connections to be used
get_next_connection(message)[source]

Get the index of the next connection for the process from a list of connections.

Parameters:message (AbstractSCPRequest) – The SCP message to be sent
Return type:SCAMPConnection
class spinnman.processes.AbstractMultiConnectionProcess(next_connection_selector, n_retries=10, timeout=1.0, n_channels=8, intermediate_channel_waits=7)

Bases: object

A process for talking to SpiNNaker efficiently that uses multiple connections in communication if relevant.

Parameters:
  • next_connection_selector (AbstractMultiConnectionProcessConnectionSelector) – How to choose the connection.
  • n_retries (int) – The number of retries of a message to use. Passed to SCPRequestPipeLine
  • timeout (float) – The timeout, in seconds. Passed to SCPRequestPipeLine
  • n_channels (int) – The maximum number of channels to use when talking to a particular SCAMP instance. Passed to SCPRequestPipeLine
  • intermediate_channel_waits (int) – The maximum number of outstanding message/reply pairs to have on a particular connection. Passed to SCPRequestPipeLine
check_for_error(print_exception=False)[source]
connection_selector

Get the connection selector of the process

is_error()[source]
class spinnman.processes.ApplicationRunProcess(next_connection_selector, n_retries=10, timeout=1.0, n_channels=8, intermediate_channel_waits=7)

Bases: spinnman.processes.AbstractMultiConnectionProcess

Parameters:
  • next_connection_selector (AbstractMultiConnectionProcessConnectionSelector) – How to choose the connection.
  • n_retries (int) – The number of retries of a message to use. Passed to SCPRequestPipeLine
  • timeout (float) – The timeout, in seconds. Passed to SCPRequestPipeLine
  • n_channels (int) – The maximum number of channels to use when talking to a particular SCAMP instance. Passed to SCPRequestPipeLine
  • intermediate_channel_waits (int) – The maximum number of outstanding message/reply pairs to have on a particular connection. Passed to SCPRequestPipeLine
run(app_id, core_subsets, wait)[source]
class spinnman.processes.ApplicationCopyRunProcess(next_connection_selector, n_retries=10, timeout=1.0, n_channels=8, intermediate_channel_waits=7)

Bases: spinnman.processes.AbstractMultiConnectionProcess

Process to start a binary on a subset of cores on a subset of chips of a machine, performed by, on each chip, copying the data from an adjacent chip and then starting the binary. This goes to each chip in turn, and so detects failures early on, as well as ensuring that the copy and execution is done in the case of success i.e. this ensures that if all commands are successful, the full binary has been copied and started.

NOTE: The binary must have been loaded to the boot chip before this is called!

Parameters:
  • next_connection_selector (AbstractMultiConnectionProcessConnectionSelector) – How to choose the connection.
  • n_retries (int) – The number of retries of a message to use. Passed to SCPRequestPipeLine
  • timeout (float) – The timeout, in seconds. Passed to SCPRequestPipeLine
  • n_channels (int) – The maximum number of channels to use when talking to a particular SCAMP instance. Passed to SCPRequestPipeLine
  • intermediate_channel_waits (int) – The maximum number of outstanding message/reply pairs to have on a particular connection. Passed to SCPRequestPipeLine
run(size, app_id, core_subsets, chksum, wait)[source]

Run the process.

Parameters:
  • size (int) – The size of the binary to copy
  • app_id (int) – The application id to assign to the running binary
  • core_subsets (CoreSubsets) – The cores to load the binary on to
  • chksum (int) – The checksum of the data to test against
  • wait (bool) – Whether to put the binary in “wait” mode or run it straight away
class spinnman.processes.DeAllocSDRAMProcess(connection_selector)

Bases: spinnman.processes.AbstractMultiConnectionProcess

This class is currently deprecated and untested as there is no known use except for Transceiver.free_sdram and free_sdram_by_app_id which are both themselves deprecated.

Parameters:connection_selector (AbstractMultiConnectionProcessConnectionSelector) –
de_alloc_sdram(x, y, app_id, base_address=None)[source]
Parameters:
no_blocks_freed
class spinnman.processes.GetCPUInfoProcess(connection_selector)

Bases: spinnman.processes.AbstractMultiConnectionProcess

Parameters:connection_selector (AbstractMultiConnectionProcessConnectionSelector) –
get_cpu_info(core_subsets)[source]
Parameters:core_subsets (CoreSubsets) –
Return type:list(CPUInfo)
class spinnman.processes.GetHeapProcess(connection_selector)

Bases: spinnman.processes.AbstractMultiConnectionProcess

Parameters:connection_selector (AbstractMultiConnectionProcessConnectionSelector) –
get_heap(chip_address, pointer=<SystemVariableDefinition.sdram_heap_address: _Definition(offset=76, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The base address of the user SDRAM heap')>)[source]
Parameters:
Return type:

list(HeapElement)

class spinnman.processes.GetMachineProcess(connection_selector)

Bases: spinnman.processes.AbstractMultiConnectionProcess

A process for getting the machine details over a set of connections.

Parameters:connection_selector (AbstractMultiConnectionProcessConnectionSelector) –
get_machine_details(boot_x, boot_y, width, height)[source]
Parameters:
  • boot_x (int) –
  • boot_y (int) –
  • width (int) –
  • height (int) –
Return type:

Machine

class spinnman.processes.GetMultiCastRoutesProcess(connection_selector, app_id=None)

Bases: spinnman.processes.AbstractMultiConnectionProcess

A process for reading the multicast routing table of a SpiNNaker chip.

Parameters:
get_routes(x, y, base_address)[source]
Parameters:
  • x (int) –
  • y (int) –
  • base_address (int) –
Return type:

list(MulticastRoutingEntry)

class spinnman.processes.GetTagsProcess(connection_selector)

Bases: spinnman.processes.AbstractMultiConnectionProcess

Parameters:connection_selector (AbstractMultiConnectionProcessConnectionSelector) –
get_tags(connection)[source]
Parameters:connection (SCAMPConnection) –
Return type:list(IPTag or ReverseIPTag)
class spinnman.processes.GetVersionProcess(connection_selector, n_retries=10)

Bases: spinnman.processes.AbstractMultiConnectionProcess

A process for getting the version of the machine.

Parameters:connection_selector (AbstractMultiConnectionProcessConnectionSelector) –
get_version(x, y, p)[source]
Parameters:
Return type:

VersionInfo

class spinnman.processes.LoadFixedRouteRoutingEntryProcess(next_connection_selector, n_retries=10, timeout=1.0, n_channels=8, intermediate_channel_waits=7)

Bases: spinnman.processes.AbstractMultiConnectionProcess

Load a fixed route routing entry onto a chip.

Parameters:
  • next_connection_selector (AbstractMultiConnectionProcessConnectionSelector) – How to choose the connection.
  • n_retries (int) – The number of retries of a message to use. Passed to SCPRequestPipeLine
  • timeout (float) – The timeout, in seconds. Passed to SCPRequestPipeLine
  • n_channels (int) – The maximum number of channels to use when talking to a particular SCAMP instance. Passed to SCPRequestPipeLine
  • intermediate_channel_waits (int) – The maximum number of outstanding message/reply pairs to have on a particular connection. Passed to SCPRequestPipeLine
load_fixed_route(x, y, fixed_route, app_id=0)[source]
Parameters:
  • x (int) – The x-coordinate of the chip, between 0 and 255; this is not checked due to speed restrictions.
  • y (int) – The y-coordinate of the chip, between 0 and 255; this is not checked due to speed restrictions.
  • fixed_route (FixedRouteEntry) – the fixed route entry
  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.
class spinnman.processes.LoadMultiCastRoutesProcess(connection_selector)

Bases: spinnman.processes.AbstractMultiConnectionProcess

A process for loading the multicast routing table on a SpiNNaker chip.

Parameters:connection_selector (AbstractMultiConnectionProcessConnectionSelector) –
load_routes(x, y, routes, app_id)[source]
Parameters:
class spinnman.processes.MallocSDRAMProcess(connection_selector)

Bases: spinnman.processes.AbstractMultiConnectionProcess

A process for allocating a block of SDRAM on a SpiNNaker chip.

Parameters:connection_selector (AbstractMultiConnectionProcessConnectionSelector) –
base_address

The address of the allocated memory block.

Return type:int
malloc_sdram(x, y, size, app_id, tag)[source]

Allocate space in the SDRAM space.

Parameters:
class spinnman.processes.ReadFixedRouteRoutingEntryProcess(connection_selector)

Bases: spinnman.processes.AbstractMultiConnectionProcess

A process for reading a fixed route routing table entry.

Parameters:connection_selector (AbstractMultiConnectionProcessConnectionSelector) – the SC&MP connection selector
read_fixed_route(x, y, app_id=0)[source]

Read the fixed route entry installed on a particular chip’s router.

Parameters:
  • x (int) – The x-coordinate of the chip, between 0 and 255; this is not checked due to speed restrictions
  • y (int) – The y-coordinate of the chip, between 0 and 255; this is not checked due to speed restrictions
  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.
Return type:

FixedRouteEntry

class spinnman.processes.ReadIOBufProcess(connection_selector)

Bases: spinnman.processes.AbstractMultiConnectionProcess

A process for reading IOBUF memory (mostly log messages) from a SpiNNaker core.

Parameters:connection_selector (AbstractMultiConnectionProcessConnectionSelector) –
read_iobuf(iobuf_size, core_subsets)[source]
Parameters:
Return type:

iterable(IOBuffer)

class spinnman.processes.ReadMemoryProcess(connection_selector)

Bases: spinnman.processes.AbstractMultiConnectionProcess

A process for reading memory on a SpiNNaker chip.

Parameters:connection_selector (AbstractMultiConnectionProcessConnectionSelector) –
Parameters:
  • x (int) –
  • y (int) –
  • p (int) –
  • link (int) –
  • base_address (int) –
  • length (int) –
Return type:

bytearray

read_memory(x, y, p, base_address, length)[source]
Parameters:
  • x (int) –
  • y (int) –
  • p (int) –
  • base_address (int) –
  • length (int) –
Return type:

bytearray

class spinnman.processes.ReadRouterDiagnosticsProcess(connection_selector)

Bases: spinnman.processes.AbstractMultiConnectionProcess

A process for reading the diagnostic data block from a SpiNNaker router.

Parameters:connection_selector (AbstractMultiConnectionProcessConnectionSelector) –
get_router_diagnostics(x, y)[source]
Parameters:
Return type:

RouterDiagnostics

class spinnman.processes.SendSingleCommandProcess(connection_selector, n_retries=3, timeout=1.0)

Bases: spinnman.processes.AbstractMultiConnectionProcess

Parameters:connection_selector (AbstractMultiConnectionProcessConnectionSelector) –
execute(request)[source]
Parameters:request (AbstractSCPRequest) –
Return type:AbstractSCPResponse
class spinnman.processes.WriteMemoryFloodProcess(next_connection_selector)

Bases: spinnman.processes.AbstractMultiConnectionProcess

A process for writing memory on multiple SpiNNaker chips at once.

write_memory_from_bytearray(nearest_neighbour_id, base_address, data, offset, n_bytes=None)[source]
Parameters:
write_memory_from_reader(nearest_neighbour_id, base_address, reader, n_bytes)[source]
Parameters:
class spinnman.processes.WriteMemoryProcess(next_connection_selector, n_retries=10, timeout=1.0, n_channels=8, intermediate_channel_waits=7)

Bases: spinnman.processes.AbstractMultiConnectionProcess

A process for writing memory on a SpiNNaker chip.

Parameters:
  • next_connection_selector (AbstractMultiConnectionProcessConnectionSelector) – How to choose the connection.
  • n_retries (int) – The number of retries of a message to use. Passed to SCPRequestPipeLine
  • timeout (float) – The timeout, in seconds. Passed to SCPRequestPipeLine
  • n_channels (int) – The maximum number of channels to use when talking to a particular SCAMP instance. Passed to SCPRequestPipeLine
  • intermediate_channel_waits (int) – The maximum number of outstanding message/reply pairs to have on a particular connection. Passed to SCPRequestPipeLine

Writes memory onto a neighbour of a SpiNNaker chip from a bytearray.

Parameters:
  • x (int) – The x-coordinate of the chip where the memory is to be written to
  • y (int) – The y-coordinate of the chip where the memory is to be written to
  • p (int) – The processor of the chip where the memory is to be written to
  • link (int) – Along which link is the neighbour.
  • base_address (int) – the address in SDRAM to start writing
  • data (bytearray or bytes) – the data to write
  • offset (int) – where in the data to start writing from
  • n_bytes (int) – how much data to write
  • get_sum (bool) – whether to return a checksum or 0
Returns:

the data checksum or 0 if get_sum is False

Return type:

int

Writes memory onto a neighbour of a SpiNNaker chip from a reader.

Parameters:
  • x (int) – The x-coordinate of the chip where the memory is to be written to
  • y (int) – The y-coordinate of the chip where the memory is to be written to
  • p (int) – The processor of the chip where the memory is to be written to
  • link (int) – Along which link is the neighbour.
  • base_address (int) – the address in SDRAM to start writing
  • reader (RawIOBase or BufferedIOBase) – the readable object containing the data to write
  • n_bytes (int) – how much data to write
  • get_sum (bool) – whether to return a checksum or 0
Returns:

the data checksum or 0 if get_sum is False

Return type:

int

write_memory_from_bytearray(x, y, p, base_address, data, offset, n_bytes, get_sum=False)[source]

Writes memory onto a SpiNNaker chip from a bytearray.

Parameters:
  • x (int) – The x-coordinate of the chip where the memory is to be written to
  • y (int) – The y-coordinate of the chip where the memory is to be written to
  • p (int) – The processor of the chip where the memory is to be written to
  • base_address (int) – the address in SDRAM to start writing
  • data (bytearray or bytes) – the data to write
  • offset (int) – where in the data to start writing from
  • n_bytes (int) – how much data to write
  • get_sum (bool) – whether to return a checksum or 0
Returns:

the data checksum or 0 if get_sum is False

Return type:

int

write_memory_from_reader(x, y, p, base_address, reader, n_bytes, get_sum=False)[source]

Writes memory onto a SpiNNaker chip from a reader.

Parameters:
  • x (int) – The x-coordinate of the chip where the memory is to be written to
  • y (int) – The y-coordinate of the chip where the memory is to be written to
  • p (int) – The processor of the chip where the memory is to be written to
  • base_address (int) – the address in SDRAM to start writing
  • reader (RawIOBase or BufferedIOBase) – the readable object containing the data to write
  • n_bytes (int) – how much data to write
  • get_sum (bool) – whether to return a checksum or 0
Returns:

the data checksum or 0 if get_sum is False

Return type:

int

spinnman.spalloc package
Submodules
spinnman.spalloc.abstract_spalloc_client module

API of the client for the Spalloc web service.

spinnman.spalloc.proxy_protocol module
class spinnman.spalloc.proxy_protocol.ProxyProtocol[source]

Bases: enum.IntEnum

An enumeration.

CLOSE = 1

Message relating to closing a channel

MSG = 2

Message sent on a channel

MSG_TO = 4

Message sent on an unbound channel to a given board

OPEN = 0

Message relating to opening a channel

OPEN_UNBOUND = 3

Message relating to opening an unbound listen-only channel

spinnman.spalloc.session module
class spinnman.spalloc.session.Session(service_url: str, username: str = None, password: str = None, token: str = None, session_credentials: Tuple[Dict[str, str], Dict[str, str]] = None)[source]

Bases: object

Manages session credentials for the Spalloc client.

Parameters:
  • service_url (str) – The reference to the service. Should not include a username or password in it.
  • username (str) – The user name to use
  • password (str) – The password to use
  • token (str) – The bearer token to use
delete(url: str, **kwargs) → requests.models.Response[source]

Do an HTTP DELETE in the session.

Parameters:url (str) –
Return type:Response
get(url: str, **kwargs) → requests.models.Response[source]

Do an HTTP GET in the session.

Parameters:url (str) –
Return type:Response
post(url: str, jsonobj: dict, **kwargs) → requests.models.Response[source]

Do an HTTP POST in the session.

Parameters:
Return type:

Response

put(url: str, data: str, **kwargs) → requests.models.Response[source]

Do an HTTP PUT in the session. Puts plain text OR JSON!

Parameters:
  • url (str) –
  • data (str) –
Return type:

Response

renew() → dict[source]

Renews the session, logging the user into it so that state modification operations can be performed.

Returns:Description of the root of the service, without CSRF data
Return type:dict
Raises:SpollocExcption
websocket(url: str, header: dict = None, cookie: str = None, **kwargs) → websocket._core.WebSocket[source]

Create a websocket that uses the session credentials to establish itself.

Parameters:
  • url (str) – Actual location to open websocket at
  • header (dict(str,str)) – Optional HTTP headers
  • cookie (str) – Optional cookies (composed as semicolon-separated string)
  • kwargs – Other options to create_connection()
Return type:

WebSocket

class spinnman.spalloc.session.SessionAware(session: spinnman.spalloc.session.Session, url: str)[source]

Bases: object

Connects to the session.

spinnman.spalloc.spalloc_boot_connection module

API of the client for the Spalloc web service.

class spinnman.spalloc.spalloc_boot_connection.SpallocBootConnection(remote_host=None)[source]

Bases: spinnman.connections.udp_packet_connections.BootConnection, spinnman.spalloc.SpallocProxiedConnection

The socket interface supported by proxied boot sockets. The socket will always be talking to the root board of a job. This emulates a BootConnection.

Parameters:remote_host (str) – The remote host name or IP address to send packets to. If not specified, the socket will be available for listening only, and will throw and exception if used for sending
Raises:SpinnmanIOException – If there is an error setting up the communication channel
get_receive_method() → Callable[source]

Get the method that receives for this connection.

receive_boot_message(timeout=None) → spinnman.messages.spinnaker_boot.SpinnakerBootMessage[source]

Receives a boot message from this connection. Blocks until a message has been received, or a timeout occurs.

Parameters:

timeout (int) – The time in seconds to wait for the message to arrive; if not specified, will wait forever, or until the connection is closed.

Returns:

a boot message

Return type:

SpinnakerBootMessage

Raises:
send_boot_message(boot_message: spinnman.messages.spinnaker_boot.SpinnakerBootMessage)[source]

Sends a SpiNNaker boot message using this connection.

Parameters:boot_message (SpinnakerBootMessage) – The message to be sent
Raises:SpinnmanIOException – If there is an error sending the message
spinnman.spalloc.spalloc_client module

Implementation of the client for the Spalloc web service.

spinnman.spalloc.spalloc_eieio_connection module

API of the client for the Spalloc web service.

spinnman.spalloc.spalloc_eieio_listener module

API of the client for the Spalloc web service.

spinnman.spalloc.spalloc_job module
spinnman.spalloc.spalloc_machine module
spinnman.spalloc.spalloc_proxied_connection module

API of the client for the Spalloc web service.

spinnman.spalloc.spalloc_scp_connection module
class spinnman.spalloc.spalloc_scp_connection.SpallocSCPConnection(x, y)[source]

Bases: spinnman.connections.udp_packet_connections.SCAMPConnection, spinnman.spalloc.SpallocProxiedConnection

The socket interface supported by proxied sockets. The socket will always be talking to a specific board. This emulates a SCAMPConnection.

get_receive_method() → Callable[source]

Get the method that receives for this connection.

get_scp_data(scp_request: spinnman.messages.scp.abstract_messages.AbstractSCPRequest, x=None, y=None) → bytes[source]

Returns the data of an SCP request as it would be sent down this connection

Parameters:
  • x (int) – Optional: x-coordinate of where to send to
  • y (int) – Optional: y-coordinate of where to send to
receive_scp_response(timeout=1.0) → Tuple[spinnman.messages.scp.enums.SCPResult, int, bytes, int][source]

Receives an SCP response from this connection. Blocks until a message has been received, or a timeout occurs.

Parameters:

timeout (int) – The time in seconds to wait for the message to arrive; if not specified, will wait forever, or until the connection is closed

Returns:

The SCP result, the sequence number, the data of the response and the offset at which the data starts (i.e., where the SDP header starts).

Return type:

tuple(SCPResult, int, bytes, int)

Raises:
receive_sdp_message(timeout=None) → spinnman.messages.sdp.SDPMessage[source]

Receives an SDP message from this connection. Blocks until the message has been received, or a timeout occurs.

Parameters:

timeout (int) – The time in seconds to wait for the message to arrive; if not specified, will wait forever, or until the connection is closed.

Returns:

The received SDP message

Return type:

SDPMessage

Raises:
send_scp_request(scp_request: spinnman.messages.scp.abstract_messages.AbstractSCPRequest)[source]

Sends an SCP request down this connection

Messages must have the following properties:

  • source_port is None or 7
  • source_cpu is None or 31
  • source_chip_x is None or 0
  • source_chip_y is None or 0

tag in the message is optional; if not set, the default set in the constructor will be used. sequence in the message is optional; if not set, (sequence number last assigned + 1) % 65536 will be used

Parameters:scp_request (AbstractSCPRequest) – message packet to send
Raises:SpinnmanIOException – If there is an error sending the message
send_sdp_message(sdp_message: spinnman.messages.sdp.SDPMessage)[source]

Sends an SDP message down this connection

Parameters:sdp_message (SDPMessage) – The SDP message to be sent
Raises:SpinnmanIOException – If there is an error sending the message.
spinnman.spalloc.spalloc_state module
spinnman.spalloc.utils module

Miscellaneous utilities for working with URLs relating to the Spalloc Client.

spinnman.spalloc.utils.clean_url(url: str) → str[source]

Add a / to the end of the path part of a URL if there isn’t one.

Parameters:url (str) –
Return type:str
spinnman.spalloc.utils.get_hostname(url: str) → str[source]

Parses a URL and extracts the hostname part.

spinnman.spalloc.utils.parse_service_url(url: str) → Tuple[str, str, str][source]

Parses a combined service reference.

Parameters:url (str) –
Returns:URL, username (may be None), password (may be None)
Return type:tuple(str,str,str)
Module contents
class spinnman.spalloc.AbstractSpallocClient

Bases: object

The API exported by the Spalloc Client.

create_job(num_boards: int = 1, machine_name: str = None, keepalive: int = 45) → spinnman.spalloc.SpallocJob[source]

Create a job with a specified number of boards.

Parameters:
  • num_boards (int) – How many boards to ask for (defaults to 1)
  • machine_name (str) – Which machine to run on? If omitted, the service’s machine tagged with default will be used.
  • keepalive (int) – After how many seconds of no activity should a job become eligible for automatic pruning?
Returns:

A handle for monitoring and interacting with the job.

Return type:

SpallocJob

create_job_board(triad: Tuple[int, int, int] = None, physical: Tuple[int, int, int] = None, ip_address: str = None, machine_name: str = None, keepalive: int = 45) → spinnman.spalloc.SpallocJob[source]

Create a job with a specific board. At least one of triad, physical and ip_address must be not None.

Parameters:
  • triad (tuple(int,int,int)) – The logical coordinate of the board to request
  • physical (tuple(int,int,int)) – The physical coordinate of the board to request
  • ip_address (str) – The IP address of the board to request
  • machine_name (str) – Which machine to run on? If omitted, the service’s machine tagged with default will be used.
  • keepalive (int) – After how many seconds of no activity should a job become eligible for automatic pruning?
Returns:

A handle for monitoring and interacting with the job.

Return type:

SpallocJob

create_job_rect(width: int, height: int, machine_name: str = None, keepalive: int = 45) → spinnman.spalloc.SpallocJob[source]

Create a job with a rectangle of boards.

Parameters:
  • width (int) – The width of rectangle to request
  • height (int) – The height of rectangle to request
  • machine_name (str) – Which machine to run on? If omitted, the service’s machine tagged with default will be used.
  • keepalive (int) – After how many seconds of no activity should a job become eligible for automatic pruning?
Returns:

A handle for monitoring and interacting with the job.

Return type:

SpallocJob

list_jobs(deleted: bool = False) → Iterable[spinnman.spalloc.SpallocJob][source]

Get the jobs known to the server.

Parameters:deleted (bool) – Whether to include deleted jobs.
Returns:The jobs known to the server.
Return type:Iterable(SpallocJob)
list_machines() → Dict[str, spinnman.spalloc.SpallocMachine][source]

Get the machines supported by the server.

Returns:Mapping from machine names to handles for working with a machine.
Return type:dict(str,SpallocMachine)
spinnman.spalloc.is_server_address(address: str, additional_schemes: Iterable[str] = ()) → bool

Test if the given address is a likely spalloc server URL.

Parameters:
  • address (str) – The address to check
  • additional_schemes (Iterable(str)) – Any additional URL schemes that should be considered to be successes; typically {"spalloc"} when looser matching is required.
Return type:

bool

class spinnman.spalloc.SpallocClient(service_url, username=None, password=None, bearer_token=None)

Bases: spinn_utilities.abstract_context_manager.AbstractContextManager, spinnman.spalloc.AbstractSpallocClient

Basic client library for talking to new Spalloc.

Parameters:
  • service_url (str) – The reference to the service. May have username and password supplied as part of the network location; if so, the username and password arguments must be None. If username and password are not given, not even within the URL, the bearer_token must be not None.
  • username (str) – The user name to use
  • password (str) – The password to use
  • bearer_token (str) – The bearer token to use
close()[source]

How to actually close the underlying resources.

create_job(num_boards=1, machine_name=None, keepalive=45)[source]

Create a job with a specified number of boards.

Parameters:
  • num_boards (int) – How many boards to ask for (defaults to 1)
  • machine_name (str) – Which machine to run on? If omitted, the service’s machine tagged with default will be used.
  • keepalive (int) – After how many seconds of no activity should a job become eligible for automatic pruning?
Returns:

A handle for monitoring and interacting with the job.

Return type:

SpallocJob

create_job_board(triad=None, physical=None, ip_address=None, machine_name=None, keepalive=45)[source]

Create a job with a specific board. At least one of triad, physical and ip_address must be not None.

Parameters:
  • triad (tuple(int,int,int)) – The logical coordinate of the board to request
  • physical (tuple(int,int,int)) – The physical coordinate of the board to request
  • ip_address (str) – The IP address of the board to request
  • machine_name (str) – Which machine to run on? If omitted, the service’s machine tagged with default will be used.
  • keepalive (int) – After how many seconds of no activity should a job become eligible for automatic pruning?
Returns:

A handle for monitoring and interacting with the job.

Return type:

SpallocJob

create_job_rect(width, height, machine_name=None, keepalive=45)[source]

Create a job with a rectangle of boards.

Parameters:
  • width (int) – The width of rectangle to request
  • height (int) – The height of rectangle to request
  • machine_name (str) – Which machine to run on? If omitted, the service’s machine tagged with default will be used.
  • keepalive (int) – After how many seconds of no activity should a job become eligible for automatic pruning?
Returns:

A handle for monitoring and interacting with the job.

Return type:

SpallocJob

list_jobs(deleted=False)[source]

Get the jobs known to the server.

Parameters:deleted (bool) – Whether to include deleted jobs.
Returns:The jobs known to the server.
Return type:Iterable(SpallocJob)
list_machines()[source]

Get the machines supported by the server.

Returns:Mapping from machine names to handles for working with a machine.
Return type:dict(str,SpallocMachine)
static open_job_from_database(conn: sqlite3.Cursor) → spinnman.spalloc.SpallocJob[source]

Create a job from the description in the attached database. This is intended to allow for access to the job’s allocated resources from visualisers and other third party code participating in the Spinnaker Tools Notification Protocol.

Note

The job is not verified to exist and be running. The session credentials may have expired; if so, the job will be unable to regenerate them.

Parameters:conn (Cursor) – The database cursor to retrieve the job details from. Assumes the presence of a proxy_configuration table with kind, name and value columns.
Returns:The job handle, or None if the records in the database are absent or incomplete.
Return type:SpallocJob
version
class spinnman.spalloc.SpallocJob

Bases: object

Represents a job in spalloc.

Don’t make this yourself. Use SpallocClient instead.

connect_for_booting() → spinnman.spalloc.spalloc_boot_connection.SpallocBootConnection[source]

Open a connection to a job’s allocation so it can be booted.

Returns:a boot connection
Return type:SpallocBootConnection
connect_to_board(x: int, y: int, port: int = 17893) → spinnman.spalloc.spalloc_scp_connection.SpallocSCPConnection[source]

Open a connection to a particular board in the job.

Parameters:
  • x (int) – X coordinate of the board’s ethernet chip
  • y (int) – Y coordinate of the board’s ethernet chip
  • port (int) – UDP port to talk to; defaults to the SCP port
Returns:

A connection that talks to the board.

Return type:

SpallocProxiedConnection

create_transceiver() → spinnman.transceiver.Transceiver[source]

Create a transceiver that will talk to this job. The transceiver will only be configured to talk to the SCP ports of the boards of the job.

Return type:Transceiver
destroy(reason: str = 'finished')[source]

Destroy the job.

Parameters:reason (str) – Why the job is being destroyed.
get_connections() → Dict[Tuple[int, int], str][source]

Get the mapping from board coordinates to IP addresses.

Returns:(x,y)->IP mapping, or None if not allocated
Return type:dict(tuple(int,int), str) or None
get_root_host() → str[source]

Get the IP address for talking to the machine.

Returns:The IP address, or None if not allocated.
Return type:str or None
get_state() → spinnman.spalloc.SpallocState[source]

Get the current state of the machine.

Return type:SpallocState
keepalive()[source]

Signal the job that we want it to stay alive for a while longer.

launch_keepalive_task(period: int = 30) → spinn_utilities.abstract_context_manager.AbstractContextManager[source]

Starts a periodic task to keep a job alive.

Parameters:
  • job (SpallocJob) – The job to keep alive
  • period (int) – How often to send a keepalive message (in seconds)
Returns:

Some kind of closeable task handle; closing it terminates the task. Destroying the job will also terminate the task.

open_eieio_connection(x: int, y: int) → spinnman.spalloc.SpallocEIEIOConnection[source]

Open an EIEIO connection to a specific board in a job.

Parameters:
  • x (int) – The X coordinate of the ethernet chip to connect to
  • y (int) – The Y coordinate of the ethernet chip to connect to
Returns:

an EIEIO connection with a board address bound

Return type:

SpallocEIEIOConnection

open_listener_connection() → spinnman.spalloc.SpallocEIEIOListener[source]

Open a listening EIEIO connection to the job’s boards. Messages cannot be sent on this connection unless you say which board to send to, but they can be received from all boards. You can also get the server side connection information so you can program that into a tag.

Returns:an EIEIO connection with no board address bound
Return type:SpallocEIEIOListener
wait_for_state_change(old_state: spinnman.spalloc.SpallocState) → spinnman.spalloc.SpallocState[source]

Wait until the allocation is not in the given old state.

Parameters:old_state (SpallocState) – The state that we are looking to change out of.
Returns:The state that the allocation is now in. Note that if the machine gets destroyed, this will not wait for it.
Return type:SpallocState
wait_until_ready()[source]

Wait until the allocation is in the READY state.

Raises:Exception – If the allocation is destroyed
where_is_machine(x: int, y: int) → Tuple[int, int, int][source]

Get the physical coordinates of the board hosting the given chip.

Parameters:
  • x (int) – Chip X coordinate
  • y (int) – Chip Y coordinate
Returns:

physical board coordinates (cabinet, frame, board), or None if there are no boards currently allocated to the job or the chip lies outside the allocation.

Return type:

tuple(int,int,int) or None

class spinnman.spalloc.SpallocMachine

Bases: object

Represents a spalloc-controlled machine.

Don’t make this yourself. Use SpallocClient instead.

area

Area of machine, in boards.

Returns:width, height
Return type:tuple(int,int)
dead_boards

The dead or out-of-service boards of the machine.

The dead or out-of-service links of the machine.

height

The height of the machine, in boards.

name

The name of the machine.

tags

The tags of the machine.

width

The width of the machine, in boards.

class spinnman.spalloc.SpallocProxiedConnection

Bases: spinnman.connections.abstract_classes.Listenable

Base class for connections proxied via Spalloc.

receive(timeout=None) → bytes[source]

Receive a message on an open socket. Will block until a message is received.

Parameters:timeout – How long to wait for a message to be received before timing out. If None, will wait indefinitely (or until the connection is closed).
Returns:The received message.
Raises:SpinnmanTimeoutException – If a timeout happens
send(data: bytes)[source]

Send a message on an open socket.

Parameters:data – The message to send.
class spinnman.spalloc.SpallocEIEIOConnection(local_host=None, local_port=None, remote_host=None, remote_port=None)

Bases: spinnman.connections.udp_packet_connections.EIEIOConnection, spinnman.spalloc.SpallocProxiedConnection

The socket interface supported by proxied EIEIO connected sockets. This emulates an EIEOConnection opened with a remote address specified.

Parameters:
  • local_host (str) – The local host name or IP address to bind to. If not specified defaults to bind to all interfaces, unless remote_host is specified, in which case binding is done to the IP address that will be used to send packets
  • local_port (int) – The local port to bind to, between 1025 and 65535. If not specified, defaults to a random unused local port
  • remote_host (str) – The remote host name or IP address to send packets to. If not specified, the socket will be available for listening only, and will throw and exception if used for sending
  • remote_port (int) – The remote port to send packets to. If remote_host is None, this is ignored. If remote_host is specified specified, this must also be specified for the connection to allow sending
Raises:

SpinnmanIOException – If there is an error setting up the communication channel

get_receive_method()[source]

Get the method that receives for this connection.

receive_eieio_message(timeout=None)[source]

Receives an EIEIO message from this connection. Blocks until a message has been received, or a timeout occurs.

Parameters:

timeout (int) – The time in seconds to wait for the message to arrive; if not specified, will wait forever, or until the connection is closed

Returns:

an EIEIO message

Return type:

AbstractEIEIOMessage

Raises:
send_eieio_message(eieio_message)[source]

Sends an EIEIO message down this connection

Parameters:eieio_message (AbstractEIEIOMessage) – The EIEIO message to be sent
Raises:SpinnmanIOException – If there is an error sending the message
send_eieio_message_to_core(eieio_message: spinnman.messages.eieio.AbstractEIEIOMessage, x: int, y: int, p: int)[source]
update_tag(tag: int)[source]

Update the given tag on the connected ethernet chip to send messages to this connection.

Parameters:

tag (int) – The tag ID to update

Raises:
class spinnman.spalloc.SpallocEIEIOListener(local_host=None, local_port=None, remote_host=None, remote_port=None)

Bases: spinnman.connections.udp_packet_connections.EIEIOConnection, spinnman.spalloc.SpallocProxiedConnection

The socket interface supported by proxied EIEIO listener sockets. This emulates an EIEOConnection opened with no address specified.

Parameters:
  • local_host (str) – The local host name or IP address to bind to. If not specified defaults to bind to all interfaces, unless remote_host is specified, in which case binding is done to the IP address that will be used to send packets
  • local_port (int) – The local port to bind to, between 1025 and 65535. If not specified, defaults to a random unused local port
  • remote_host (str) – The remote host name or IP address to send packets to. If not specified, the socket will be available for listening only, and will throw and exception if used for sending
  • remote_port (int) – The remote port to send packets to. If remote_host is None, this is ignored. If remote_host is specified specified, this must also be specified for the connection to allow sending
Raises:

SpinnmanIOException – If there is an error setting up the communication channel

get_receive_method()[source]

Get the method that receives for this connection.

local_ip_address

The IP address on the server to which the connection is bound.

Returns:The IP address as a dotted string, e.g., 0.0.0.0
Return type:str
local_port

The port on the server to which the connection is bound.

Returns:The local port number
Return type:int
receive_eieio_message(timeout=None)[source]

Receives an EIEIO message from this connection. Blocks until a message has been received, or a timeout occurs.

Parameters:

timeout (int) – The time in seconds to wait for the message to arrive; if not specified, will wait forever, or until the connection is closed

Returns:

an EIEIO message

Return type:

AbstractEIEIOMessage

Raises:
send(data)[source]

Send a message on an open socket.

Parameters:data – The message to send.

Note

This class does not allow sending.

send_eieio_message_to_core(eieio_message: spinnman.messages.eieio.AbstractEIEIOMessage, x: int, y: int, p: int, ip_address: str)[source]

Send an EIEIO message (one way) to a given core.

Parameters:
  • eieio_message (AbstractEIEIOMessage) – The message to send.
  • x (int) – The X coordinate of the core to send to.
  • y (int) – The Y coordinate of the core to send to.
  • p (int) – The ID of the core to send to.
  • ip_address (str) – The IP address of the ethernet chip to route the message via.
send_to(data: bytes, address: Tuple[str, int])[source]

Send a message on an open socket.

Parameters:
  • message (bytes) – The message to send.
  • address (tuple(str,int)) – Where to send it to. Must be the address of an ethernet chip on a board allocated to the job. Does not mean that SpiNNaker is listening on that port (but the SCP port is being listened to if the board is booted).
send_to_chip(message: bytes, x: int, y: int, port: int = 17893)[source]

Send a message on an open socket to a particular board.

Parameters:
  • message (bytes) – The message to send.
  • x (int) – The X coordinate of the ethernet chip to send the message to.
  • y (int) – The Y coordinate of the ethernet chip to send the message to.
  • port (int) – The UDP port on the ethernet chip to send the message to. Defaults to the SCP port.
update_tag(x: int, y: int, tag: int)[source]

Update the given tag on the given ethernet chip to send messages to this connection.

Parameters:
  • x (int) – The ethernet chip’s X coordinate
  • y (int) – The ethernet chip’s Y coordinate
  • tag (int) – The tag ID to update
Raises:
update_tag_by_ip(ip_address: str, tag: int)[source]

Update a tag on a board at a given IP address to send messages to this connection.

Parameters:
  • ip_address (str) – The address of the ethernet chip
  • tag (int) – The ID of the tag
class spinnman.spalloc.SpallocState

Bases: enum.IntEnum

An enumeration.

DESTROYED = 4
POWER = 2
QUEUED = 1
READY = 3
UNKNOWN = 0
spinnman.utilities package
Submodules
spinnman.utilities.appid_tracker module
class spinnman.utilities.appid_tracker.AppIdTracker(app_ids_in_use=None, min_app_id=17, max_app_id=254)[source]

Bases: object

A tracker of application IDs to make it easier to allocate new IDs.

Parameters:
  • app_ids_in_use (list(int) or None) – The IDs that are already in use
  • min_app_id (int) – The smallest application ID to use
  • max_app_id (int) – The largest application ID to use
allocate_id(allocated_id)[source]

Allocate a given ID.

Parameters:allocated_id (int) – The ID to allocate
Raises:KeyError – If the ID is not present
free_id(id_to_free)[source]

Free a given ID.

Parameters:id_to_free (int) – The ID to free
Raises:KeyError – If the ID is out of range
get_new_id()[source]

Get a new unallocated ID

Return type:int
spinnman.utilities.locate_connected_machine_ip_address module
spinnman.utilities.locate_connected_machine_ip_address.locate_connected_machine(handler)[source]

Locates any SpiNNaker machines IP addresses from the auto-transmitted packets from non-booted SpiNNaker machines.

Parameters:handler (callable) – A callback that decides whether to stop searching. The callback is given two arguments: the IP address found and the current time. It should return True if the search should cease.
spinnman.utilities.reports module
spinnman.utilities.reports.generate_machine_report(report_directory, machine, connections)[source]

Generate report on the physical structure of the target SpiNNaker machine.

Parameters:
  • report_directory (str) – the directory to which reports are stored
  • machine (Machine) – the machine python object
  • connections (list(Connection)) – the list of connections to the machine
Raises:

IOError – when a file cannot be opened for some reason

spinnman.utilities.socket_utils module

Wrappers around socket-related system calls to do exception remapping and apply some consistency to things.

spinnman.utilities.socket_utils.bind_socket(sock, host, port)[source]

Wrapper round bind() system call.

spinnman.utilities.socket_utils.connect_socket(sock, remote_address, remote_port)[source]

Wrapper round connect() system call.

spinnman.utilities.socket_utils.get_socket_address(sock)[source]

Wrapper round getsockname() system call.

spinnman.utilities.socket_utils.get_tcp_socket()[source]

Wrapper round socket() system call to produce TCP/IPv4 sockets.

Note

TCP sockets cannot be used to talk to a SpiNNaker board.

spinnman.utilities.socket_utils.get_udp_socket()[source]

Wrapper round socket() system call to produce UDP/IPv4 sockets.

spinnman.utilities.socket_utils.receive_message(sock, timeout, size)[source]

Wrapper round recv() system call.

spinnman.utilities.socket_utils.receive_message_and_address(sock, timeout, size)[source]

Wrapper round recvfrom() system call.

spinnman.utilities.socket_utils.resolve_host(host)[source]

Wrapper round gethostbyname() system call.

spinnman.utilities.socket_utils.send_message(sock, data)[source]

Wrapper round send() system call.

spinnman.utilities.socket_utils.send_message_to_address(sock, data, address)[source]

Wrapper round sendto() system call.

spinnman.utilities.socket_utils.set_receive_buffer_size(sock, size)[source]

Wrapper round setsockopt() system call.

spinnman.utilities.utility_functions module
spinnman.utilities.utility_functions.get_vcpu_address(p)[source]

Get the address of the vcpu_t structure for the given core

Parameters:p (int) – The core
Return type:int
spinnman.utilities.utility_functions.reprogram_tag(connection: spinnman.connections.udp_packet_connections.SCAMPConnection, tag: int, strip: bool = True)[source]

Reprogram an IP Tag to send responses to a given SCAMPConnection

Parameters:
  • connection (SCAMPConnection) – The connection to target the tag at
  • tag (int) – The id of the tag to set
  • strip (bool) – True if the tag should strip SDP headers from outgoing messages
Raises:

SpinnmanTimeoutException – If things time out several times

spinnman.utilities.utility_functions.reprogram_tag_to_listener(connection: spinnman.connections.udp_packet_connections.UDPConnection, x: int, y: int, ip_address: str, tag: int, strip: bool = True)[source]

Reprogram an IP Tag to send responses to a given connection that is not connected to a specific board. Such connections are normally receive-only connections.

Parameters:
  • connection (UDPConnection) – The connection to target the tag at
  • x (int) – The X coordinate of the ethernet chip that should send to the connection
  • y (int) – The Y coordinate of the ethernet chip that should send to the connection
  • ip_address (str) – The IP address of the ethernet chip that should be given the message
  • tag (int) – The id of the tag to set
  • strip (bool) – True if the tag should strip SDP headers from outgoing messages
Raises:

SpinnmanTimeoutException – If things time out several times

spinnman.utilities.utility_functions.send_port_trigger_message(connection, board_address)[source]

Sends a port trigger message using a connection to (hopefully) open a port in a NAT and/or firewall to allow incoming packets to be received.

Parameters:
  • connection (UDPConnection) – The UDP connection down which the trigger message should be sent
  • board_address (str) – The IP address of the SpiNNaker board to which the message should be sent
spinnman.utilities.utility_functions.work_out_bmp_from_machine_details(hostname, number_of_boards)[source]

Work out the BMP connection IP address given the machine details. This is assumed to be the IP address of the machine, with 1 subtracted from the final part e.g. if the machine IP address is 192.168.0.5, the BMP IP address is assumed to be 192.168.0.4

Parameters:
  • hostname (str) – the SpiNNaker machine main hostname or IP address
  • number_of_boards (int) – the number of boards in the machine
Returns:

The BMP connection data

Return type:

BMPConnectionData

Module contents
Submodules
spinnman.config_setup module
spinnman.config_setup.add_spinnman_cfg()[source]

Add the local cfg and all dependent cfg files.

spinnman.config_setup.unittest_setup()[source]

Resets the configs so only the local default config is included.

Note

This file should only be called from SpiNNMan/unittests

spinnman.constants module
spinnman.constants.BMP_ADC_MAX = 4096

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

spinnman.constants.BMP_MISSING_FAN = -1

Fan speed value returned when a fan is absent.

spinnman.constants.BMP_MISSING_TEMP = -32768

Temperature value returned when a probe is not connected.

spinnman.constants.BMP_POST_POWER_ON_SLEEP_TIME = 5.0

Time to sleep after powering on boards

spinnman.constants.BMP_POWER_ON_TIMEOUT = 10.0

Timeout for BMP power-on commands to reply.

spinnman.constants.BMP_TEMP_SCALE = 0.00390625

Multiplier to convert from temperature probe values to degrees Celsius.

spinnman.constants.BMP_TIMEOUT = 0.5

Timeout for other BMP commands to reply

spinnman.constants.BMP_V_SCALE_12 = 0.003662109375

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

spinnman.constants.BMP_V_SCALE_2_5 = 0.0006103515625

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

spinnman.constants.BMP_V_SCALE_3_3 = 0.00091552734375

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

spinnman.constants.BOOT_RETRIES = 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 = 128

How many bytes the CPU info data takes up

spinnman.constants.CPU_INFO_OFFSET = 3842011136

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

spinnman.constants.CPU_IOBUF_ADDRESS_OFFSET = 88

The address at which the iobuf address starts

spinnman.constants.CPU_USER_0_START_ADDRESS = 112

The address at which user0 register starts

spinnman.constants.CPU_USER_1_START_ADDRESS = 116

The address at which user1 register starts

spinnman.constants.CPU_USER_2_START_ADDRESS = 120

The address at which user2 register starts

spinnman.constants.CPU_USER_3_START_ADDRESS = 124

The address at which user3 register starts

class spinnman.constants.EIEIO_COMMAND_IDS[source]

Bases: enum.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[source]

Bases: enum.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 = 7

Max user requested tag value

spinnman.constants.NO_ROUTER_DIAGNOSTIC_FILTERS = 16

Number of router diagnostic filters

spinnman.constants.N_RETRIES = 10

This is the default number of retries when using SCP

class spinnman.constants.READ_TYPES[source]

Bases: enum.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 = 11

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

spinnman.constants.ROUTER_DIAGNOSTIC_FILTER_SIZE = 4

Size of a router diagnostic filter control register in bytes

spinnman.constants.ROUTER_FILTER_CONTROLS_OFFSET = 512

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

spinnman.constants.ROUTER_REGISTER_BASE_ADDRESS = 3774873600

The base address of a routers diagnostic filter controls

spinnman.constants.ROUTER_REGISTER_P2P_ADDRESS = 3774939136

The base address of a routers p2p routing table

class spinnman.constants.ROUTER_REGISTER_REGISTERS[source]

Bases: enum.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 = 17893

The default port of the connection

spinnman.constants.SCP_TIMEOUT = 1.0

This is the default timeout when using SCP

spinnman.constants.SYSTEM_VARIABLE_BASE_ADDRESS = 4110450432

The base address of the system variable structure in System ram

spinnman.constants.SYSTEM_VARIABLE_BYTES = 256

The size of the system variable structure in bytes

spinnman.constants.UDP_BOOT_CONNECTION_DEFAULT_PORT = 54321

The default port of the connection

spinnman.constants.UDP_MESSAGE_MAX_SIZE = 256

The max size a UDP packet can be, excluding headers

spinnman.constants.address_length_dtype = {(0, 0): <READ_TYPES.WORD: 2>, (0, 1): <READ_TYPES.BYTE: 0>, (0, 2): <READ_TYPES.HALF_WORD: 1>, (0, 3): <READ_TYPES.BYTE: 0>, (1, 0): <READ_TYPES.BYTE: 0>, (1, 1): <READ_TYPES.BYTE: 0>, (1, 2): <READ_TYPES.BYTE: 0>, (1, 3): <READ_TYPES.BYTE: 0>, (2, 0): <READ_TYPES.HALF_WORD: 1>, (2, 1): <READ_TYPES.BYTE: 0>, (2, 2): <READ_TYPES.HALF_WORD: 1>, (2, 3): <READ_TYPES.BYTE: 0>, (3, 0): <READ_TYPES.BYTE: 0>, (3, 1): <READ_TYPES.BYTE: 0>, (3, 2): <READ_TYPES.BYTE: 0>, (3, 3): <READ_TYPES.BYTE: 0>}

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: spinnman.exceptions.SpinnmanException

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

exception spinnman.exceptions.SpiNNManCoresNotInStateException(timeout, expected_states, failed_core_states)[source]

Bases: spinnman.exceptions.SpinnmanTimeoutException

Cores failed to reach a given state within a timeout.

Parameters:
failed_core_states()[source]
Return type:CPUInfos
exception spinnman.exceptions.SpinnmanEIEIOPacketParsingException(parsing_format, packet)[source]

Bases: spinnman.exceptions.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) –
packet
Return type:bytes
exception spinnman.exceptions.SpinnmanEOFException[source]

Bases: spinnman.exceptions.SpinnmanIOException

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

exception spinnman.exceptions.SpinnmanException[source]

Bases: Exception

Superclass of exceptions that occur when dealing with communication with SpiNNaker

exception spinnman.exceptions.SpinnmanGenericProcessException(exception, tb, x, y, p, phys_p, tb2=None)[source]

Bases: spinnman.exceptions.SpinnmanException

Encapsulates exceptions from processes which communicate with some core/chip

Parameters:
exception
Return type:Exception
exception spinnman.exceptions.SpinnmanGroupedProcessException(error_requests, exceptions, tracebacks, connections)[source]

Bases: spinnman.exceptions.SpinnmanException

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

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

Bases: spinnman.exceptions.SpinnmanException

An exception that something went wrong with the underlying IO

Parameters:problem (str) – The problem with the IO
problem

The problem with IO

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

Bases: spinnman.exceptions.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
packet_type

The packet type

problem

The problem with the packet

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

Bases: spinnman.exceptions.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
parameter

The parameter with an invalid value

problem

The problem with the parameter value

value

The value that is invalid

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

Bases: spinnman.exceptions.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
parameter

The parameter with an invalid value

problem

The problem with the parameter value

type

The value that is invalid

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

Bases: spinnman.exceptions.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
operation

The operation that was performed

timeout

The timeout value in seconds

exception spinnman.exceptions.SpinnmanUnexpectedResponseCodeException(operation, command, response)[source]

Bases: spinnman.exceptions.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
command

The command being executed

operation

The operation being performed

response

The unexpected response

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

Bases: spinnman.exceptions.SpinnmanException

An exception that indicates that the given operation is not supported

Parameters:operation (str) – The operation being requested
operation

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.

spinnman.transceiver module
class spinnman.transceiver.Transceiver(version, connections=None)[source]

Bases: spinn_utilities.abstract_context_manager.AbstractContextManager

An encapsulation of various communications with the SpiNNaker board.

The methods of this class are designed to be thread-safe (provided they do not access a BMP, as access to those is never thread-safe); thus you can make multiple calls to the same (or different) methods from multiple threads and expect each call to work as if it had been called sequentially, although the order of returns is not guaranteed.

Note

With multiple connections to the board, using multiple threads in this way may result in an increase in the overall speed of operation, since the multiple calls may be made separately over the set of given connections.

Parameters:
  • version (int) – The version of the board being connected to
  • connections (list(Connection)) – An iterable of connections to the board. If not specified, no communication will be possible until connections are found.
Raises:
add_scamp_connections(connections)[source]

Check connections to the board and store these for future use.

Note

An exception will be thrown if no initial connections can be found to the board.

Parameters:

connections (dict((int,int),str)) – Dict of x,y to ip address

Raises:
bmp_connection

The BMP connections.

Warning

This property is currently deprecated and likely to be removed.

Return type:dict(tuple(int,int),MostDirectConnectionSelector)
boot_board(number_of_boards=None, width=None, height=None, extra_boot_values=None)[source]

Attempt to boot the board. No check is performed to see if the board is already booted.

Parameters:
  • number_of_boards – this parameter is deprecated
  • width – this parameter is deprecated
  • height – this parameter is deprecated
  • extra_boot_values (dict(SystemVariableDefinition,object)) – extra values to set during boot
Raises:
clear_ip_tag(tag, board_address=None)[source]

Clear the setting of an IP tag

Parameters:
  • tag (int) – The tag ID
  • board_address (str) – Board address where the tag should be cleared. If not specified, all AbstractSCPConnection connections will send the message to clear the tag
Raises:
clear_multicast_routes(x, y)[source]

Remove all the multicast routes on a chip

Parameters:
  • x (int) – The x-coordinate of the chip on which to clear the routes
  • y (int) – The y-coordinate of the chip on which to clear the routes
Raises:
clear_router_diagnostic_counters(x, y, enable=True, counter_ids=None)[source]

Clear router diagnostic information on a chip

Parameters:
  • x (int) – The x-coordinate of the chip
  • y (int) – The y-coordinate of the chip
  • enable (bool) – True (default) if the counters should be enabled
  • counter_ids (iterable(int)) – The IDs of the counters to reset (all by default) and enable if enable is True; each must be between 0 and 15
Raises:
close()[source]

Close the transceiver and any threads that are running

control_sync(do_sync)[source]

Control the synchronization of the chips

Parameters:do_sync (bool) – Whether to synchonize or not
discover_scamp_connections()[source]

Find connections to the board and store these for future use.

Note

An exception will be thrown if no initial connections can be found to the board.

Raises:
ensure_board_is_ready(number_of_boards=None, width=None, height=None, n_retries=5, extra_boot_values=None)[source]

Ensure that the board is ready to interact with this version of the transceiver. Boots the board if not already booted and verifies that the version of SCAMP running is compatible with this transceiver.

Parameters:
  • number_of_boards (int or None) – this parameter is deprecated and will be ignored
  • width (int or None) – this parameter is deprecated and will be ignored
  • height (int or None) – this parameter is deprecated and will be ignored
  • n_retries (int) – The number of times to retry booting
  • extra_boot_values (dict(SystemVariableDefinition,object)) – Any additional values to set during boot
Returns:

The version identifier

Return type:

VersionInfo

Raise:

SpinnmanIOException: * If there is a problem booting the board * If the version of software on the board is not compatible with this transceiver

execute(x, y, processors, executable, app_id, n_bytes=None, wait=False, is_filename=False)[source]

Start an executable running on a single chip

Warning

This method is currently deprecated and likely to be removed.

Parameters:
  • x (int) – The x-coordinate of the chip on which to run the executable
  • y (int) – The y-coordinate of the chip on which to run the executable
  • processors (list(int)) – The cores on the chip on which to run the application
  • executable (RawIOBase or bytes or bytearray or str) –

    The data that is to be executed. Should be one of the following:

    • An instance of RawIOBase
    • A bytearray/bytes
    • A filename of a file containing the executable (in which case is_filename must be set to True)
  • app_id (int) – The ID of the application with which to associate the executable
  • n_bytes (int) –

    The size of the executable data in bytes. If not specified:

    • If executable is an RawIOBase, an error is raised
    • If executable is a bytearray, the length of the bytearray will be used
    • If executable is an int, 4 will be used
    • If executable is a str, the length of the file will be used
  • wait (bool) – True if the binary should enter a “wait” state on loading
  • is_filename (bool) – True if executable is a filename
Raises:
execute_application(executable_targets, app_id)[source]

Execute a set of binaries that make up a complete application on specified cores, wait for them to be ready and then start all of the binaries.

Note

This will get the binaries into c_main but will not signal the barrier.

Parameters:
  • executable_targets (ExecutableTargets) – The binaries to be executed and the cores to execute them on
  • app_id (int) – The app_id to give this application
execute_flood(core_subsets, executable, app_id, n_bytes=None, wait=False, is_filename=False)[source]

Start an executable running on multiple places on the board. This will be optimised based on the selected cores, but it may still require a number of communications with the board to execute.

Parameters:
  • core_subsets (CoreSubsets) – Which cores on which chips to start the executable
  • executable (RawIOBase or bytes or bytearray or str) –

    The data that is to be executed. Should be one of the following:

    • An instance of RawIOBase
    • A bytearray
    • A filename of an executable (in which case is_filename must be set to True)
  • app_id (int) – The ID of the application with which to associate the executable
  • n_bytes (int) –

    The size of the executable data in bytes. If not specified:

    • If executable is an RawIOBase, an error is raised
    • If executable is a bytearray, the length of the bytearray will be used
    • If executable is an int, 4 will be used
    • If executable is a str, the length of the file will be used
  • wait (bool) – True if the processors should enter a “wait” state on loading
  • is_filename (bool) – True if the data is a filename
Raises:
  • SpinnmanIOException
    • If there is an error communicating with the board
    • If there is an error reading the executable
  • SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
  • SpinnmanInvalidParameterException
    • If one of the specified cores is not valid
    • If app_id is an invalid application ID
    • If a packet is received that has invalid parameters
    • If executable is an RawIOBase but n_bytes is not specified
    • If executable is an int and n_bytes is more than 4
    • If n_bytes is less than 0
  • SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
free_sdram(x, y, base_address, app_id)[source]

Free allocated SDRAM

Warning

This method is currently deprecated and likely to be removed.

Parameters:
  • x (int) – The x-coordinate of the chip onto which to ask for memory
  • y (int) – The y-coordinate of the chip onto which to ask for memory
  • base_address (int) – The base address of the allocated memory
  • app_id (int) – The app ID of the allocated memory
free_sdram_by_app_id(x, y, app_id)[source]

Free all SDRAM allocated to a given app ID

Warning

This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.

Parameters:
  • x (int) – The x-coordinate of the chip onto which to ask for memory
  • y (int) – The y-coordinate of the chip onto which to ask for memory
  • app_id (int) – The app ID of the allocated memory
Returns:

The number of blocks freed

Return type:

int

get_connections()[source]

Get the currently known connections to the board, made up of those passed in to the transceiver and those that are discovered during calls to discover_connections. No further discovery is done here.

Returns:An iterable of connections known to the transceiver
Return type:list(Connection)
get_core_state_count(app_id, state)[source]

Get a count of the number of cores which have a given state

Parameters:
  • app_id (int) – The ID of the application from which to get the count.
  • state (CPUState) – The state count to get
Returns:

A count of the cores with the given status

Return type:

int

Raises:
get_core_status_string(cpu_infos)[source]

Get a string indicating the status of the given cores

Parameters:cpu_infos (CPUInfos) – A CPUInfos objects
Return type:str
get_cores_in_state(all_core_subsets, states)[source]

Get all cores that are in a given state or set of states

Parameters:
Returns:

Core subsets object containing cores in the given state(s)

Return type:

CPUInfos

get_cores_not_in_state(all_core_subsets, states)[source]

Get all cores that are not in a given state or set of states

Parameters:
Returns:

Core subsets object containing cores not in the given state(s)

Return type:

CoreSubsets

get_cpu_information(core_subsets=None)[source]

Get information about the processors on the board

Parameters:

core_subsets (CoreSubsets) – A set of chips and cores from which to get the information. If not specified, the information from all of the cores on all of the chips on the board are obtained.

Returns:

An iterable of the CPU information for the selected cores, or all cores if core_subsets is not specified

Return type:

list(CPUInfo)

Raises:
get_cpu_information_from_core(x, y, p)[source]

Get information about a specific processor on the board

Parameters:
  • x (int) – The x-coordinate of the chip containing the processor
  • y (int) – The y-coordinate of the chip containing the processor
  • p (int) – The ID of the processor to get the information about
Returns:

The CPU information for the selected core

Return type:

CPUInfo

Raises:
get_heap(x, y, heap=<SystemVariableDefinition.sdram_heap_address: _Definition(offset=76, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The base address of the user SDRAM heap')>)[source]

Get the contents of the given heap on a given chip

Parameters:
  • x (int) – The x-coordinate of the chip
  • y (int) – The y-coordinate of the chip
  • heap (SystemVariableDefinition) – The SystemVariableDefinition which is the heap to read
Return type:

list(HeapElement)

get_iobuf(core_subsets=None)[source]

Get the contents of the IOBUF buffer for a number of processors

Parameters:

core_subsets (CoreSubsets) – A set of chips and cores from which to get the buffers. If not specified, the buffers from all of the cores on all of the chips on the board are obtained.

Returns:

An iterable of the buffers, which may not be in the order of core_subsets

Return type:

iterable(IOBuffer)

Raises:
get_iobuf_from_core(x, y, p)[source]

Get the contents of IOBUF for a given core

Warning

This method is currently deprecated and likely to be removed.

Parameters:
  • x (int) – The x-coordinate of the chip containing the processor
  • y (int) – The y-coordinate of the chip containing the processor
  • p (int) – The ID of the processor to get the IOBUF for
Returns:

An IOBUF buffer

Return type:

IOBuffer

Raises:
get_machine_details()[source]

Get the details of the machine made up of chips on a board and how they are connected to each other.

Returns:

A machine description

Return type:

Machine

Raises:
get_machine_dimensions()[source]

Get the maximum chip x-coordinate and maximum chip y-coordinate of the chips in the machine

Returns:

The dimensions of the machine

Return type:

MachineDimensions

Raises:
get_multicast_routes(x, y, app_id=None)[source]

Get the current multicast routes set up on a chip

Parameters:
  • x (int) – The x-coordinate of the chip from which to get the routes
  • y (int) – The y-coordinate of the chip from which to get the routes
  • app_id (int) – The ID of the application to filter the routes for. If not specified, will return all routes
Returns:

An iterable of multicast routes

Return type:

list(MulticastRoutingEntry)

Raises:
get_router_diagnostic_filter(x, y, position)[source]

Gets a router diagnostic filter from a router

Parameters:
  • x (int) – the X address of the router from which this filter is being retrieved
  • y (int) – the Y address of the router from which this filter is being retrieved
  • position (int) – the position in the list of filters to read the information from
Returns:

The diagnostic filter read

Return type:

DiagnosticFilter

Raises:
get_router_diagnostics(x, y)[source]

Get router diagnostic information from a chip

Parameters:
  • x (int) – The x-coordinate of the chip from which to get the information
  • y (int) – The y-coordinate of the chip from which to get the information
Returns:

The router diagnostic information

Return type:

RouterDiagnostics

Raises:
get_scamp_version(chip_x=255, chip_y=255, connection_selector=None, n_retries=10)[source]

Get the version of SCAMP which is running on the board.

Parameters:
  • chip_x (int) – the chip’s x coordinate to query for SCAMP version
  • chip_y (int) – the chip’s y coordinate to query for SCAMP version
  • connection_selector (AbstractMultiConnectionProcessConnectionSelector) – the connection to send the SCAMP version or none (if none then a random SCAMP connection is used).
  • n_retries (int) –
Returns:

The version identifier

Return type:

VersionInfo

Raises:
get_tags(connection=None)[source]

Get the current set of tags that have been set on the board

Parameters:

connection (AbstractSCPConnection) – Connection from which the tags should be received. If not specified, all AbstractSCPConnection connections will be queried and the response will be combined.

Returns:

An iterable of tags

Return type:

iterable(AbstractTag)

Raises:
static get_user_0_register_address_from_core(p)[source]

Get the address of user 0 for a given processor on the board

Note

Conventionally, user_0 usually holds the address of the table of memory regions.

Parameters:p (int) – The ID of the processor to get the user 0 address from
Returns:The address for user 0 register for this processor
Return type:int
static get_user_1_register_address_from_core(p)[source]

Get the address of user 1 for a given processor on the board

Parameters:p (int) – The ID of the processor to get the user 1 address from
Returns:The address for user 1 register for this processor
Return type:int
static get_user_2_register_address_from_core(p)[source]

Get the address of user 2 for a given processor on the board

Parameters:p (int) – The ID of the processor to get the user 2 address from
Returns:The address for user 2 register for this processor
Return type:int
static get_user_3_register_address_from_core(p)[source]

Get the address of user 3 for a given processor on the board

Parameters:p (int) – The ID of the processor to get the user 3 address from
Returns:The address for user 3 register for this processor
Return type:int
is_connected(connection=None)[source]

Determines if the board can be contacted

Parameters:connection (Connection) – The connection which is to be tested. If None, all connections will be tested, and the board will be considered to be connected if any one connection works.
Returns:True if the board can be contacted, False otherwise
Return type:bool
static is_scamp_version_compabible(version)[source]

Determine if the version of SCAMP is compatible with this transceiver

Parameters:version (tuple(int,int,int)) – The version to test
Return type:bool
load_fixed_route(x, y, fixed_route, app_id)[source]

Loads a fixed route routing table entry onto a chip’s router.

Parameters:
  • x (int) – The x-coordinate of the chip onto which to load the routes
  • y (int) – The y-coordinate of the chip onto which to load the routes
  • fixed_route (FixedRouteEntry) – the route for the fixed route entry on this chip
  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.
Raises:
load_multicast_routes(x, y, routes, app_id)[source]

Load a set of multicast routes on to a chip

Parameters:
  • x (int) – The x-coordinate of the chip onto which to load the routes
  • y (int) – The y-coordinate of the chip onto which to load the routes
  • routes (iterable(MulticastRoutingEntry)) – An iterable of multicast routes to load
  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.
Raises:
locate_spinnaker_connection_for_board_address(board_address)[source]

Find a connection that matches the given board IP address

Parameters:board_address (str) – The IP address of the Ethernet connection on the board
Returns:A connection for the given IP address, or None if no such connection exists
Return type:SCAMPConnection
malloc_sdram(x, y, size, app_id, tag=None)[source]

Allocates a chunk of SDRAM on a chip on the machine

Parameters:
  • x (int) – The x-coordinate of the chip onto which to ask for memory
  • y (int) – The y-coordinate of the chip onto which to ask for memory
  • size (int) – the amount of memory to allocate in bytes
  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.
  • tag (int) – the tag for the SDRAM, a 8-bit (chip-wide) tag that can be looked up by a SpiNNaker application to discover the address of the allocated block. If 0 then no tag is applied.
Returns:

the base address of the allocated memory

Return type:

int

number_of_boards_located

The number of boards currently configured.

Warning

This method is currently deprecated and likely to be removed.

Return type:int
power_off(boards=0, cabinet=0, frame=0)[source]

Power off a set of boards in the machine

Parameters:
  • boards (int) – The board or boards to power off
  • cabinet (int) – the ID of the cabinet containing the frame, or 0 if the frame is not in a cabinet
  • frame (int) – the ID of the frame in the cabinet containing the board(s), or 0 if the board is not in a frame
power_off_machine()[source]

Power off the whole machine :rtype bool :return success or failure to power off the machine

power_on(boards=0, cabinet=0, frame=0)[source]

Power on a set of boards in the machine

Parameters:
  • boards (int) – The board or boards to power on
  • cabinet (int) – the ID of the cabinet containing the frame, or 0 if the frame is not in a cabinet
  • frame (int) – the ID of the frame in the cabinet containing the board(s), or 0 if the board is not in a frame
power_on_machine()[source]

Power on the whole machine :rtype bool :return success of failure to power on machine

read_adc_data(board, cabinet, frame)[source]

Read the BMP ADC data

Warning

This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.

Parameters:
  • cabinet (int) – cabinet: the cabinet this is targeting
  • frame (int) – the frame this is targeting
  • board (int) – which board to request the ADC data from
Returns:

the FPGA’s ADC data object

Return type:

ADCInfo

read_bmp_version(board, cabinet, frame)[source]

Read the BMP version

Parameters:
  • cabinet (int) – cabinet: the cabinet this is targeting
  • frame (int) – the frame this is targeting
  • board (int) – which board to request the data from
Returns:

the sver from the BMP

read_fixed_route(x, y, app_id)[source]

Reads a fixed route routing table entry from a chip’s router.

Parameters:
  • x (int) – The x-coordinate of the chip onto which to load the routes
  • y (int) – The y-coordinate of the chip onto which to load the routes
  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.
Returns:

the route as a fixed route entry

read_fpga_register(fpga_num, register, cabinet, frame, board)[source]

Read a register on a FPGA of a board. The meaning of the register’s contents will depend on the FPGA’s configuration.

Parameters:
  • fpga_num (int) – FPGA number (0, 1 or 2) to communicate with.
  • register (int) – Register address to read to (will be rounded down to the nearest 32-bit word boundary).
  • cabinet (int) – cabinet: the cabinet this is targeting
  • frame (int) – the frame this is targeting
  • board (int) – which board to request the FPGA register from
Returns:

the register data

Return type:

int

read_memory(x, y, base_address, length, cpu=0)[source]

Read some areas of memory (usually SDRAM) from the board.

Parameters:
  • x (int) – The x-coordinate of the chip where the memory is to be read from
  • y (int) – The y-coordinate of the chip where the memory is to be read from
  • base_address (int) – The address in SDRAM where the region of memory to be read starts
  • length (int) – The length of the data to be read in bytes
  • cpu (int) – the core ID used to read the memory of; should usually be 0 when reading from SDRAM, but may be other values when reading from DTCM.
Returns:

A bytearray of data read

Return type:

bytes

Raises:
read_neighbour_memory(x, y, link, base_address, length, cpu=0)[source]

Read some areas of memory on a neighbouring chip using a LINK_READ SCP command. If sent to a BMP, this command can be used to communicate with the FPGAs’ debug registers.

Warning

This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.

Parameters:
  • x (int) – The x-coordinate of the chip whose neighbour is to be read from
  • y (int) – The y-coordinate of the chip whose neighbour is to be read from
  • cpu (int) – The CPU to use, typically 0 (or if a BMP, the slot number)
  • link (int) – The link index to send the request to (or if BMP, the FPGA number)
  • base_address (int) – The address in SDRAM where the region of memory to be read starts
  • length (int) – The length of the data to be read in bytes
Returns:

An iterable of chunks of data read in order

Return type:

bytes

Raises:
read_user_0(x, y, p)[source]

Get the contents of the user_0 register for the given processor.

Note

Conventionally, user_0 usually holds the address of the table of memory regions.

Parameters:
  • x (int) – X coordinate of the chip
  • y (int) – Y coordinate of the chip
  • p (int) – Virtual processor identifier on the chip
Return type:

int

Raises:
read_user_1(x, y, p)[source]

Get the contents of the user_1 register for the given processor.

Parameters:
  • x (int) – X coordinate of the chip
  • y (int) – Y coordinate of the chip
  • p (int) – Virtual processor identifier on the chip
Return type:

int

Raises:
read_word(x, y, base_address, cpu=0)[source]

Read a word (usually of SDRAM) from the board.

Parameters:
  • x (int) – The x-coordinate of the chip where the word is to be read from
  • y (int) – The y-coordinate of the chip where the word is to be read from
  • base_address (int) – The address (usually in SDRAM) where the word to be read starts
  • cpu (int) – the core ID used to read the word; should usually be 0 when reading from SDRAM, but may be other values when reading from DTCM.
Returns:

The unsigned integer value at base_address

Return type:

int

Raises:
send_scp_message(message, connection=None)[source]

Sends an SCP message, without expecting a response

Parameters:
Raises:
send_sdp_message(message, connection=None)[source]

Sends an SDP message using one of the connections.

Parameters:
send_signal(app_id, signal)[source]

Send a signal to an application

Parameters:
  • app_id (int) – The ID of the application to send to
  • signal (Signal) – The signal to send
Raises:
set_ip_tag(ip_tag, use_sender=False)[source]

Set up an IP tag

Parameters:
  • ip_tag (IPTag) – The tag to set up; note board_address can be None, in which case, the tag will be assigned to all boards
  • use_sender (bool) – Optionally use the sender host and port instead of the given host and port in the tag
Raises:
set_led(led, action, board, cabinet, frame)[source]

Set the LED state of a board in the machine

Warning

This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.

Parameters:
  • led (int or iterable(int)) – Number of the LED or an iterable of LEDs to set the state of (0-7)
  • action (LEDAction) – State to set the LED to, either on, off or toggle
  • board (int or iterable(int)) – Specifies the board to control the LEDs of. This may also be an iterable of multiple boards (in the same frame). The command will actually be sent to the first board in the iterable.
  • cabinet (int) – the cabinet this is targeting
  • frame (int) – the frame this is targeting
set_leds(x, y, cpu, led_states)[source]

Set SetLED states.

Warning

The set_leds is deprecated and untested due to no known use.

Parameters:
  • x (int) – The x-coordinate of the chip on which to set the LEDs
  • y (int) – The x-coordinate of the chip on which to set the LEDs
  • cpu (int) – The CPU of the chip on which to set the LEDs
  • led_states (dict(int,int)) – A dictionary mapping SetLED index to state with 0 being off, 1 on and 2 inverted.
Raises:
set_reverse_ip_tag(reverse_ip_tag)[source]

Set up a reverse IP tag

Parameters:

reverse_ip_tag (ReverseIPTag) – The reverse tag to set up; note board_address can be None, in which case, the tag will be assigned to all boards

Raises:
set_router_diagnostic_filter(x, y, position, diagnostic_filter)[source]

Sets a router diagnostic filter in a router

Parameters:
  • x (int) – the X address of the router in which this filter is being set
  • y (int) – the Y address of the router in which this filter is being set
  • position (int) – the position in the list of filters where this filter is to be added
  • diagnostic_filter (DiagnosticFilter) – the diagnostic filter being set in the placed, between 0 and 15 (note that positions 0 to 11 are used by the default filters, and setting these positions will result in a warning).
Raises:
set_watch_dog(watch_dog)[source]

Enable, disable or set the value of the watch dog timer

Warning

This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.

Parameters:watch_dog (bool or int) – Either a boolean indicating whether to enable (True) or disable (False) the watch dog timer, or an int value to set the timer count to.
set_watch_dog_on_chip(x, y, watch_dog)[source]

Enable, disable or set the value of the watch dog timer on a specific chip

Warning

This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.

Parameters:
  • x (int) – chip x coord to write new watchdog param to
  • y (int) – chip y coord to write new watchdog param to
  • watch_dog (bool or int) – Either a boolean indicating whether to enable (True) or disable (False) the watchdog timer, or an int value to set the timer count to
stop_application(app_id)[source]

Sends a stop request for an app_id

Parameters:

app_id (int) – The ID of the application to send to

Raises:
wait_for_cores_to_be_in_state(all_core_subsets, app_id, cpu_states, timeout=None, time_between_polls=0.1, error_states=frozenset({<CPUState.WATCHDOG: 3>, <CPUState.RUN_TIME_EXCEPTION: 2>}), counts_between_full_check=100, progress_bar=None)[source]

Waits for the specified cores running the given application to be in some target state or states. Handles failures.

Parameters:
  • all_core_subsets (CoreSubsets) – the cores to check are in a given sync state
  • app_id (int) – the application ID that being used by the simulation
  • cpu_states (set(CPUState)) – The expected states once the applications are ready; success is when each application is in one of these states
  • timeout (float) – The amount of time to wait in seconds for the cores to reach one of the states
  • time_between_polls (float) – Time between checking the state
  • error_states (set(CPUState)) – Set of states that the application can be in that indicate an error, and so should raise an exception
  • counts_between_full_check (int) – The number of times to use the count signal before instead using the full CPU state check
  • progress_bar (ProgressBar or None) – Possible progress bar to update.
Raises:

SpinnmanTimeoutException – If a timeout is specified and exceeded.

write_fpga_register(fpga_num, register, value, cabinet, frame, board)[source]

Write a register on a FPGA of a board. The meaning of setting the register’s contents will depend on the FPGA’s configuration.

Parameters:
  • fpga_num (int) – FPGA number (0, 1 or 2) to communicate with.
  • register (int) – Register address to read to (will be rounded down to the nearest 32-bit word boundary).
  • value (int) – the value to write into the FPGA register
  • cabinet (int) – cabinet: the cabinet this is targeting
  • frame (int) – the frame this is targeting
  • board (int) – which board to write the FPGA register to
write_memory(x, y, base_address, data, n_bytes=None, offset=0, cpu=0, is_filename=False, get_sum=False)[source]

Write to the SDRAM on the board.

Parameters:
  • x (int) – The x-coordinate of the chip where the memory is to be written to
  • y (int) – The y-coordinate of the chip where the memory is to be written to
  • base_address (int) – The address in SDRAM where the region of memory is to be written
  • data (RawIOBase or bytes or bytearray or int or str) –

    The data to write. Should be one of the following:

    • An instance of RawIOBase
    • A bytearray/bytes
    • A single integer - will be written in little-endian byte order
    • A filename of a data file (in which case is_filename must be set to True)
  • n_bytes (int) –

    The amount of data to be written in bytes. If not specified:

    • If data is an RawIOBase, an error is raised
    • If data is a bytearray, the length of the bytearray will be used
    • If data is an int, 4 will be used
    • If data is a str, the length of the file will be used
  • offset (int) – The offset from which the valid data begins
  • cpu (int) – The optional CPU to write to
  • is_filename (bool) – True if data is a filename
  • get_sum (bool) – whether to return a checksum or 0
Returns:

The number of bytes written, the checksum (0 if get_sum=False)

Return type:

int, int

Raises:
write_memory_flood(base_address, data, n_bytes=None, offset=0, is_filename=False)[source]

Write to the SDRAM of all chips.

Parameters:
  • base_address (int) – The address in SDRAM where the region of memory is to be written
  • data (RawIOBase or bytes or bytearray or int or str) –

    The data that is to be written. Should be one of the following:

    • An instance of RawIOBase
    • A bytearray or bytestring
    • A single integer
    • A file name of a file to read (in which case is_filename should be set to True)
  • n_bytes (int) –

    The amount of data to be written in bytes. If not specified:

    • If data is an RawIOBase, an error is raised
    • If data is a bytearray, the length of the bytearray will be used
    • If data is an int, 4 will be used
    • If data is a str, the size of the file will be used
  • offset (int) – The offset where the valid data starts; if data is an int, then the offset will be ignored and 0 is used.
  • is_filename (bool) – True if data should be interpreted as a file name
Raises:
write_neighbour_memory(x, y, link, base_address, data, n_bytes=None, offset=0, cpu=0)[source]

Write to the memory of a neighbouring chip using a LINK_READ SCP command. If sent to a BMP, this command can be used to communicate with the FPGAs’ debug registers.

Warning

This method is deprecated and untested due to no known use.

Parameters:
  • x (int) – The x-coordinate of the chip whose neighbour is to be written to
  • y (int) – The y-coordinate of the chip whose neighbour is to be written to
  • link (int) – The link index to send the request to (or if BMP, the FPGA number)
  • base_address (int) – The address in SDRAM where the region of memory is to be written
  • data (RawIOBase or bytes or bytearray or int) –

    The data to write. Should be one of the following:

    • An instance of RawIOBase
    • A bytearray/bytes
    • A single integer; will be written in little-endian byte order
  • n_bytes (int) –

    The amount of data to be written in bytes. If not specified:

    • If data is an RawIOBase, an error is raised
    • If data is a bytearray, the length of the bytearray will be used
    • If data is an int, 4 will be used
  • offset (int) – The offset where the valid data starts (if data is an int then offset will be ignored and used 0)
  • cpu (int) – The CPU to use, typically 0 (or if a BMP, the slot number)
Raises:
write_user_0(x, y, p, value)[source]

Write to the user_0 register for the given processor.

Note

Conventionally, user_0 usually holds the address of the table of memory regions.

Parameters:
  • x (int) – X coordinate of the chip
  • y (int) – Y coordinate of the chip
  • p (int) – Virtual processor identifier on the chip
  • value (int) – The value to write
Raises:
write_user_1(x, y, p, value)[source]

Write to the user_1 register for the given processor.

Parameters:
  • x (int) – X coordinate of the chip
  • y (int) – Y coordinate of the chip
  • p (int) – Virtual processor identifier on the chip
  • value (int) – The value to write
Raises:
spinnman.transceiver.create_transceiver_from_hostname(hostname, version, bmp_connection_data=None, number_of_boards=None, auto_detect_bmp=False)[source]

Create a Transceiver by creating a UDPConnection to the given hostname on port 17893 (the default SCAMP port), and a BootConnection on port 54321 (the default boot port), optionally discovering any additional links using the UDPConnection, and then returning the transceiver created with the conjunction of the created UDPConnection and the discovered connections.

Parameters:
  • hostname (str or None) – The hostname or IP address of the board or None if only the BMP conenctions are of interest
  • number_of_boards (int or None) – a number of boards expected to be supported, or None, which defaults to a single board
  • version (int) – the type of SpiNNaker board used within the SpiNNaker machine being used. If a spinn-5 board, then the version will be 5, spinn-3 would equal 3 and so on.
  • bmp_connection_data (list(BMPConnectionData)) – the details of the BMP connections used to boot multi-board systems
  • auto_detect_bmp (bool) – True if the BMP of version 4 or 5 boards should be automatically determined from the board IP address
  • scamp_connections – the list of connections used for SCAMP communications
Returns:

The created transceiver

Return type:

Transceiver

Raises:
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

Indices and tables