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¶
- Connect to and communicate with a machine using a number of different connections.
- 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.
- Check the version of the software which the machine is booted with.
- 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.
- 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).
- Write data to SDRAM, either on an individual chip, or via a “flood-fill” mechanism to multiple chips simultaneously.
- Send a signal to an application.
- Read data from SDRAM on an individual chip.
- 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.
- 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.
- 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.
- More than one machine can be connected to the same host.
- Once the subset of connections has been worked out for each machine, the operation of these machines should be independent.
Use Cases¶
- Connecting is done by using
create_transceiver_from_hostname()
. boot_board()
andget_scamp_version()
are used to ensure that the board is booted correctly before starting a simulation.get_machine_details()
is used to get a representation of the current state of the machine, which is used to decide where executables are to be run on the board for a particular simulation, where any external peripherals are connected, and how messages between the executables and/or the external peripherals are to be routed.write_memory()
andexecute()
are used to write parameters and execute executables on the boardsend_signal()
is used to send a signal which starts, stops or pauses a simulation.get_core_state_count()
is used to determine if a simulation is complete or has gone into an error state.get_iobuf()
,get_cpu_information()
andget_router_diagnostics()
are used to diagnose a problem with a simulation.read_memory()
is used to read some statistics recorded in SDRAM after a simulation.
Contents¶
spinnman¶
spinnman package¶
Subpackages¶
spinnman.connections package¶
-
class
spinnman.connections.abstract_classes.
Connection
¶ Bases:
spinn_utilities.abstract_context_manager.AbstractContextManager
An abstract connection to the SpiNNaker board over some medium
-
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
.
-
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: Raises: - SpinnmanIOException – If there is an error receiving the message
- SpinnmanTimeoutException – If there is a timeout before a message is received
-
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.
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
-
chip_x
¶ Defined to satisfy the AbstractSCPConnection - always 0 for a BMP
-
chip_y
¶ Defined to satisfy the AbstractSCPConnection - always 0 for a BMP
-
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: Raises: - SpinnmanIOException – If there is an error receiving the message
- SpinnmanTimeoutException – If there is a timeout before a message is received
-
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: Raises: - SpinnmanIOException – If there is an error receiving the message
- SpinnmanTimeoutException – If there is a timeout before a message is received
- SpinnmanInvalidPacketException – If the received packet is not a valid SpiNNaker boot message
- SpinnmanInvalidParameterException – If one of the fields of the SpiNNaker boot message is invalid
-
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
-
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: Raises: - SpinnmanTimeoutException – If a timeout occurs before any data is received
- SpinnmanIOException – If an error occurs receiving the data
-
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: Raises: - SpinnmanTimeoutException – If a timeout occurs before any data is received
- SpinnmanIOException – If an error occurs receiving the data
-
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
-
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
-
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: Raises: - SpinnmanIOException – If there is an error receiving the message.
- SpinnmanTimeoutException – If there is a timeout before a message is received.
- SpinnmanInvalidPacketException – If the received packet is not a valid EIEIO message.
- SpinnmanInvalidParameterException – If one of the fields of the EIEIO message is invalid.
-
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
-
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
-
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:
-
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: Raises: - SpinnmanIOException – If there is an error receiving the message
- SpinnmanTimeoutException – If there is a timeout before a message is received
-
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.
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
-
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: Raises: - SpinnmanIOException – If there is an error receiving the message
- SpinnmanTimeoutException – If there is a timeout before a message is received
- SpinnmanInvalidPacketException – If the received packet is not a valid SDP message
- SpinnmanInvalidParameterException – If one of the fields of the SDP message is invalid
-
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.
-
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.
-
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: -
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: Return type:
-
tokens
¶ The number of tokens currently in the bucket.
-
spinnman.data package¶
-
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
-
-
class
spinnman.data.
SpiNNManDataView
¶ Bases:
spinn_machine.data.machine_data_view.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
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: Raises: - SpiNNUtilsException – If the transceiver is currently unavailable
- SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If one of x, y, cpu, base_address or length is invalid
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: - SpiNNUtilsException – If the transceiver is currently unavailable
- SpinnmanIOException –
- If there is an error communicating with the board
- If there is an error reading the data
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If x, y does not lead to a valid chip
- If a packet is received that has invalid parameters
- If base_address is not a positive integer
- If data is an RawIOBase but n_bytes is not specified
- If data 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
-
classmethod
spinnman.messages package¶
-
class
spinnman.messages.eieio.command_messages.
EIEIOCommandHeader
(command)¶ Bases:
object
EIEIO header for command packets
-
command
¶
-
static
from_bytestring
(data, offset)[source]¶ Read an EIEIO command header from a bytestring
Parameters: Returns: an EIEIO command header
Return type: Raises: - SpinnmanIOException – If there is an error reading from the reader
- SpinnmanInvalidParameterException – If there is an error setting any of the values
-
-
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
-
data
¶
-
eieio_header
¶ The header of the message.
Return type: EIEIOCommandHeader
-
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
-
n_requests
¶
-
sequence_no
¶
-
-
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
-
eieio_data_message
¶
-
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.-
database_path
¶
-
-
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).
-
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).
-
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
-
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
-
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
-
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
-
n_requests
¶
-
p
¶
-
sequence_no
¶
-
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
-
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
-
count
¶
-
eieio_type
¶
-
static
from_bytestring
(data, offset)[source]¶ Read an eieio data header from a bytestring
Parameters: Returns: an EIEIO header
Return type:
-
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: Returns: The size of the header in bytes
Return type:
-
is_time
¶
-
payload_base
¶
-
prefix
¶
-
prefix_type
¶
-
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: - SpinnmanInvalidParameterException – If the element is not compatible with the header
- SpinnmanInvalidPacketException – If the message was created to read data
-
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: Raises: SpinnmanInvalidParameterException – If the key or payload is too big for the format, or the format doesn’t expect a payload
-
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
-
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: Returns: The minimum size of the packet in bytes
Return type:
-
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
¶
-
-
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¶
-
-
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: Returns: an object which inherits from EIEIOCommandMessage which contains parsed data received from the network
Return type:
-
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: Returns: an object which inherits from EIEIODataMessage which contains parsed data received from the network
Return type:
-
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
-
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¶
-
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
-
class
spinnman.messages.scp.abstract_messages.
AbstractSCPResponse
¶ Bases:
object
Represents an abstract SCP Response.
-
read_data_bytestring
(data, offset)[source]¶ Reads the remainder of the data following the header
Parameters:
-
scp_response_header
¶ The SCP header from the response
Return type: SCPResponseHeader
-
-
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_LINK_READ
= 17¶
-
CMD_LINK_WRITE
= 18¶
-
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.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
-
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
-
-
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:
-
version_info
¶ The version information received
Return type: VersionInfo
-
-
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
-
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:
-
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: -
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: -
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: -
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: -
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: -
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: -
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: -
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: -
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.
ReadLink
(x, y, link, base_address, size, cpu=0)¶ 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: 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: -
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: 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: 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: 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: -
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
-
class
spinnman.messages.scp.impl.
WriteLink
(x, y, link, base_address, data, cpu=0)¶ 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
-
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
-
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
-
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
-
command
¶ The command of the SCP packet
Return type: SCPCommand
-
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
-
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_port
¶ The destination SDP port of the packet, between 0 and 7 (settable)
Return type: int
-
source_chip_x
¶ The x-coordinate of the source chip of the packet, between 0 and 255 (settable)
Return type: int
-
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: Raises: SpinnmanInvalidParameterException – If the opcode is not a valid value
-
opcode
¶ The operation of this packet
Return type: SpinnakerBootOpCode
-
-
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: - board_version (int) – The version of the board to be booted
- extra_boot_values (dict(SystemVariableDefinition, object)) – Any additional values to be set during boot
Raises: - SpinnmanInvalidParameterException – If the board version is not supported
- SpinnmanIOException – If there is an error assembling the packets
-
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')¶
-
link_peek_timeout_microseconds
= _Definition(offset=42, data_type=<_DataType.BYTE: 1>, default=100, array_size=None, doc='The link peek/poke timeout in microseconds')¶
-
links_available
= _Definition(offset=101, data_type=<_DataType.BYTE: 1>, default=63, array_size=None, doc='Bit mask (6 bits) of links enabled')¶
-
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_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')¶
-
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')¶
spinnman.model package¶
-
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¶
-
LINK_0
= 3¶
-
LINK_1
= 4¶
-
LINK_2
= 5¶
-
LINK_3
= 6¶
-
LINK_4
= 7¶
-
LINK_5
= 8¶
-
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¶
-
-
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
-
class
spinnman.model.
BMPConnectionData
(cabinet, frame, ip_address, boards, port_num)¶ Bases:
object
Contains the details of a BMP connection
-
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: Raises: SpinnmanInvalidParameterException – If the data doesn’t contain valid system data information
-
is_ethernet_available
¶ True if the Ethernet is running on this chip, False otherwise
Return type: bool
-
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
-
virtual_core_ids
¶ A list of available cores by virtual core ID (including the monitor)
Return type: iterable(int)
-
-
class
spinnman.model.
ChipSummaryInfo
(chip_summary_data, offset, x, y)¶ Bases:
object
Represents the chip summary information read via an SCP command
Parameters: -
clear_ethernet_ip_address
()[source]¶ Forces the Ethernet IP address to None, in case of an errant chip
-
is_ethernet_available
¶ Determines if the Ethernet connection is available on this chip
Return type: bool
-
-
class
spinnman.model.
CPUInfo
(x, y, p, cpu_data, offset)¶ Bases:
object
Represents information about the state of a CPU.
Parameters: -
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
-
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
-
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
-
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)
-
-
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:
-
cpu_infos
¶ The one per core core info.
Returns: iterable of x,y,p core info
-
-
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
¶
-
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
-
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
-
-
class
spinnman.model.
HeapElement
(block_address, next_address, free)¶ Bases:
object
An element of one of the heaps on SpiNNaker.
Parameters:
-
class
spinnman.model.
IOBuffer
(x, y, p, iobuf)¶ Bases:
object
The contents of IOBUF for a core
Parameters:
-
class
spinnman.model.
MachineDimensions
(width, height)¶ Bases:
object
Represents the size of a machine in chips
Parameters:
-
class
spinnman.model.
P2PTable
(width, height, column_data)¶ Bases:
object
Represents a P2P routing table read from the machine.
Parameters: -
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: Return type:
-
is_route
(x, y)[source]¶ Determines if there is a route in the P2P table to the given chip.
Parameters: Return type:
-
static
-
class
spinnman.model.
RouterDiagnostics
(control_register, error_status, register_values)¶ Bases:
object
Represents a set of diagnostic information available from a chip router.
Parameters: Raises: SpinnmanInvalidParameterException – If the number of register values is not 16
-
errors_set
¶ A list of errors that have been detected
Return type: list(RouterError)
-
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)
-
-
class
spinnman.model.
VersionInfo
(version_data, offset=0)¶ Bases:
object
Decodes SC&MP/SARK version information as returned by the SVER command.
Parameters: Raises: SpinnmanInvalidParameterException – If the message does not contain valid version information
spinnman.processes package¶
-
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
-
connection_selector
¶ Get the connection selector of the process
-
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
-
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) – -
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: - chip_address (tuple(int,int)) – x, y
- pointer (SystemVariableDefinition) –
Return type:
-
-
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) –
-
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: - connection_selector (AbstractMultiConnectionProcessConnectionSelector) –
- app_id (int) –
-
class
spinnman.processes.
GetTagsProcess
(connection_selector)¶ Bases:
spinnman.processes.AbstractMultiConnectionProcess
Parameters: connection_selector (AbstractMultiConnectionProcessConnectionSelector) – 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) –
-
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) –
-
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) –
-
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:
-
-
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: - iobuf_size (int) –
- core_subsets (CoreSubsets) –
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) –
-
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) –
-
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.
-
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
-
write_link_memory_from_bytearray
(x, y, p, link, base_address, data, offset, n_bytes, get_sum=False)[source]¶ 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:
-
write_link_memory_from_reader
(x, y, p, link, base_address, reader, n_bytes, get_sum=False)[source]¶ 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:
-
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:
-
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:
spinnman.spalloc package¶
-
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
-
-
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: -
delete
(url: str, timeout: int = 10, **kwargs) → requests.models.Response[source]¶ Do an HTTP
DELETE
in the session.Parameters: url (str) – Return type: Response
-
get
(url: str, timeout: int = 10, **kwargs) → requests.models.Response[source]¶ Do an HTTP
GET
in the session.Parameters: Return type: Response
-
post
(url: str, jsonobj: dict, timeout: int = 10, **kwargs) → requests.models.Response[source]¶ Do an HTTP
POST
in the session.Parameters: Return type: Response
-
put
(url: str, data: str, timeout: int = 10, **kwargs) → requests.models.Response[source]¶ Do an HTTP
PUT
in the session. Puts plain text OR JSON!Parameters: 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 –
-
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 -
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: Raises: - SpinnmanIOException – If there is an error receiving the message
- SpinnmanTimeoutException – If there is a timeout before a message is received
- SpinnmanInvalidPacketException – If the received packet is not a valid SpiNNaker boot message
- SpinnmanInvalidParameterException – If one of the fields of the SpiNNaker boot message is invalid
-
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
-
-
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_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:
-
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: Raises: - SpinnmanIOException – If there is an error receiving the message
- SpinnmanTimeoutException – If there is a timeout before a message is received
-
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: Raises: - SpinnmanIOException – If there is an error receiving the message
- SpinnmanTimeoutException – If there is a timeout before a message is received
- SpinnmanInvalidPacketException – If the received packet is not a valid SDP message
- SpinnmanInvalidParameterException – If one of the fields of the SDP message is invalid
-
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.
-
-
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: Returns: A handle for monitoring and interacting with the job.
Return type:
-
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
andip_address
must be notNone
.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:
-
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:
-
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: Return type:
-
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
andpassword
arguments must beNone
. Ifusername
andpassword
are not given, not even within the URL, thebearer_token
must be notNone
. - username (str) – The user name to use
- password (str) – The password to use
- bearer_token (str) – The bearer token to use
-
create_job
(num_boards=1, machine_name=None, keepalive=45)[source]¶ Create a job with a specified number of boards.
Parameters: Returns: A handle for monitoring and interacting with the job.
Return type:
-
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
andip_address
must be notNone
.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:
-
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:
-
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 withkind
,name
andvalue
columns.Returns: The job handle, or None
if the records in the database are absent or incomplete.Return type: SpallocJob
-
version
¶
- service_url (str) – The reference to the service.
May have username and password supplied as part of the network
location; if so, the
-
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: Returns: A connection that talks to the board.
Return type:
-
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 allocatedReturn 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
-
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: Returns: an EIEIO connection with a board address bound
Return type:
-
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: 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:
-
-
class
spinnman.spalloc.
SpallocMachine
¶ Bases:
object
Represents a spalloc-controlled machine.
Don’t make this yourself. Use
SpallocClient
instead.-
dead_boards
¶ The dead or out-of-service boards of the machine.
-
dead_links
¶ The dead or out-of-service links of the machine.
-
height
¶ The height of the machine, in boards.
-
name
¶ The name of the machine.
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
-
-
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
-
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: Raises: - SpinnmanIOException – If there is an error receiving the message.
- SpinnmanTimeoutException – If there is a timeout before a message is received.
- SpinnmanInvalidPacketException – If the received packet is not a valid EIEIO message.
- SpinnmanInvalidParameterException – If one of the fields of the EIEIO message is invalid.
-
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: - SpinnmanTimeoutException – If the message isn’t handled within a reasonable timeout.
- SpinnmanUnexpectedResponseCodeException – If the message is rejected by SpiNNaker/SCAMP.
-
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
-
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: Raises: - SpinnmanIOException – If there is an error receiving the message.
- SpinnmanTimeoutException – If there is a timeout before a message is received.
- SpinnmanInvalidPacketException – If the received packet is not a valid EIEIO message.
- SpinnmanInvalidParameterException – If one of the fields of the EIEIO message is invalid.
-
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:
-
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:
-
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: Raises: - SpinnmanTimeoutException – If the message isn’t handled within a reasonable timeout.
- SpinnmanUnexpectedResponseCodeException – If the message is rejected by SpiNNaker/SCAMP.
spinnman.utilities package¶
-
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: -
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
-
-
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.
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
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.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: Returns: The BMP connection data
Return type:
Submodules¶
spinnman.config_setup module¶
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:
-
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:
-
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
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
¶ 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
¶ 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
¶ 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
¶ 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: -
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
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: - txrx (Transceiver) –
- app_id (int) –
- print_all_chips (bool) –
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: - SpinnmanIOException – If there is an error communicating with the board, or if no
connections to the board can be found (if connections is
None
) - SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: - SpinnmanInvalidParameterException – If the board version is not known
- SpinnmanIOException – If there is an error communicating with the board
-
clear_ip_tag
(tag, board_address=None)[source]¶ Clear the setting of an IP tag
Parameters: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If the tag is not a valid tag
- If the connection cannot send SDP messages
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
clear_multicast_routes
(x, y)[source]¶ Remove all the multicast routes on a chip
Parameters: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
clear_router_diagnostic_counters
(x, y, enable=True, counter_ids=None)[source]¶ Clear router diagnostic information on a chip
Parameters: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters or a counter ID is out of range
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: 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: - 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 x, y, p does not lead to a valid core
- If app_id is an invalid application ID
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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:
-
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: Returns: The number of blocks freed
Return type:
-
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: Returns: A count of the cores with the given status
Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If state is not a valid status
- If app_id is not a valid application ID
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: - all_core_subsets (CoreSubsets) – The cores to filter
- states (CPUState or set(CPUState)) – The state or states to filter on
Returns: Core subsets object containing cores in the given state(s)
Return type:
-
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: - all_core_subsets (CoreSubsets) – The cores to filter
- states (CPUState or set(CPUState)) – The state or states to filter on
Returns: Core subsets object containing cores not in the given state(s)
Return type:
-
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: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If chip_and_cores contains invalid items
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
get_cpu_information_from_core
(x, y, p)[source]¶ Get information about a specific processor on the board
Parameters: Returns: The CPU information for the selected core
Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If x, y, p is not a valid processor
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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:
-
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: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If chip_and_cores contains invalid items
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: Returns: An IOBUF buffer
Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If chip_and_cores contains invalid items
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
get_multicast_routes
(x, y, app_id=None)[source]¶ Get the current multicast routes set up on a chip
Parameters: Returns: An iterable of multicast routes
Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
get_router_diagnostic_filter
(x, y, position)[source]¶ Gets a router diagnostic filter from a router
Parameters: Returns: The diagnostic filter read
Return type: Raises: - SpinnmanIOException –
- If there is an error communicating with the board
- If there is an error reading the data
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If x, y does not lead to a valid chip
- If a packet is received that has invalid parameters
- If position is less than 0 or more than 15
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
- SpinnmanIOException –
-
get_router_diagnostics
(x, y)[source]¶ Get router diagnostic information from a chip
Parameters: Returns: The router diagnostic information
Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidParameterException – If the timeout is less than 1
- SpinnmanTimeoutException – If none of the retries resulted in a response before the timeout (suggesting that the board is not booted).
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: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If the connection cannot send SDP messages
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If any of the routes are invalid
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If any of the routes are invalid
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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:
-
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:
-
power_off_machine
()[source]¶ Power off the whole machine :rtype bool :return success or failure to power off the machine
-
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: Returns: the FPGA’s ADC data object
Return type:
-
read_bmp_version
(board, cabinet, frame)[source]¶ Read the BMP version
Parameters: 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: 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:
-
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: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If one of x, y, cpu, base_address or length is invalid
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If one of x, y, cpu, base_address or length is invalid
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If x, y, p does not identify a valid processor
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
read_user_1
(x, y, p)[source]¶ Get the contents of the user_1 register for the given processor.
Parameters: Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If x, y, p does not identify a valid processor
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If one of x, y, cpu or base_address is invalid
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
send_scp_message
(message, connection=None)[source]¶ Sends an SCP message, without expecting a response
Parameters: - message (AbstractSCPRequest) – The message to send
- connection (SCAMPConnection) – The connection to use (omit to pick a random one)
Raises: - SpinnmanTimeoutException – If there is a timeout before a message is received
- SpinnmanInvalidParameterException – If one of the fields of the received message is invalid
- SpinnmanInvalidPacketException –
- If the message is not a recognised packet type
- If a packet is received that is not a valid response
- SpinnmanUnsupportedOperationException – If no connection can send the type of message given
- SpinnmanIOException – If there is an error sending the message or receiving the response
- SpinnmanUnexpectedResponseCodeException – If the response is not one of the expected codes
-
send_sdp_message
(message, connection=None)[source]¶ Sends an SDP message using one of the connections.
Parameters: - message (SDPMessage) – The message to send
- connection (SDPConnection) – An optional connection to use
-
send_signal
(app_id, signal)[source]¶ Send a signal to an application
Parameters: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If signal is not a valid signal
- If app_id is not a valid application ID
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
set_ip_tag
(ip_tag, use_sender=False)[source]¶ Set up an IP tag
Parameters: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If the IP tag fields are incorrect
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If the reverse IP tag fields are incorrect
- If a packet is received that has invalid parameters
- If the UDP port is one that is already used by SpiNNaker for
- system functions
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: - SpinnmanIOException –
- If there is an error communicating with the board
- If there is an error reading the data
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If x, y does not lead to a valid chip
- If position is less than 0 or more than 15
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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:
-
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: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If app_id is not a valid application ID
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: Raises: - SpinnmanIOException –
- If there is an error communicating with the board
- If there is an error reading the data
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If x, y does not lead to a valid chip
- If a packet is received that has invalid parameters
- If base_address is not a positive integer
- If data is an RawIOBase but n_bytes is not specified
- If data 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
-
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: - 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 chips is not valid
- If app_id is an invalid application ID
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: - SpinnmanIOException –
- If there is an error communicating with the board
- If there is an error reading the data
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If x, y does not lead to a valid chip
- If a packet is received that has invalid parameters
- If base_address is not a positive integer
- If data is an RawIOBase but n_bytes is not specified
- If data 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
-
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: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If x, y, p does not identify a valid processor
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
write_user_1
(x, y, p, value)[source]¶ Write to the user_1 register for the given processor.
Parameters: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If x, y, p does not identify a valid processor
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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 aBootConnection
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: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
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¶
- Connect to and communicate with a machine using a number of different connections.
- 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.
- Check the version of the software which the machine is booted with.
- 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.
- 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).
- Write data to SDRAM, either on an individual chip, or via a “flood-fill” mechanism to multiple chips simultaneously.
- Send a signal to an application.
- Read data from SDRAM on an individual chip.
- 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.
- 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.
- 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.
- More than one machine can be connected to the same host.
- Once the subset of connections has been worked out for each machine, the operation of these machines should be independent.
Use Cases¶
- Connecting is done by using
create_transceiver_from_hostname()
. boot_board()
andget_scamp_version()
are used to ensure that the board is booted correctly before starting a simulation.get_machine_details()
is used to get a representation of the current state of the machine, which is used to decide where executables are to be run on the board for a particular simulation, where any external peripherals are connected, and how messages between the executables and/or the external peripherals are to be routed.write_memory()
andexecute()
are used to write parameters and execute executables on the boardsend_signal()
is used to send a signal which starts, stops or pauses a simulation.get_core_state_count()
is used to determine if a simulation is complete or has gone into an error state.get_iobuf()
,get_cpu_information()
andget_router_diagnostics()
are used to diagnose a problem with a simulation.read_memory()
is used to read some statistics recorded in SDRAM after a simulation.