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

This code depends on SpiNNUtils, SpiNNMachine and SpiNNStorageHandlers (Combined_documentation).

SpiNNMan

Used to communicate with a SpiNNaker Board. The main part of this package is the spinnman.transceiver.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 the 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

  • boot_board() and get_scamp_version() are used to ensure that the board is booted correctly before starting a simulation.
  • get_machine_details() is used to get a representation of the current state of the machine, which is used to decide where executables are to be run on the board for a particular simulation, where any external peripherals are connected, and how messages between the executables and/or the external peripherals are to be routed
  • write_memory() and execute() are used to write parameters and execute executables on the board
  • send_signal() is used to send a signal which starts, stops or pauses a simulation.
  • get_core_status_count() is used to determine if a simulation is complete or has gone into an error state.
  • get_iobuf(), get_cpu_information() and get_router_diagnostics() are used to diagnose a problem with a simulation
  • read_memory() is used to read some statistics recorded in SDRAM after a simulation

Contents

spinnman package

Subpackages

spinnman.connections package
Subpackages
spinnman.connections.abstract_classes package
Submodules
spinnman.connections.abstract_classes.connection module
class spinnman.connections.abstract_classes.connection.Connection[source]

Bases: object

An abstract connection to the SpiNNaker board over some medium

close()[source]

Closes the connection

Returns:Nothing is returned
Return type:None
Raises:None – No known exceptions are raised
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:spinnman.exceptions.SpinnmanIOException – If there is an error when determining the connectivity of the medium.
spinnman.connections.abstract_classes.eieio_receiver module
class spinnman.connections.abstract_classes.eieio_receiver.EIEIOReceiver[source]

Bases: spinnman.connections.abstract_classes.connection.Connection

A receiver of EIEIO data or commands

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:

spinnman.messages.eieio.AbstractEIEIOMessage

Raises:
spinnman.connections.abstract_classes.eieio_sender module
class spinnman.connections.abstract_classes.eieio_sender.EIEIOSender[source]

Bases: spinnman.connections.abstract_classes.connection.Connection

A sender of EIEIO messages

send_eieio_message(eieio_message)[source]

Sends an EIEIO message down this connection

Parameters:eieio_message (spinnman.messages.eieio.AbstractEIEIOMessage) – The EIEIO message to be sent
Raises:spinnman.exceptions.SpinnmanIOException – If there is an error sending the message
spinnman.connections.abstract_classes.listenable module
class spinnman.connections.abstract_classes.listenable.Listenable[source]

Bases: object

get_receive_method()[source]

Get the method that receives for this connection

is_ready_to_receive(timeout=0)[source]

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

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

Bases: spinnman.connections.abstract_classes.connection.Connection

A receiver of multicast messages

get_input_chips()[source]

Get a list of chips which identify the chips from which this receiver can receive receive packets directly

Returns:The coordinates, (x, y), of the chips
Return type:iterable of (int, int)
Raises:None – No known exceptions are raised
receive_multicast_message(timeout=None)[source]

Receives a multicast 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 multicast message

Return type:

spinnman.messages.multicast_message.MulticastMessage

Raises:
spinnman.connections.abstract_classes.multicast_sender module
class spinnman.connections.abstract_classes.multicast_sender.MulticastSender[source]

Bases: spinnman.connections.abstract_classes.connection.Connection

A sender of Multicast messages

get_input_chips()[source]

Get a list of chips which identify the chips to which this sender can send multicast packets directly

Returns:The coordinates, (x, y), of the chips
Return type:iterable of (int, int)
Raises:None – No known exceptions are raised
send_multicast_message(multicast_message)[source]

Sends a SpiNNaker multicast message using this connection

Parameters:multicast_message (spinnman.messages.multicast_message.MulticastMessage) – The message to be sent
Returns:Nothing is returned
Return type:None
Raises:spinnman.exceptions.SpinnmanIOException – If there is an error sending the message
spinnman.connections.abstract_classes.scp_receiver module
class spinnman.connections.abstract_classes.scp_receiver.SCPReceiver[source]

Bases: spinnman.connections.abstract_classes.connection.Connection

A receiver of SCP messages

is_ready_to_receive(timeout=0)[source]

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

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

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

Parameters:

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

Returns:

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

Return type:

tuple(spinnman.messages.scp.scp_result.SCPResult, int, bytestring, int)

Raises:
spinnman.connections.abstract_classes.scp_sender module
class spinnman.connections.abstract_classes.scp_sender.SCPSender[source]

Bases: spinnman.connections.abstract_classes.connection.Connection

A sender 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

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 (spinnman.messages.scp.abstract_scp_request.AbstractSCPRequest) – message packet to send
Returns:Nothing is returned
Return type:None
Raises:spinnman.exceptions.SpinnmanIOException – If there is an error sending the message
spinnman.connections.abstract_classes.sdp_receiver module
class spinnman.connections.abstract_classes.sdp_receiver.SDPReceiver[source]

Bases: spinnman.connections.abstract_classes.connection.Connection

A receiver of SDP messages

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:

spinnman.messages.sdp.sdp_message.SDPMessage

Raises:
spinnman.connections.abstract_classes.sdp_sender module
class spinnman.connections.abstract_classes.sdp_sender.SDPSender[source]

Bases: spinnman.connections.abstract_classes.connection.Connection

A sender of SDP messages.

send_sdp_message(sdp_message)[source]

Sends an SDP message down this connection

Parameters:sdp_message (spinnman.messages.sdp.sdp_message.SDPMessage) – The SDP message to be sent
Return type:None
Raises:spinnman.exceptions.SpinnmanIOException – If there is an error sending the message.
spinnman.connections.abstract_classes.spinnaker_boot_receiver module
class spinnman.connections.abstract_classes.spinnaker_boot_receiver.SpinnakerBootReceiver[source]

Bases: spinnman.connections.abstract_classes.connection.Connection

A receiver of SpiNNaker boot messages

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:

spinnman.messages.spinnaker_boot.SpinnakerBootMessage

Raises:
spinnman.connections.abstract_classes.spinnaker_boot_sender module
class spinnman.connections.abstract_classes.spinnaker_boot_sender.SpinnakerBootSender[source]

Bases: spinnman.connections.abstract_classes.connection.Connection

A sender of SpiNNaker Boot messages

send_boot_message(boot_message)[source]

Sends a SpiNNaker boot message using this connection.

Parameters:boot_message (spinnman.messages.spinnaker_boot.SpinnakerBootMessage) – The message to be sent
Returns:Nothing is returned
Return type:None
Raises:spinnman.exceptions.SpinnmanIOException – If there is an error sending the message
Module contents
class spinnman.connections.abstract_classes.Connection[source]

Bases: object

An abstract connection to the SpiNNaker board over some medium

close()[source]

Closes the connection

Returns:Nothing is returned
Return type:None
Raises:None – No known exceptions are raised
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:spinnman.exceptions.SpinnmanIOException – If there is an error when determining the connectivity of the medium.
class spinnman.connections.abstract_classes.EIEIOReceiver[source]

Bases: spinnman.connections.abstract_classes.connection.Connection

A receiver of EIEIO data or commands

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:

spinnman.messages.eieio.AbstractEIEIOMessage

Raises:
class spinnman.connections.abstract_classes.EIEIOSender[source]

Bases: spinnman.connections.abstract_classes.connection.Connection

A sender of EIEIO messages

send_eieio_message(eieio_message)[source]

Sends an EIEIO message down this connection

Parameters:eieio_message (spinnman.messages.eieio.AbstractEIEIOMessage) – The EIEIO message to be sent
Raises:spinnman.exceptions.SpinnmanIOException – If there is an error sending the message
class spinnman.connections.abstract_classes.Listenable[source]

Bases: object

get_receive_method()[source]

Get the method that receives for this connection

is_ready_to_receive(timeout=0)[source]

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

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

Bases: spinnman.connections.abstract_classes.connection.Connection

A receiver of multicast messages

get_input_chips()[source]

Get a list of chips which identify the chips from which this receiver can receive receive packets directly

Returns:The coordinates, (x, y), of the chips
Return type:iterable of (int, int)
Raises:None – No known exceptions are raised
receive_multicast_message(timeout=None)[source]

Receives a multicast 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 multicast message

Return type:

spinnman.messages.multicast_message.MulticastMessage

Raises:
class spinnman.connections.abstract_classes.MulticastSender[source]

Bases: spinnman.connections.abstract_classes.connection.Connection

A sender of Multicast messages

get_input_chips()[source]

Get a list of chips which identify the chips to which this sender can send multicast packets directly

Returns:The coordinates, (x, y), of the chips
Return type:iterable of (int, int)
Raises:None – No known exceptions are raised
send_multicast_message(multicast_message)[source]

Sends a SpiNNaker multicast message using this connection

Parameters:multicast_message (spinnman.messages.multicast_message.MulticastMessage) – The message to be sent
Returns:Nothing is returned
Return type:None
Raises:spinnman.exceptions.SpinnmanIOException – If there is an error sending the message
class spinnman.connections.abstract_classes.SCPReceiver[source]

Bases: spinnman.connections.abstract_classes.connection.Connection

A receiver of SCP messages

is_ready_to_receive(timeout=0)[source]

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

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

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

Parameters:

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

Returns:

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

Return type:

tuple(spinnman.messages.scp.scp_result.SCPResult, int, bytestring, int)

Raises:
class spinnman.connections.abstract_classes.SCPSender[source]

Bases: spinnman.connections.abstract_classes.connection.Connection

A sender 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

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 (spinnman.messages.scp.abstract_scp_request.AbstractSCPRequest) – message packet to send
Returns:Nothing is returned
Return type:None
Raises:spinnman.exceptions.SpinnmanIOException – If there is an error sending the message
class spinnman.connections.abstract_classes.SDPReceiver[source]

Bases: spinnman.connections.abstract_classes.connection.Connection

A receiver of SDP messages

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:

spinnman.messages.sdp.sdp_message.SDPMessage

Raises:
class spinnman.connections.abstract_classes.SDPSender[source]

Bases: spinnman.connections.abstract_classes.connection.Connection

A sender of SDP messages.

send_sdp_message(sdp_message)[source]

Sends an SDP message down this connection

Parameters:sdp_message (spinnman.messages.sdp.sdp_message.SDPMessage) – The SDP message to be sent
Return type:None
Raises:spinnman.exceptions.SpinnmanIOException – If there is an error sending the message.
class spinnman.connections.abstract_classes.SpinnakerBootReceiver[source]

Bases: spinnman.connections.abstract_classes.connection.Connection

A receiver of SpiNNaker boot messages

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:

spinnman.messages.spinnaker_boot.SpinnakerBootMessage

Raises:
class spinnman.connections.abstract_classes.SpinnakerBootSender[source]

Bases: spinnman.connections.abstract_classes.connection.Connection

A sender of SpiNNaker Boot messages

send_boot_message(boot_message)[source]

Sends a SpiNNaker boot message using this connection.

Parameters:boot_message (spinnman.messages.spinnaker_boot.SpinnakerBootMessage) – The message to be sent
Returns:Nothing is returned
Return type:None
Raises:spinnman.exceptions.SpinnmanIOException – If there is an error sending the message
spinnman.connections.udp_packet_connections package
Submodules
spinnman.connections.udp_packet_connections.bmp_connection module
class spinnman.connections.udp_packet_connections.bmp_connection.BMPConnection(connection_data)[source]

Bases: spinnman.connections.udp_packet_connections.udp_connection.UDPConnection, spinnman.connections.abstract_classes.scp_receiver.SCPReceiver, spinnman.connections.abstract_classes.scp_sender.SCPSender

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

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

The set of boards supported by the BMP

Return type:iterable of int
cabinet

The cabinet ID of the BMP

Return type:int
chip_x

Defined to satisfy the SCPSender - always 0 for a BMP

chip_y

Defined to satisfy the SCPSender - always 0 for a BMP

frame

The frame ID of the BMP

Return type:int
get_scp_data(scp_request)[source]

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

receive_scp_response(timeout=1.0)[source]

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

Parameters:

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

Returns:

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

Return type:

tuple(spinnman.messages.scp.scp_result.SCPResult, int, bytestring, int)

Raises:
send_scp_request(scp_request)[source]

Sends an SCP request down this connection

Messages must have the following properties:

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

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

Parameters:scp_request (spinnman.messages.scp.abstract_scp_request.AbstractSCPRequest) – message packet to send
Returns:Nothing is returned
Return type:None
Raises:spinnman.exceptions.SpinnmanIOException – If there is an error sending the message
spinnman.connections.udp_packet_connections.boot_connection module
class spinnman.connections.udp_packet_connections.boot_connection.BootConnection(local_host=None, local_port=None, remote_host=None, remote_port=None)[source]

Bases: spinnman.connections.udp_packet_connections.udp_connection.UDPConnection, spinnman.connections.abstract_classes.spinnaker_boot_sender.SpinnakerBootSender, spinnman.connections.abstract_classes.spinnaker_boot_receiver.SpinnakerBootReceiver

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

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.
Raises:

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

spinnman.messages.spinnaker_boot.SpinnakerBootMessage

Raises:
send_boot_message(boot_message)[source]

Sends a SpiNNaker boot message using this connection.

Parameters:boot_message (spinnman.messages.spinnaker_boot.SpinnakerBootMessage) – The message to be sent
Returns:Nothing is returned
Return type:None
Raises:spinnman.exceptions.SpinnmanIOException – If there is an error sending the message
spinnman.connections.udp_packet_connections.eieio_connection module
class spinnman.connections.udp_packet_connections.eieio_connection.EIEIOConnection(local_host=None, local_port=None, remote_host=None, remote_port=None)[source]

Bases: spinnman.connections.udp_packet_connections.udp_connection.UDPConnection, spinnman.connections.abstract_classes.eieio_receiver.EIEIOReceiver, spinnman.connections.abstract_classes.eieio_sender.EIEIOSender, spinnman.connections.abstract_classes.listenable.Listenable

A UDP connection for sending and receiving raw EIEIO messages.

Parameters:
  • local_host (str or None) – 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 or None) – 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 – 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:

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

get_receive_method()[source]

Get the method that receives for this connection

receive_eieio_message(timeout=None)[source]

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

Parameters:

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

Returns:

an EIEIO message

Return type:

spinnman.messages.eieio.AbstractEIEIOMessage

Raises:
send_eieio_message(eieio_message)[source]

Sends an EIEIO message down this connection

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

Bases: spinnman.connections.udp_packet_connections.udp_connection.UDPConnection

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

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

Bases: spinnman.connections.udp_packet_connections.sdp_connection.SDPConnection, spinnman.connections.abstract_classes.scp_sender.SCPSender, spinnman.connections.abstract_classes.scp_receiver.SCPReceiver

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

receive_scp_response(timeout=1.0)[source]

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

Parameters:

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

Returns:

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

Return type:

tuple(spinnman.messages.scp.scp_result.SCPResult, int, bytestring, int)

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

Sends an SCP request down this connection

Messages must have the following properties:

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

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

Parameters:scp_request (spinnman.messages.scp.abstract_scp_request.AbstractSCPRequest) – message packet to send
Returns:Nothing is returned
Return type:None
Raises:spinnman.exceptions.SpinnmanIOException – If there is an error sending the message
send_scp_request_to(scp_request, x, y, ip_address)[source]
update_chip_coordinates(x, y)[source]
spinnman.connections.udp_packet_connections.sdp_connection module
class spinnman.connections.udp_packet_connections.sdp_connection.SDPConnection(chip_x=None, chip_y=None, local_host=None, local_port=None, remote_host=None, remote_port=None)[source]

Bases: spinnman.connections.udp_packet_connections.udp_connection.UDPConnection, spinnman.connections.abstract_classes.sdp_receiver.SDPReceiver, spinnman.connections.abstract_classes.sdp_sender.SDPSender, spinnman.connections.abstract_classes.listenable.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 – The optional remote port number to send messages to. If not specified, sending will not be possible using this connection
get_receive_method()[source]

Get the method that receives for this connection

receive_sdp_message(timeout=None)[source]

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

Parameters:

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

Returns:

The received SDP message

Return type:

spinnman.messages.sdp.sdp_message.SDPMessage

Raises:
send_sdp_message(sdp_message)[source]

Sends an SDP message down this connection

Parameters:sdp_message (spinnman.messages.sdp.sdp_message.SDPMessage) – The SDP message to be sent
Return type:None
Raises:spinnman.exceptions.SpinnmanIOException – If there is an error sending the message.
spinnman.connections.udp_packet_connections.udp_connection module
class spinnman.connections.udp_packet_connections.udp_connection.UDPConnection(local_host=None, local_port=None, remote_host=None, remote_port=None)[source]

Bases: spinnman.connections.abstract_classes.connection.Connection

Parameters:
  • local_host (str or None) – 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 or None) – 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 – 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:

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

close()[source]

Closes the connection

Returns:Nothing is returned
Return type:None
Raises:None – No known exceptions are raised
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:spinnman.exceptions.SpinnmanIOException – If there is an error when determining the connectivity of the medium.
is_ready_to_receive(timeout=0)[source]
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
Raises:None – No known exceptions are thrown
local_port

The local port to which the connection is bound.

Returns:The local port number
Return type:int
Raises:None – No known exceptions are thrown
receive(timeout=None)[source]

Receive data from the connection

Parameters:

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

Returns:

The data received as a bytestring

Return type:

str

Raises:
receive_with_address(timeout=None)[source]

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

Parameters:

timeout (None) – 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:

str, (str, int)

Raises:
remote_ip_address

The remote IP address to which the connection is connected.

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

The remote port to which the connection is connected.

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

Send data down this connection

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

Send data down this connection

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

SpinnmanIOException – If there is an error sending the data

spinnman.connections.udp_packet_connections.udp_listenable_connection module
class spinnman.connections.udp_packet_connections.udp_listenable_connection.UDPListenableConnection(local_host=None, local_port=None, remote_host=None, remote_port=None)[source]

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

get_receive_method()[source]

Get the method that receives for this connection

spinnman.connections.udp_packet_connections.utils module
spinnman.connections.udp_packet_connections.utils.bind_socket(sock, host, port)[source]

Wrapper round bind() system call.

spinnman.connections.udp_packet_connections.utils.connect_socket(sock, remote_address, remote_port)[source]

Wrapper round connect() system call.

spinnman.connections.udp_packet_connections.utils.get_socket()[source]

Wrapper round socket() system call.

spinnman.connections.udp_packet_connections.utils.get_socket_address(sock)[source]

Wrapper round getsockname() system call.

spinnman.connections.udp_packet_connections.utils.ping(address)[source]
spinnman.connections.udp_packet_connections.utils.resolve_host(host)[source]

Wrapper round gethostbyname() system call.

spinnman.connections.udp_packet_connections.utils.set_receive_buffer_size(sock, size)[source]

Wrapper round setsockopt() system call.

spinnman.connections.udp_packet_connections.utils.update_sdp_header_for_udp_send(sdp_header, source_x, source_y)[source]

Apply defaults to the SDP header for sending over UDP

Parameters:sdp_header (spinnman.messages.sdp.sdp_header.SDPHeader) – The SDP header values
Returns:Nothing is returned
Module contents
class spinnman.connections.udp_packet_connections.BMPConnection(connection_data)[source]

Bases: spinnman.connections.udp_packet_connections.udp_connection.UDPConnection, spinnman.connections.abstract_classes.scp_receiver.SCPReceiver, spinnman.connections.abstract_classes.scp_sender.SCPSender

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

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

The set of boards supported by the BMP

Return type:iterable of int
cabinet

The cabinet ID of the BMP

Return type:int
chip_x

Defined to satisfy the SCPSender - always 0 for a BMP

chip_y

Defined to satisfy the SCPSender - always 0 for a BMP

frame

The frame ID of the BMP

Return type:int
get_scp_data(scp_request)[source]

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

receive_scp_response(timeout=1.0)[source]

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

Parameters:

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

Returns:

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

Return type:

tuple(spinnman.messages.scp.scp_result.SCPResult, int, bytestring, int)

Raises:
send_scp_request(scp_request)[source]

Sends an SCP request down this connection

Messages must have the following properties:

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

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

Parameters:scp_request (spinnman.messages.scp.abstract_scp_request.AbstractSCPRequest) – message packet to send
Returns:Nothing is returned
Return type:None
Raises:spinnman.exceptions.SpinnmanIOException – If there is an error sending the message
class spinnman.connections.udp_packet_connections.BootConnection(local_host=None, local_port=None, remote_host=None, remote_port=None)[source]

Bases: spinnman.connections.udp_packet_connections.udp_connection.UDPConnection, spinnman.connections.abstract_classes.spinnaker_boot_sender.SpinnakerBootSender, spinnman.connections.abstract_classes.spinnaker_boot_receiver.SpinnakerBootReceiver

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

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.
Raises:

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

spinnman.messages.spinnaker_boot.SpinnakerBootMessage

Raises:
send_boot_message(boot_message)[source]

Sends a SpiNNaker boot message using this connection.

Parameters:boot_message (spinnman.messages.spinnaker_boot.SpinnakerBootMessage) – The message to be sent
Returns:Nothing is returned
Return type:None
Raises:spinnman.exceptions.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)[source]

Bases: spinnman.connections.abstract_classes.connection.Connection

Parameters:
  • local_host (str or None) – 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 or None) – 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 – 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:

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

close()[source]

Closes the connection

Returns:Nothing is returned
Return type:None
Raises:None – No known exceptions are raised
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:spinnman.exceptions.SpinnmanIOException – If there is an error when determining the connectivity of the medium.
is_ready_to_receive(timeout=0)[source]
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
Raises:None – No known exceptions are thrown
local_port

The local port to which the connection is bound.

Returns:The local port number
Return type:int
Raises:None – No known exceptions are thrown
receive(timeout=None)[source]

Receive data from the connection

Parameters:

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

Returns:

The data received as a bytestring

Return type:

str

Raises:
receive_with_address(timeout=None)[source]

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

Parameters:

timeout (None) – 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:

str, (str, int)

Raises:
remote_ip_address

The remote IP address to which the connection is connected.

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

The remote port to which the connection is connected.

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

Send data down this connection

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

Send data down this connection

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

SpinnmanIOException – If there is an error sending the data

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

Bases: spinnman.connections.udp_packet_connections.udp_connection.UDPConnection, spinnman.connections.abstract_classes.eieio_receiver.EIEIOReceiver, spinnman.connections.abstract_classes.eieio_sender.EIEIOSender, spinnman.connections.abstract_classes.listenable.Listenable

A UDP connection for sending and receiving raw EIEIO messages.

Parameters:
  • local_host (str or None) – 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 or None) – 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 – 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:

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

get_receive_method()[source]

Get the method that receives for this connection

receive_eieio_message(timeout=None)[source]

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

Parameters:

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

Returns:

an EIEIO message

Return type:

spinnman.messages.eieio.AbstractEIEIOMessage

Raises:
send_eieio_message(eieio_message)[source]

Sends an EIEIO message down this connection

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

Bases: spinnman.connections.udp_packet_connections.udp_connection.UDPConnection

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

receive_ip_address(timeout=None)[source]
supports_sends_message(message)[source]
class spinnman.connections.udp_packet_connections.UDPListenableConnection(local_host=None, local_port=None, remote_host=None, remote_port=None)[source]

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

get_receive_method()[source]

Get the method that receives for this connection

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)[source]

Bases: spinnman.connections.udp_packet_connections.sdp_connection.SDPConnection, spinnman.connections.abstract_classes.scp_sender.SCPSender, spinnman.connections.abstract_classes.scp_receiver.SCPReceiver

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

receive_scp_response(timeout=1.0)[source]

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

Parameters:

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

Returns:

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

Return type:

tuple(spinnman.messages.scp.scp_result.SCPResult, int, bytestring, int)

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

Sends an SCP request down this connection

Messages must have the following properties:

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

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

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

Bases: spinnman.connections.udp_packet_connections.udp_connection.UDPConnection, spinnman.connections.abstract_classes.sdp_receiver.SDPReceiver, spinnman.connections.abstract_classes.sdp_sender.SDPSender, spinnman.connections.abstract_classes.listenable.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 – The optional remote port number to send messages to. If not specified, sending will not be possible using this connection
get_receive_method()[source]

Get the method that receives for this connection

receive_sdp_message(timeout=None)[source]

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

Parameters:

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

Returns:

The received SDP message

Return type:

spinnman.messages.sdp.sdp_message.SDPMessage

Raises:
send_sdp_message(sdp_message)[source]

Sends an SDP message down this connection

Parameters:sdp_message (spinnman.messages.sdp.sdp_message.SDPMessage) – The SDP message to be sent
Return type:None
Raises:spinnman.exceptions.SpinnmanIOException – If there is an error sending the message.
spinnman.connections.udp_packet_connections.update_sdp_header_for_udp_send(sdp_header, source_x, source_y)[source]

Apply defaults to the SDP header for sending over UDP

Parameters:sdp_header (spinnman.messages.sdp.sdp_header.SDPHeader) – The SDP header values
Returns:Nothing is returned
Submodules
spinnman.connections.connection_listener module
class spinnman.connections.connection_listener.ConnectionListener(connection, n_processes=4, timeout=1)[source]

Bases: threading.Thread

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

Parameters:
  • connection – An AbstractListenable connection to listen to
  • n_processes – The number of threads to use when calling callbacks
  • timeout – 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 (connection message type -> None)) – A callable which takes a single parameter, which is the message received
close()[source]

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

run()[source]

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

spinnman.connections.scp_request_pipeline module
class spinnman.connections.scp_request_pipeline.SCPRequestPipeLine(connection, n_channels=1, intermediate_channel_waits=0, n_retries=10, packet_timeout=1.0)[source]

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 – The connection over which the communication is to take place
  • n_channels – The number of requests to send before checking for responses. If None, this will be determined automatically
  • intermediate_channel_waits – The number of outstanding responses to wait for before continuing sending requests. If None, this will be determined automatically
  • n_retries – The number of times to resend any packet for any reason before an error is triggered
  • packet_timeout – 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
n_resent
n_retry_code_resent
n_timeouts
send_request(request, callback, error_callback)[source]

Add an SCP request to the set to be sent

Parameters:
  • request – The SCP request to be sent
  • callback – A callback function to call when the response has been received; takes SCPResponse as a parameter, or None if the response doesn’t need to be processed
  • error_callback – A callback function to call when an error is found when processing the message; takes original AbstractSCPRequest, exception caught and a list of tuples of (filename, line number, function name, text) as a traceback
spinnman.connections.socket_address_with_chip module
class spinnman.connections.socket_address_with_chip.SocketAddressWithChip(hostname, chip_x, chip_y, port_num=17893)[source]

Bases: object

The address of a socket and an associated chip

chip_x

The x-coordinate of the chip

Returns:the x-coordinate
chip_y

The y-coordinate of the chip

Returns:the y-coordinate
hostname

The hostname of the socket

Returns:the hostname
port_num

The port number of the socket

Returns:the port
spinnman.connections.token_bucket module
class spinnman.connections.token_bucket.TokenBucket(tokens, fill_rate)[source]

Bases: object

An implementation of the token bucket algorithm. Usage:

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

Not thread safe.

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

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

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

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

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

tokens
Module contents
class spinnman.connections.ConnectionListener(connection, n_processes=4, timeout=1)[source]

Bases: threading.Thread

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

Parameters:
  • connection – An AbstractListenable connection to listen to
  • n_processes – The number of threads to use when calling callbacks
  • timeout – 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 (connection message type -> None)) – A callable which takes a single parameter, which is the message received
close()[source]

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

run()[source]

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

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

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 – The connection over which the communication is to take place
  • n_channels – The number of requests to send before checking for responses. If None, this will be determined automatically
  • intermediate_channel_waits – The number of outstanding responses to wait for before continuing sending requests. If None, this will be determined automatically
  • n_retries – The number of times to resend any packet for any reason before an error is triggered
  • packet_timeout – 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
n_resent
n_retry_code_resent
n_timeouts
send_request(request, callback, error_callback)[source]

Add an SCP request to the set to be sent

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

Bases: object

The address of a socket and an associated chip

chip_x

The x-coordinate of the chip

Returns:the x-coordinate
chip_y

The y-coordinate of the chip

Returns:the y-coordinate
hostname

The hostname of the socket

Returns:the hostname
port_num

The port number of the socket

Returns:the port
class spinnman.connections.TokenBucket(tokens, fill_rate)[source]

Bases: object

An implementation of the token bucket algorithm. Usage:

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

Not thread safe.

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

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

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

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

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

tokens
spinnman.messages package
Subpackages
spinnman.messages.eieio package
Subpackages
spinnman.messages.eieio.command_messages package
Submodules
spinnman.messages.eieio.command_messages.database_confirmation module
class spinnman.messages.eieio.command_messages.database_confirmation.DatabaseConfirmation(database_path=None)[source]

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.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.

bytestring
database_path
static from_bytestring(command_header, data, offset)[source]
spinnman.messages.eieio.command_messages.eieio_command_header module
class spinnman.messages.eieio.command_messages.eieio_command_header.EIEIOCommandHeader(command)[source]

Bases: object

EIEIO header for command packets

bytestring

Get a bytestring of the header

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

Read an EIEIO command header from a bytestring

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

an EIEIO command header

Return type:

EIEIOCommandHeader

Raises:
spinnman.messages.eieio.command_messages.eieio_command_message module
class spinnman.messages.eieio.command_messages.eieio_command_message.EIEIOCommandMessage(eieio_command_header, data=None, offset=0)[source]

Bases: spinnman.messages.eieio.eieio_message.AbstractEIEIOMessage

An EIEIO command message

Parameters:
bytestring
data
eieio_header
static from_bytestring(command_header, data, offset)[source]
static get_min_packet_length()[source]
offset
spinnman.messages.eieio.command_messages.event_stop_request module
class spinnman.messages.eieio.command_messages.event_stop_request.EventStopRequest[source]

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.EIEIOCommandMessage

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

spinnman.messages.eieio.command_messages.host_data_read module
class spinnman.messages.eieio.command_messages.host_data_read.HostDataRead(n_requests, sequence_no, channel, region_id, space_read)[source]

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.EIEIOCommandMessage

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

bytestring
channel(ack_id)[source]
static from_bytestring(command_header, data, offset)[source]
static get_min_packet_length()[source]
n_requests
region_id(ack_id)[source]
sequence_no
space_read(ack_id)[source]
spinnman.messages.eieio.command_messages.host_data_read_ack module
class spinnman.messages.eieio.command_messages.host_data_read_ack.HostDataReadAck(sequence_no)[source]

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.EIEIOCommandMessage

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

bytestring
static from_bytestring(command_header, data, offset)[source]
sequence_no
spinnman.messages.eieio.command_messages.host_send_sequenced_data module
class spinnman.messages.eieio.command_messages.host_send_sequenced_data.HostSendSequencedData(region_id, sequence_no, eieio_data_message)[source]

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.EIEIOCommandMessage

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

bytestring
eieio_data_message
static from_bytestring(command_header, data, offset)[source]
static get_min_packet_length()[source]
region_id
sequence_no
spinnman.messages.eieio.command_messages.notification_protocol_pause_stop module
class spinnman.messages.eieio.command_messages.notification_protocol_pause_stop.NotificationProtocolPauseStop[source]

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.EIEIOCommandMessage

Packet which indicates that the toolchain has paused or stopped

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

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.EIEIOCommandMessage

Packet which indicates that the toolchain has started or resumed

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

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.EIEIOCommandMessage

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

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

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.EIEIOCommandMessage

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

bytestring
static from_bytestring(command_header, data, offset)[source]
static get_min_packet_length()[source]
p
region_id
sequence_no
space_available
x
y
spinnman.messages.eieio.command_messages.spinnaker_request_read_data module
class spinnman.messages.eieio.command_messages.spinnaker_request_read_data.SpinnakerRequestReadData(x, y, p, region_id, sequence_no, n_requests, channel, start_address, space_to_be_read)[source]

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.EIEIOCommandMessage

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

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

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.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

spinnman.messages.eieio.command_messages.stop_requests module
class spinnman.messages.eieio.command_messages.stop_requests.StopRequests[source]

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.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

Module contents
class spinnman.messages.eieio.command_messages.DatabaseConfirmation(database_path=None)[source]

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.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.

bytestring
database_path
static from_bytestring(command_header, data, offset)[source]
class spinnman.messages.eieio.command_messages.EIEIOCommandHeader(command)[source]

Bases: object

EIEIO header for command packets

bytestring

Get a bytestring of the header

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

Read an EIEIO command header from a bytestring

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

an EIEIO command header

Return type:

EIEIOCommandHeader

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

Bases: spinnman.messages.eieio.eieio_message.AbstractEIEIOMessage

An EIEIO command message

Parameters:
bytestring
data
eieio_header
static from_bytestring(command_header, data, offset)[source]
static get_min_packet_length()[source]
offset
class spinnman.messages.eieio.command_messages.EventStopRequest[source]

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.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)[source]

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.EIEIOCommandMessage

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

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

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.EIEIOCommandMessage

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

bytestring
eieio_data_message
static from_bytestring(command_header, data, offset)[source]
static get_min_packet_length()[source]
region_id
sequence_no
class spinnman.messages.eieio.command_messages.NotificationProtocolPauseStop[source]

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.EIEIOCommandMessage

Packet which indicates that the toolchain has paused or stopped

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

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.EIEIOCommandMessage

Packet which indicates that the toolchain has started or resumed

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

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.EIEIOCommandMessage

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

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

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.EIEIOCommandMessage

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

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

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.EIEIOCommandMessage

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

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

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.EIEIOCommandMessage

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

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

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.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[source]

Bases: spinnman.messages.eieio.command_messages.eieio_command_message.EIEIOCommandMessage

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

spinnman.messages.eieio.data_messages package
Submodules
spinnman.messages.eieio.data_messages.abstract_data_element module
class spinnman.messages.eieio.data_messages.abstract_data_element.AbstractDataElement[source]

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 (spinnman.messages.eieio.eieio_type.EIEIOType) – The type of the message being written
Returns:A bytestring for the element
Return type:str
Raises:SpinnmanInvalidParameterException – If the type is incompatible with the element
spinnman.messages.eieio.data_messages.eieio_data_header module
class spinnman.messages.eieio.data_messages.eieio_data_header.EIEIODataHeader(eieio_type, tag=0, prefix=None, prefix_type=<EIEIOPrefix.LOWER_HALF_WORD: 0>, payload_base=None, is_time=False, count=0)[source]

Bases: object

EIEIO header for data packets

Parameters:
  • eieio_type (spinnman.spinnman.messages.eieio.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 (spinnman.messages.eieio.EIEIOPrefix) – the position of the prefix (upper or lower)
  • payload_base (int or None) – The base payload to be applied, or None if no base payload
  • is_time (bool) – True if the payloads should be taken to be timestamps, or False otherwise
  • count (int) – Count of the number of items in the packet
bytestring

Get a bytestring of the header

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

Read an eieio data header from a bytestring

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

an EIEIO header

Return type:

spinnman.messages.eieio.data_messages.EIEIODataHeader

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

Get the size of a header with the given parameters

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

The size of the header in bytes

Return type:

int

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

Bases: spinnman.messages.eieio.eieio_message.AbstractEIEIOMessage

An EIEIO Data message

Parameters:
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 (spinnman.messages.eieio.data_messages.AbstractDataElement) – The element to be added

Raises:
add_key(key)[source]

Add a key to the packet

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

Adds a key and payload to the packet

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

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

bytestring
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 – The EIEIOType of the message
  • count – The number of items in the message
  • data – The data in the message
  • offset – The offset in the data where the actual data starts
  • key_prefix – The prefix of the keys
  • payload_prefix – The prefix of the payload
  • timestamp – The timestamp of the packet
  • prefix_type – The type of the key prefix if 16-bits
eieio_header
get_min_packet_length()[source]

Get the minimum length of a message instance in bytes

Return type:int
is_next_element

Determine if there is another element to be read

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

The maximum number of elements that can fit in the packet

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

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

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

The minimum size of the packet in bytes

Return type:

int

n_elements

The number of elements in the packet

next_element

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

Return type:spinnman.messages.eieio.data_messages.AbstractDataElement
size

The size of the packet with the current contents

spinnman.messages.eieio.data_messages.key_data_element module
class spinnman.messages.eieio.data_messages.key_data_element.KeyDataElement(key)[source]

Bases: spinnman.messages.eieio.data_messages.abstract_data_element.AbstractDataElement

A data element that contains just a key

get_bytestring(eieio_type)[source]

Get a bytestring for the given type

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

Bases: spinnman.messages.eieio.data_messages.abstract_data_element.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 (spinnman.messages.eieio.eieio_type.EIEIOType) – The type of the message being written
Returns:A bytestring for the element
Return type:str
Raises:SpinnmanInvalidParameterException – If the type is incompatible with the element
key
payload
payload_is_timestamp
Module contents
class spinnman.messages.eieio.data_messages.AbstractDataElement[source]

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 (spinnman.messages.eieio.eieio_type.EIEIOType) – The type of the message being written
Returns:A bytestring for the element
Return type:str
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)[source]

Bases: object

EIEIO header for data packets

Parameters:
  • eieio_type (spinnman.spinnman.messages.eieio.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 (spinnman.messages.eieio.EIEIOPrefix) – the position of the prefix (upper or lower)
  • payload_base (int or None) – The base payload to be applied, or None if no base payload
  • is_time (bool) – True if the payloads should be taken to be timestamps, or False otherwise
  • count (int) – Count of the number of items in the packet
bytestring

Get a bytestring of the header

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

Read an eieio data header from a bytestring

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

an EIEIO header

Return type:

spinnman.messages.eieio.data_messages.EIEIODataHeader

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

Get the size of a header with the given parameters

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

The size of the header in bytes

Return type:

int

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

Bases: spinnman.messages.eieio.eieio_message.AbstractEIEIOMessage

An EIEIO Data message

Parameters:
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 (spinnman.messages.eieio.data_messages.AbstractDataElement) – The element to be added

Raises:
add_key(key)[source]

Add a key to the packet

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

Adds a key and payload to the packet

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

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

bytestring
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 – The EIEIOType of the message
  • count – The number of items in the message
  • data – The data in the message
  • offset – The offset in the data where the actual data starts
  • key_prefix – The prefix of the keys
  • payload_prefix – The prefix of the payload
  • timestamp – The timestamp of the packet
  • prefix_type – The type of the key prefix if 16-bits
eieio_header
get_min_packet_length()[source]

Get the minimum length of a message instance in bytes

Return type:int
is_next_element

Determine if there is another element to be read

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

The maximum number of elements that can fit in the packet

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

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

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

The minimum size of the packet in bytes

Return type:

int

n_elements

The number of elements in the packet

next_element

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

Return type:spinnman.messages.eieio.data_messages.AbstractDataElement
size

The size of the packet with the current contents

class spinnman.messages.eieio.data_messages.KeyDataElement(key)[source]

Bases: spinnman.messages.eieio.data_messages.abstract_data_element.AbstractDataElement

A data element that contains just a key

get_bytestring(eieio_type)[source]

Get a bytestring for the given type

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

Bases: spinnman.messages.eieio.data_messages.abstract_data_element.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 (spinnman.messages.eieio.eieio_type.EIEIOType) – The type of the message being written
Returns:A bytestring for the element
Return type:str
Raises:SpinnmanInvalidParameterException – If the type is incompatible with the element
key
payload
payload_is_timestamp
Submodules
spinnman.messages.eieio.create_eieio_command module
spinnman.messages.eieio.create_eieio_command.read_eieio_command_message(data, offset)[source]

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

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

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

Return type:

spinnman.messages.eieio.command_messages.EIEIOCommandMessage

spinnman.messages.eieio.create_eieio_data module
spinnman.messages.eieio.create_eieio_data.read_eieio_data_message(data, offset)[source]

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

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

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

Return type:

spinnman.messages.eieio.data_messages.EIEIODataMessage

spinnman.messages.eieio.eieio_message module
class spinnman.messages.eieio.eieio_message.AbstractEIEIOMessage[source]

Bases: object

Marker interface for an EIEIOMessage

spinnman.messages.eieio.eieio_prefix module
class spinnman.messages.eieio.eieio_prefix.EIEIOPrefix(value, doc='')[source]

Bases: enum.Enum

Possible prefixing of keys in EIEIO packets

LOWER_HALF_WORD = 0
UPPER_HALF_WORD = 1
spinnman.messages.eieio.eieio_type module
class spinnman.messages.eieio.eieio_type.EIEIOType(value, key_bytes, payload_bytes, doc='')[source]

Bases: enum.Enum

Possible types of EIEIO packets

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

The number of bytes used by each key element

Return type:int
max_value

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

Return type:int
payload_bytes

The number of bytes used by each payload element

Return type:int
Module contents
class spinnman.messages.eieio.EIEIOPrefix(value, doc='')[source]

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='')[source]

Bases: enum.Enum

Possible types of EIEIO packets

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

The number of bytes used by each key element

Return type:int
max_value

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

Return type:int
payload_bytes

The number of bytes used by each payload element

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

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

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

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

Return type:

spinnman.messages.eieio.command_messages.EIEIOCommandMessage

spinnman.messages.eieio.read_eieio_data_message(data, offset)[source]

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

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

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

Return type:

spinnman.messages.eieio.data_messages.EIEIODataMessage

class spinnman.messages.eieio.AbstractEIEIOMessage[source]

Bases: object

Marker interface for an EIEIOMessage

spinnman.messages.scp package
Subpackages
spinnman.messages.scp.abstract_messages package
Submodules
spinnman.messages.scp.abstract_messages.bmp_request module
class spinnman.messages.scp.abstract_messages.bmp_request.BMPRequest(boards, scp_request_header, argument_1=None, argument_2=None, argument_3=None, data=None)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP request intended to be sent to a BMP.

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

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

static get_first_board(boards)[source]

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

spinnman.messages.scp.abstract_messages.bmp_response module
class spinnman.messages.scp.abstract_messages.bmp_response.BMPResponse[source]

Bases: spinnman.messages.scp.abstract_messages.scp_response.AbstractSCPResponse

Represents an SCP request thats tailored for the BMP connection.

spinnman.messages.scp.abstract_messages.scp_request module
class spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest(sdp_header, scp_request_header, argument_1=None, argument_2=None, argument_3=None, data=None)[source]

Bases: object

Represents an Abstract SCP Request

Parameters:
  • sdp_header (spinnman.messages.sdp.sdp_header.SDPHeader) – The SDP header of the request
  • scp_request_header (spinnman.messages.scp.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) – The optional data, or None if no data
Raises:

None – No known exceptions are raised

DEFAULT_DEST_X_COORD = 255
DEFAULT_DEST_Y_COORD = 255
argument_1

The first argument, or None if no first argument

Return type:int
argument_2

The second argument, or None if no second argument

Return type:int
argument_3

The third argument, or None if no third argument

Return type:int
bytestring

The request as a bytestring

Returns:The request as a bytestring
Return type:str
data

The data, or None if no data

Return type:bytearray
get_scp_response()[source]

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

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
scp_request_header

The SCP request header of the message

Return type:spinnman.messages.scp.SCPRequestHeader
sdp_header

The SDP header of the message

Return type:spinnman.message.sdp.sdp_header.SDPHeader
spinnman.messages.scp.abstract_messages.scp_response module
class spinnman.messages.scp.abstract_messages.scp_response.AbstractSCPResponse[source]

Bases: object

Represents an abstract SCP Response

read_bytestring(data, offset)[source]

Reads a packet from a bytestring of data

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

Reads the remainder of the data following the header

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

The SCP header from the response

Returns:The SCP header
Return type:spinnman.messages.scp.SCPResponseHeader
Raises:None – No known exceptions are raised
sdp_header

The SDP header from the response

Returns:The SDP header
Return type:spinnman.messages.sdp.sdp_header.SDPHeader
Raises:None – No known exceptions are raised
Module contents
class spinnman.messages.scp.abstract_messages.BMPRequest(boards, scp_request_header, argument_1=None, argument_2=None, argument_3=None, data=None)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP request intended to be sent to a BMP.

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

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

static get_first_board(boards)[source]

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

class spinnman.messages.scp.abstract_messages.BMPResponse[source]

Bases: spinnman.messages.scp.abstract_messages.scp_response.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)[source]

Bases: object

Represents an Abstract SCP Request

Parameters:
  • sdp_header (spinnman.messages.sdp.sdp_header.SDPHeader) – The SDP header of the request
  • scp_request_header (spinnman.messages.scp.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) – The optional data, or None if no data
Raises:

None – No known exceptions are raised

DEFAULT_DEST_X_COORD = 255
DEFAULT_DEST_Y_COORD = 255
argument_1

The first argument, or None if no first argument

Return type:int
argument_2

The second argument, or None if no second argument

Return type:int
argument_3

The third argument, or None if no third argument

Return type:int
bytestring

The request as a bytestring

Returns:The request as a bytestring
Return type:str
data

The data, or None if no data

Return type:bytearray
get_scp_response()[source]

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

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
scp_request_header

The SCP request header of the message

Return type:spinnman.messages.scp.SCPRequestHeader
sdp_header

The SDP header of the message

Return type:spinnman.message.sdp.sdp_header.SDPHeader
class spinnman.messages.scp.abstract_messages.AbstractSCPResponse[source]

Bases: object

Represents an abstract SCP Response

read_bytestring(data, offset)[source]

Reads a packet from a bytestring of data

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

Reads the remainder of the data following the header

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

The SCP header from the response

Returns:The SCP header
Return type:spinnman.messages.scp.SCPResponseHeader
Raises:None – No known exceptions are raised
sdp_header

The SDP header from the response

Returns:The SDP header
Return type:spinnman.messages.sdp.sdp_header.SDPHeader
Raises:None – No known exceptions are raised
spinnman.messages.scp.enums package
Submodules
spinnman.messages.scp.enums.alloc_free module
class spinnman.messages.scp.enums.alloc_free.AllocFree(value, doc='')[source]

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
spinnman.messages.scp.enums.bmp_info module
class spinnman.messages.scp.enums.bmp_info.BMPInfo(value, doc='')[source]

Bases: enum.Enum

The SCP BMP Information Types

ADC = 3
CAN_STATUS = 2
IP_ADDR = 4
SERIAL = 0
spinnman.messages.scp.enums.iptag_command module
class spinnman.messages.scp.enums.iptag_command.IPTagCommand(value, doc='')[source]

Bases: enum.Enum

SCP IP tag Commands

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

Bases: enum.Enum

The SCP LED actions

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

Bases: enum.Enum

The SCP Power Commands

POWER_OFF = 0
POWER_ON = 1
spinnman.messages.scp.enums.scp_command module
class spinnman.messages.scp.enums.scp_command.SCPCommand(value, doc='')[source]

Bases: enum.Enum

The SCP Commands

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

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
spinnman.messages.scp.enums.signal module
class spinnman.messages.scp.enums.signal.Signal(value, signal_type, doc='')[source]

Bases: enum.Enum

SCP Signals

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

Bases: enum.Enum

The type of signal, determined by how it is transmitted

MULTICAST = 0
NEAREST_NEIGHBOUR = 2
POINT_TO_POINT = 1
Module contents
class spinnman.messages.scp.enums.AllocFree(value, doc='')[source]

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='')[source]

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='')[source]

Bases: enum.Enum

The SCP Commands

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

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='')[source]

Bases: enum.Enum

The SCP LED actions

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

Bases: enum.Enum

The SCP Power Commands

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

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='')[source]

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
spinnman.messages.scp.impl package
Submodules
spinnman.messages.scp.impl.app_stop module
class spinnman.messages.scp.impl.app_stop.AppStop(app_id)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.application_run module
class spinnman.messages.scp.impl.application_run.ApplicationRun(app_id, x, y, processors, wait=False)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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 of 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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.bmp_get_version module
class spinnman.messages.scp.impl.bmp_get_version.BMPGetVersion(board)[source]

Bases: spinnman.messages.scp.abstract_messages.bmp_request.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:spinnman.exceptions.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.bmp_set_led module
class spinnman.messages.scp.impl.bmp_set_led.BMPSetLed(led, action, boards)[source]

Bases: spinnman.messages.scp.abstract_messages.bmp_request.BMPRequest

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

Parameters:
  • led (int or iterable of int) – Number of the LED or an iterable of LEDs to set the state of (0-7)
  • action (spinnman.messages.scp.enums.led_action.SCPLEDAction) – State to set the LED to, either on, off or toggle
  • boards (int or iterable of int) – Specifies the board to control the LEDs of. This may also be an iterable of multiple boards (in the same frame).
Return type:

None

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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised Get the response from the write FPGA register request
spinnman.messages.scp.impl.check_ok_response module
class spinnman.messages.scp.impl.check_ok_response.CheckOKResponse(operation, command)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_response.AbstractSCPResponse

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

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

Reads the remainder of the data following the header

Parameters:
  • data (str) – The bytestring to read from
  • offset (int) – The offset into the data after the headers
spinnman.messages.scp.impl.count_state module
class spinnman.messages.scp.impl.count_state.CountState(app_id, state)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

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

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

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

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.count_state_response module
class spinnman.messages.scp.impl.count_state_response.CountStateResponse[source]

Bases: spinnman.messages.scp.abstract_messages.scp_response.AbstractSCPResponse

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

count

The count of the number of cores with the requested state

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

Reads the remainder of the data following the header

Parameters:
  • data (str) – The bytestring to read from
  • offset (int) – The offset into the data after the headers
spinnman.messages.scp.impl.fill_request module
class spinnman.messages.scp.impl.fill_request.FillRequest(x, y, base_address, data, size)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.fixed_route_init module
class spinnman.messages.scp.impl.fixed_route_init.FixedRouteInit(x, y, entry, app_id)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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 – 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:

spinnman.exceptions.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.fixed_route_read module
class spinnman.messages.scp.impl.fixed_route_read.FixedRouteRead(x, y, app_id)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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
  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.
Raises:

spinnman.exceptions.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.flood_fill_data module
class spinnman.messages.scp.impl.flood_fill_data.FloodFillData(nearest_neighbour_id, block_no, base_address, data, offset=0, length=None)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

A request to start a flood fill of data

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

The request as a bytestring

Returns:The request as a bytestring
Return type:str
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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.flood_fill_end module
class spinnman.messages.scp.impl.flood_fill_end.FloodFillEnd(nearest_neighbour_id, app_id=0, processors=None, wait=False)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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 (iterable of 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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.flood_fill_start module
class spinnman.messages.scp.impl.flood_fill_start.FloodFillStart(nearest_neighbour_id, n_blocks, x=None, y=None)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.get_chip_info module
class spinnman.messages.scp.impl.get_chip_info.GetChipInfo(x, y, with_size=False)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP request to read the chip information from a core

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

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

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.get_chip_info_response module
class spinnman.messages.scp.impl.get_chip_info_response.GetChipInfoResponse[source]

Bases: spinnman.messages.scp.abstract_messages.scp_response.AbstractSCPResponse

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

chip_info

The chip information received

Return type:spinnman.model.chip_summary_info.ChipSummaryInfo
read_data_bytestring(data, offset)[source]

Reads the remainder of the data following the header

Parameters:
  • data (str) – The bytestring to read from
  • offset (int) – The offset into the data after the headers
spinnman.messages.scp.impl.get_version module
class spinnman.messages.scp.impl.get_version.GetVersion(x, y, p)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

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

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

spinnman.exceptions.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.get_version_response module
class spinnman.messages.scp.impl.get_version_response.GetVersionResponse[source]

Bases: spinnman.messages.scp.abstract_messages.scp_response.AbstractSCPResponse

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

read_data_bytestring(data, offset)[source]

Reads the remainder of the data following the header

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

The version information received

Return type:spinnman.model.version_info.VersionInfo
spinnman.messages.scp.impl.iptag_clear module
class spinnman.messages.scp.impl.iptag_clear.IPTagClear(x, y, tag)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP Request to clear an IP Tag

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

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

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.iptag_get module
class spinnman.messages.scp.impl.iptag_get.IPTagGet(x, y, tag)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP Request to get an IP tag

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

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

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.iptag_get_info module
class spinnman.messages.scp.impl.iptag_get_info.IPTagGetInfo(x, y)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP Request information about IP tags

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

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

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.iptag_get_info_response module
class spinnman.messages.scp.impl.iptag_get_info_response.IPTagGetInfoResponse[source]

Bases: spinnman.messages.scp.abstract_messages.scp_response.AbstractSCPResponse

An SCP response to a request for information about IP tags

fixed_size

The count of the number of fixed IP tag entries

Return type:int
pool_size

The count of the IP tag pool size

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

Reads the remainder of the data following the header

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

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

Return type:int
spinnman.messages.scp.impl.iptag_set module
class spinnman.messages.scp.impl.iptag_set.IPTagSet(x, y, host, port, tag, strip, use_sender=False)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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
  • 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 – if the sender ip address and port should be used
Type:

bool

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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.iptag_set_tto module
class spinnman.messages.scp.impl.iptag_set_tto.IPTagSetTTO(x, y, tag_timeout)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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 – The timeout value, via the IPTAG_TIME_OUT_WAIT_TIMES enum located in spinnman.constants
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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.read_adc module
class spinnman.messages.scp.impl.read_adc.ReadADC(board)[source]

Bases: spinnman.messages.scp.abstract_messages.bmp_request.BMPRequest

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

Parameters:board – which board to request the ADC register from
Return type:None
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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.read_fpga_register module
class spinnman.messages.scp.impl.read_fpga_register.ReadFPGARegister(fpga_num, register, board)[source]

Bases: spinnman.messages.scp.abstract_messages.bmp_request.BMPRequest

Requests the data from a FPGA’s register

Sets up a read FPGA register request.

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

None

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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.read_memory module
class spinnman.messages.scp.impl.read_memory.ReadMemory(x, y, base_address, size, cpu=0)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

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

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

spinnman.exceptions.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.reverse_iptag_set module
class spinnman.messages.scp.impl.reverse_iptag_set.ReverseIPTagSet(x, y, destination_x, destination_y, destination_p, port, tag, sdp_port)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.router_alloc module
class spinnman.messages.scp.impl.router_alloc.RouterAlloc(x, y, app_id, n_entries)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP Request to allocate space for routing entries

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

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

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.router_clear module
class spinnman.messages.scp.impl.router_clear.RouterClear(x, y)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

A request to clear the router 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
Raises:

spinnman.exceptions.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.router_init module
class spinnman.messages.scp.impl.router_init.RouterInit(x, y, n_entries, table_address, base_address, app_id)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

A request to initialize the router 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
  • 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:

spinnman.exceptions.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.sdram_alloc module
class spinnman.messages.scp.impl.sdram_alloc.SDRAMAlloc(x, y, app_id, size, tag=None)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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.
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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.sdram_de_alloc module
class spinnman.messages.scp.impl.sdram_de_alloc.SDRAMDeAlloc(x, y, app_id, base_address=None)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.send_signal module
class spinnman.messages.scp.impl.send_signal.SendSignal(app_id, signal)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP Request to send a signal to cores

Parameters:
  • app_id (int) – The ID of the application, between 0 and 255
  • signal (spinnman.messages.scp.scp_signal.SCPSignal) – The signal to send
Raises:

spinnman.exceptions.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.set_led module
class spinnman.messages.scp.impl.set_led.SetLED(x, y, cpu, led_states)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

A request to change the state of an SetLED

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

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

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.set_power module
class spinnman.messages.scp.impl.set_power.SetPower(power_command, boards, delay=0.0, board_to_send_to=0)[source]

Bases: spinnman.messages.scp.abstract_messages.bmp_request.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 (spinnman.messages.scp.scp_power_command.SCPPowerCommand) – The power command being sent
  • boards (int or iterable of int) – The boards on the same backplane to power on or off
  • delay (int) – Number of seconds delay between power state changes of the different boards.
  • board_to_send_to – The optional board to send the command to if this is to be sent to a frame of boards.
Type:

board_to_send_to: 0

Return type:

None

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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised Get the response from the powering message
spinnman.messages.scp.impl.write_fpga_register module
class spinnman.messages.scp.impl.write_fpga_register.WriteFPGARegister(fpga_num, addr, value, board)[source]

Bases: spinnman.messages.scp.abstract_messages.bmp_request.BMPRequest

A request for writing data to a FPGA register

Write the value of an FPGA (SPI) register.

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

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

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

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinnman.messages.scp.impl.write_memory module
class spinnman.messages.scp.impl.write_memory.WriteMemory(x, y, base_address, data, cpu=0)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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 string) – between 1 and 256 bytes of data to write; this is not checked due to speed restrictions
bytestring

The request as a bytestring

Returns:The request as a bytestring
Return type:str
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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
Module contents
class spinnman.messages.scp.impl.AppStop(app_id)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.ApplicationRun(app_id, x, y, processors, wait=False)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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 of 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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.BMPSetLed(led, action, boards)[source]

Bases: spinnman.messages.scp.abstract_messages.bmp_request.BMPRequest

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

Parameters:
  • led (int or iterable of int) – Number of the LED or an iterable of LEDs to set the state of (0-7)
  • action (spinnman.messages.scp.enums.led_action.SCPLEDAction) – State to set the LED to, either on, off or toggle
  • boards (int or iterable of int) – Specifies the board to control the LEDs of. This may also be an iterable of multiple boards (in the same frame).
Return type:

None

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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised Get the response from the write FPGA register request
class spinnman.messages.scp.impl.BMPGetVersion(board)[source]

Bases: spinnman.messages.scp.abstract_messages.bmp_request.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:spinnman.exceptions.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.CheckOKResponse(operation, command)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_response.AbstractSCPResponse

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

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

Reads the remainder of the data following the header

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

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP request to read the chip information from a core

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

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

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.CountState(app_id, state)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

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

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

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

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.FloodFillData(nearest_neighbour_id, block_no, base_address, data, offset=0, length=None)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

A request to start a flood fill of data

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

The request as a bytestring

Returns:The request as a bytestring
Return type:str
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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.FillRequest(x, y, base_address, data, size)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.FloodFillEnd(nearest_neighbour_id, app_id=0, processors=None, wait=False)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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 (iterable of 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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.FloodFillStart(nearest_neighbour_id, n_blocks, x=None, y=None)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.IPTagClear(x, y, tag)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP Request to clear an IP Tag

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

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

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.IPTagGet(x, y, tag)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP Request to get an IP tag

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

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

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.IPTagGetInfo(x, y)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP Request information about IP tags

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

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

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.IPTagSet(x, y, host, port, tag, strip, use_sender=False)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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
  • 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 – if the sender ip address and port should be used
Type:

bool

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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.IPTagSetTTO(x, y, tag_timeout)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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 – The timeout value, via the IPTAG_TIME_OUT_WAIT_TIMES enum located in spinnman.constants
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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.SetLED(x, y, cpu, led_states)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

A request to change the state of an SetLED

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

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

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.SetPower(power_command, boards, delay=0.0, board_to_send_to=0)[source]

Bases: spinnman.messages.scp.abstract_messages.bmp_request.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 (spinnman.messages.scp.scp_power_command.SCPPowerCommand) – The power command being sent
  • boards (int or iterable of int) – The boards on the same backplane to power on or off
  • delay (int) – Number of seconds delay between power state changes of the different boards.
  • board_to_send_to – The optional board to send the command to if this is to be sent to a frame of boards.
Type:

board_to_send_to: 0

Return type:

None

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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised Get the response from the powering message
class spinnman.messages.scp.impl.ReadADC(board)[source]

Bases: spinnman.messages.scp.abstract_messages.bmp_request.BMPRequest

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

Parameters:board – which board to request the ADC register from
Return type:None
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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.ReadFPGARegister(fpga_num, register, board)[source]

Bases: spinnman.messages.scp.abstract_messages.bmp_request.BMPRequest

Requests the data from a FPGA’s register

Sets up a read FPGA register request.

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

None

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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised

Bases: spinnman.messages.scp.abstract_messages.scp_request.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
  • cpu (int) – The CPU core to use, normally 0 (or if a BMP, the board slot number)
  • 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
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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.ReadMemory(x, y, base_address, size, cpu=0)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

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

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

spinnman.exceptions.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.ReverseIPTagSet(x, y, destination_x, destination_y, destination_p, port, tag, sdp_port)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.RouterAlloc(x, y, app_id, n_entries)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP Request to allocate space for routing entries

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

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

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.RouterClear(x, y)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

A request to clear the router 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
Raises:

spinnman.exceptions.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.RouterInit(x, y, n_entries, table_address, base_address, app_id)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

A request to initialize the router 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
  • 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:

spinnman.exceptions.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.SDRAMAlloc(x, y, app_id, size, tag=None)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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.
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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.SDRAMDeAlloc(x, y, app_id, base_address=None)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.SendSignal(app_id, signal)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP Request to send a signal to cores

Parameters:
  • app_id (int) – The ID of the application, between 0 and 255
  • signal (spinnman.messages.scp.scp_signal.SCPSignal) – The signal to send
Raises:

spinnman.exceptions.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.GetVersion(x, y, p)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

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

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

spinnman.exceptions.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.WriteFPGARegister(fpga_num, addr, value, board)[source]

Bases: spinnman.messages.scp.abstract_messages.bmp_request.BMPRequest

A request for writing data to a FPGA register

Write the value of an FPGA (SPI) register.

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

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

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

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.FixedRouteRead(x, y, app_id)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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
  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.
Raises:

spinnman.exceptions.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised

Bases: spinnman.messages.scp.abstract_messages.scp_request.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 (bytearray) – Up to 256 bytes of data to write
bytestring

The request as a bytestring

Returns:The request as a bytestring
Return type:str
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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.WriteMemory(x, y, base_address, data, cpu=0)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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 string) – between 1 and 256 bytes of data to write; this is not checked due to speed restrictions
bytestring

The request as a bytestring

Returns:The request as a bytestring
Return type:str
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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinnman.messages.scp.impl.FixedRouteInit(x, y, entry, app_id)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.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 – 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:

spinnman.exceptions.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:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
Submodules
spinnman.messages.scp.scp_request_header module
class spinnman.messages.scp.scp_request_header.SCPRequestHeader(command, sequence=0)[source]

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 (spinnman.messages.scp.scp_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:

spinnman.exceptions.SpinnmanInvalidParameterException – If one of the parameters is incorrect

bytestring

The header as a bytestring

Returns:The header as a bytestring
Return type:str
command

The command of the SCP packet

Returns:The command
Return type:spinnman.messages.scp.scp_command.SCPCommand
sequence

The sequence number of the SCP packet

Returns:The sequence number of the packet, between 0 and 65535
Return type:int
spinnman.messages.scp.scp_response_header module
class spinnman.messages.scp.scp_response_header.SCPResponseHeader(result=None, sequence=None)[source]

Bases: object

Represents the header of an SCP Response

static from_bytestring(data, offset)[source]

Read a header from a bytestring

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

The result of the SCP response

Returns:The result
Return type:spinnman.messages.scp.scp_result.SCPResult
sequence

The sequence number of the SCP response

Returns:The sequence number of the packet, between 0 and 65535
Return type:int
Module contents
class spinnman.messages.scp.SCPRequestHeader(command, sequence=0)[source]

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 (spinnman.messages.scp.scp_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:

spinnman.exceptions.SpinnmanInvalidParameterException – If one of the parameters is incorrect

bytestring

The header as a bytestring

Returns:The header as a bytestring
Return type:str
command

The command of the SCP packet

Returns:The command
Return type:spinnman.messages.scp.scp_command.SCPCommand
sequence

The sequence number of the SCP packet

Returns:The sequence number of the packet, between 0 and 65535
Return type:int
class spinnman.messages.scp.SCPResponseHeader(result=None, sequence=None)[source]

Bases: object

Represents the header of an SCP Response

static from_bytestring(data, offset)[source]

Read a header from a bytestring

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

The result of the SCP response

Returns:The result
Return type:spinnman.messages.scp.scp_result.SCPResult
sequence

The sequence number of the SCP response

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

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
spinnman.messages.sdp.sdp_header module
class spinnman.messages.sdp.sdp_header.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)[source]

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 (spinnman.messages.sdp.sdp_flag.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 – The y-coordinate of the source chip between 0 and 255, or None if it is to be set later
bytestring

The header as a bytestring

Returns:The header bytestring
Return type:str
destination_chip_x

The x-coordinate of the destination chip of the packet

Returns:The x-coordinate of the chip, between 0 and 255
Return type:int
destination_chip_y

The y-coordinate of the destination chip of the packet

Returns:The y-coordinate of the chip, between 0 and 255
Return type:int
destination_cpu

The core on the destination chip

Returns:The core on the destination chip, between 0 and 31
Return type:int
destination_port

The destination port of the packet

Returns:The destination port of the packet between 0 and 7
Return type:int
flags

The flags of the packet

Returns:The flags of the packet
Return type:spinnman.messages.sdp.sdp_flag.SDPFlag
static from_bytestring(data, offset)[source]

Read the header from a bytestring

Parameters:
  • data (str) – The bytestring to read the header from
  • offset (int) – The offset into the data from which to start reading
source_chip_x

The x-coordinate of the source chip of the packet

Returns:The x-coordinate of the chip, between 0 and 255
Return type:int
source_chip_y

The y-coordinate of the source chip of the packet

Returns:The y-coordinate of the chip, between 0 and 255
Return type:int
source_cpu

The core on the source chip

Returns:The core on the source chip, between 0 and 31
Return type:int
source_port

The source port of the packet

Returns:The source port of the packet between 0 and 7
Return type:int
tag

The tag of the packet

Returns:The tag of the packet between 0 and 255
Return type:int
spinnman.messages.sdp.sdp_message module
class spinnman.messages.sdp.sdp_message.SDPMessage(sdp_header, data=None, offset=0)[source]

Bases: object

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

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

None – No known exceptions are thrown

bytestring

The bytestring of the message

Returns:The bytestring of the message
Return type:str
data

The data in the packet

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

The offset where the valid data starts

Return type:int
sdp_header

The header of the packet

Returns:An SDP header
Return type:spinnman.messages.sdp.sdp_header.SDPHeader
Module contents
class spinnman.messages.sdp.SDPFlag(value, doc='')[source]

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)[source]

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 (spinnman.messages.sdp.sdp_flag.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 – The y-coordinate of the source chip between 0 and 255, or None if it is to be set later
bytestring

The header as a bytestring

Returns:The header bytestring
Return type:str
destination_chip_x

The x-coordinate of the destination chip of the packet

Returns:The x-coordinate of the chip, between 0 and 255
Return type:int
destination_chip_y

The y-coordinate of the destination chip of the packet

Returns:The y-coordinate of the chip, between 0 and 255
Return type:int
destination_cpu

The core on the destination chip

Returns:The core on the destination chip, between 0 and 31
Return type:int
destination_port

The destination port of the packet

Returns:The destination port of the packet between 0 and 7
Return type:int
flags

The flags of the packet

Returns:The flags of the packet
Return type:spinnman.messages.sdp.sdp_flag.SDPFlag
static from_bytestring(data, offset)[source]

Read the header from a bytestring

Parameters:
  • data (str) – The bytestring to read the header from
  • offset (int) – The offset into the data from which to start reading
source_chip_x

The x-coordinate of the source chip of the packet

Returns:The x-coordinate of the chip, between 0 and 255
Return type:int
source_chip_y

The y-coordinate of the source chip of the packet

Returns:The y-coordinate of the chip, between 0 and 255
Return type:int
source_cpu

The core on the source chip

Returns:The core on the source chip, between 0 and 31
Return type:int
source_port

The source port of the packet

Returns:The source port of the packet between 0 and 7
Return type:int
tag

The tag of the packet

Returns:The tag of the packet between 0 and 255
Return type:int
class spinnman.messages.sdp.SDPMessage(sdp_header, data=None, offset=0)[source]

Bases: object

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

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

None – No known exceptions are thrown

bytestring

The bytestring of the message

Returns:The bytestring of the message
Return type:str
data

The data in the packet

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

The offset where the valid data starts

Return type:int
sdp_header

The header of the packet

Returns:An SDP header
Return type:spinnman.messages.sdp.sdp_header.SDPHeader
spinnman.messages.spinnaker_boot package
Subpackages
spinnman.messages.spinnaker_boot.boot_data package
Module contents
Submodules
spinnman.messages.spinnaker_boot.spinnaker_boot_message module
class spinnman.messages.spinnaker_boot.spinnaker_boot_message.SpinnakerBootMessage(opcode, operand_1, operand_2, operand_3, data=None, offset=0)[source]

Bases: object

A message used for booting the board

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

spinnman.exceptions.SpinnmanInvalidParameterException – If the opcode is not a valid value

bytestring

The message as a bytestring

data

The data

Returns:The data or None if no data
Return type:bytearray
static from_bytestring(data, offset)[source]
opcode

The operation of this packet

Returns:The operation code
Return type:spinnman.messages.spinnaker_boot.SpinnakerBootOpCode
operand_1

The first operand

Returns:The operand
Return type:int
operand_2

The second operand

Returns:The second operand
Return type:int
operand_3

The third operand

Returns:The third operand
Return type:int
spinnman.messages.spinnaker_boot.spinnaker_boot_messages module
class spinnman.messages.spinnaker_boot.spinnaker_boot_messages.SpinnakerBootMessages(board_version=None, extra_boot_values=None)[source]

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 of SystemVariableDefinition to value) – Any additional values to be set during boot
Raises:
messages

Get an iterable of message to be sent.

spinnman.messages.spinnaker_boot.spinnaker_boot_op_code module
class spinnman.messages.spinnaker_boot.spinnaker_boot_op_code.SpinnakerBootOpCode(value, doc='')[source]

Bases: enum.Enum

Boot message Operation Codes

FLOOD_FILL_BLOCK = 3
FLOOD_FILL_CONTROL = 5
FLOOD_FILL_START = 1
HELLO = 65
spinnman.messages.spinnaker_boot.system_variable_boot_values module
class spinnman.messages.spinnaker_boot.system_variable_boot_values.SystemVariableBootValues(hardware_version=None, led_0=None)[source]

Bases: object

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

bytestring
set_value(system_variable_definition, value)[source]
class spinnman.messages.spinnaker_boot.system_variable_boot_values.SystemVariableDefinition(offset, data_type, default, array_size, doc)[source]

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

Bases: object

A message used for booting the board

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

spinnman.exceptions.SpinnmanInvalidParameterException – If the opcode is not a valid value

bytestring

The message as a bytestring

data

The data

Returns:The data or None if no data
Return type:bytearray
static from_bytestring(data, offset)[source]
opcode

The operation of this packet

Returns:The operation code
Return type:spinnman.messages.spinnaker_boot.SpinnakerBootOpCode
operand_1

The first operand

Returns:The operand
Return type:int
operand_2

The second operand

Returns:The second operand
Return type:int
operand_3

The third operand

Returns:The third operand
Return type:int
class spinnman.messages.spinnaker_boot.SpinnakerBootMessages(board_version=None, extra_boot_values=None)[source]

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 of SystemVariableDefinition to value) – Any additional values to be set during boot
Raises:
messages

Get an iterable of message to be sent.

class spinnman.messages.spinnaker_boot.SpinnakerBootOpCode(value, doc='')[source]

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)[source]

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

Bases: object

A SpiNNaker Multicast message

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

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

None – No known exceptions are raised

key

The key of the packet

Returns:The key
Return type:int
payload

The payload of the packet if there is one

Returns:The payload, or None if there is no payload
Return type:int
Module contents
spinnman.model package
Subpackages
spinnman.model.enums package
Submodules
spinnman.model.enums.cpu_state module
class spinnman.model.enums.cpu_state.CPUState(value, doc='')[source]

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
spinnman.model.enums.diagnostic_filter_default_routing_status module
class spinnman.model.enums.diagnostic_filter_default_routing_status.DiagnosticFilterDefaultRoutingStatus(value, doc='')[source]

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
spinnman.model.enums.diagnostic_filter_destination module
class spinnman.model.enums.diagnostic_filter_destination.DiagnosticFilterDestination(value, doc='')[source]

Bases: enum.Enum

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

DUMP = 0
LOCAL = 1
LOCAL_MONITOR = 2
spinnman.model.enums.diagnostic_filter_emergency_routing_status module
class spinnman.model.enums.diagnostic_filter_emergency_routing_status.DiagnosticFilterEmergencyRoutingStatus(value, doc='')[source]

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
spinnman.model.enums.diagnostic_filter_packet_type module
class spinnman.model.enums.diagnostic_filter_packet_type.DiagnosticFilterPacketType(value, doc='')[source]

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
spinnman.model.enums.diagnostic_filter_payload_status module
class spinnman.model.enums.diagnostic_filter_payload_status.DiagnosticFilterPayloadStatus(value, doc='')[source]

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
spinnman.model.enums.diagnostic_filter_source module
class spinnman.model.enums.diagnostic_filter_source.DiagnosticFilterSource(value, doc='')[source]

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
spinnman.model.enums.mailbox_command module
class spinnman.model.enums.mailbox_command.MailboxCommand(value, doc='')[source]

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
spinnman.model.enums.p2p_table_route module
class spinnman.model.enums.p2p_table_route.P2PTableRoute(value, doc='')[source]

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
spinnman.model.enums.run_time_error module
class spinnman.model.enums.run_time_error.RunTimeError(value, doc='')[source]

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
Module contents
class spinnman.model.enums.CPUState(value, doc='')[source]

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='')[source]

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='')[source]

Bases: enum.Enum

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

DUMP = 0
LOCAL = 1
LOCAL_MONITOR = 2
class spinnman.model.enums.RunTimeError(value, doc='')[source]

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.enums.DiagnosticFilterEmergencyRoutingStatus(value, doc='')[source]

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='')[source]

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='')[source]

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='')[source]

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='')[source]

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='')[source]

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
Submodules
spinnman.model.adc_info module
class spinnman.model.adc_info.ADCInfo(adc_data, offset)[source]

Bases: object

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

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

fan 0

Return type:float or None
fan_1

fan 1

Return type:float or None
temp_btm

temperature bottom

Return type:float
temp_ext_0

temperature external 0

Return type:float or None
temp_ext_1

temperature external 1

Return type:float or None
temp_top

temperature top

Return type:float
voltage_1_2a

Actual voltage of the 1.2V a supply rail

Return type:float
voltage_1_2b

Actual voltage of the 1.2V b supply rail

Return type:float
voltage_1_2c

Actual voltage of the 1.2V c supply rail

Return type:float
voltage_1_8

Actual voltage of the 1.8V supply rail

Return type:float
voltage_3_3

Actual voltage of the 3.3V supply rail

Return type:float
voltage_supply

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

Return type:float
spinnman.model.bmp_connection_data module
class spinnman.model.bmp_connection_data.BMPConnectionData(cabinet, frame, ip_address, boards, port_num)[source]

Bases: object

Contains the details of a BMP connection

boards

The boards to be addressed.

Return type:iterable(int)
cabinet

Get the cabinet number.

Return type:int
frame

Get the frame number.

Return type:int
ip_address

Get the IP address of the BMP.

Return type:str
port_num

The port number associated with this BMP connection.

Returns:The port number
spinnman.model.chip_info module
class spinnman.model.chip_info.ChipInfo(system_data, offset)[source]

Bases: object

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

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

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

cpu_clock_mhz

The speed of the CPU clock in MHz

Return type:int
cpu_information_base_address

The base address of the CPU information structure

Return type:int
first_free_router_entry

The ID of the first free routing entry on the chip

Return type:int
iobuf_size

The size of the iobuf buffers in bytes

Return type:int
ip_address

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

Return type:str
is_ethernet_available

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

Return type:bool

The links that are available on the chip

Return type:iterable of int
nearest_ethernet_x

The x-coordinate of the nearest chip with Ethernet

Return type:int
nearest_ethernet_y

The y-coordinate of the nearest chip with Ethernet

Return type:int
physical_to_virtual_core_map

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

Return type:bytearray
router_table_copy_address()[source]

The address of the copy of the router table

Return type:int
sdram_base_address

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

Return type:int
sdram_heap_address

The address of the base of the heap in SDRAM

Return type:int
system_ram_heap_address

The address of the base of the heap in system RAM

Return type:int
system_sdram_base_address

The base address of the System SDRAM region on the chip

Return type:int
virtual_core_ids

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

Return type:iterable(int)
x

The x-coordinate of the chip

Return type:int
x_size

The number of chips in the x-dimension

Return type:int
y

The y-coordinate of the chip

Return type:int
y_size

The number of chips in the y-dimension

Return type:int
spinnman.model.chip_summary_info module
class spinnman.model.chip_summary_info.ChipSummaryInfo(chip_summary_data, offset, x, y)[source]

Bases: object

Represents the chip summary information read via an SCP command

Parameters:
  • chip_summary_data (bytearray) – The data from the SCP response
  • offset (int) – The offset into the data where the data starts
  • x – The x-coordinate of the chip that this data is from
  • y – The y-coordinate of the chip that this data is from
core_states

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

Return type:list(spinnman.model.enums.CPUState)
ethernet_ip_address

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

Return type:str
is_ethernet_available

Determines if the Ethernet connection is available on this chip

Return type:bool
largest_free_sdram_block

The size of the largest block of free SDRAM in bytes

Return type:int
largest_free_sram_block

The size of the largest block of free SRAM in bytes

Return type:int
n_cores

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

Return type:int
n_free_multicast_routing_entries

The number of multicast routing entries free on this chip

Return type:int
nearest_ethernet_x

The x coordinate of the nearest Ethernet chip

Return type:int
nearest_ethernet_y

The y coordinate of the nearest Ethernet chip

Return type:int

The IDs of the working links outgoing from this chip

Return type:list(int)
x

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

Return type:int
y

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

Return type:int
spinnman.model.cpu_info module
class spinnman.model.cpu_info.CPUInfo(x, y, p, cpu_data, offset)[source]

Bases: object

Represents information about the state of a CPU.

Parameters:
  • x (int) – The x-coordinate of a chip
  • y (int) – The y-coordinate of a chip
  • p (int) – The ID of a core on the chip
  • cpu_data (str) – A bytestring received from SDRAM on the board
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:spinnman.model.enums.mailbox_command.MailboxCommand
application_mailbox_data_address

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

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

The name of the application running on the core.

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

The address of the IOBUF buffer in SDRAM.

Returns:The address
Return type:int

The current link register value (LR).

Returns:The LR value
Return type:int
monitor_mailbox_command

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

Returns:The command
Return type:spinnman.model.mailbox_command.MailboxCommand
monitor_mailbox_data_address

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

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

The ID of the core on the chip.

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

The physical ID of this processor.

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

The value in the processor state register (PSR).

Returns:The PSR value
Return type:int
registers

The current register values (r0 - r7).

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

The reason for a run time error.

Returns:The run time error
Return type:spinnman.model.enums.run_time_error.RunTimeError
software_error_count

The number of software errors counted.

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

The address of the filename of the software source.

Returns:The filename
Return type:str
software_source_line_number

The line number of the software source.

Returns:The line number
Return type:int
software_version

The software version.

Returns:The software version
Return type:int
stack_pointer

The current stack pointer value (SP).

Returns:The SP value
Return type:int
state

The current state of the core.

Returns:The state of the core
Return type:spinnman.model.enums.cpu_state.CPUState
time

The time at which the application started.

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

The current user values (user0 - user3).

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

The x-coordinate of the chip containing the core.

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

The y-coordinate of the chip containing the core.

Returns:The y-coordinate of the chip
Return type:int
spinnman.model.cpu_infos module
class spinnman.model.cpu_infos.CPUInfos[source]

Bases: object

A set of CPU information objects.

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

Add a processor on a given chip to the set.

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

The one per core core info.

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

Get the information for the given core on the given chip

is_core(x, y, p)[source]

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

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

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

iterkeys()[source]

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

itervalues()[source]

Get an iterable of cpu_info.

keys()[source]
values()[source]
spinnman.model.diagnostic_filter module
class spinnman.model.diagnostic_filter.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)[source]

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:
default_routing_statuses
destinations
emergency_routing_statuses
enable_interrupt_on_counter_event
filter_word

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

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

Bases: object

Encapsulate the binaries and cores on which to execute them.

add_processor(binary, chip_x, chip_y, chip_p)[source]

Add a processor to the executable targets

Parameters:
  • binary – the binary path for executable
  • chip_x – the coordinate on the machine in terms of x for the chip
  • chip_y – the coordinate on the machine in terms of y for the chip
  • chip_p – the processor ID to place this executable on
Returns:

add_subsets(binary, subsets)[source]

Add core subsets to a binary

Parameters:
  • binary – the path to the binary needed to be executed
  • subsets – the subset of cores that the binary needs to be loaded on
Returns:

all_core_subsets

All the core subsets for all the binaries

binaries

The binaries of the executables

get_cores_for_binary(binary)[source]

Get the cores that a binary is to run on

Parameters:binary – The binary to find the cores for
known(binary, chip_x, chip_y, chip_p)[source]
total_processors

The total number of cores to be loaded

spinnman.model.heap_element module
class spinnman.model.heap_element.HeapElement(block_address, next_address, free)[source]

Bases: object

An element of one of the heaps on SpiNNaker.

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

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

block_address

The address of the block

is_free

True if this block is a free block, False otherwise

next_address

The address of the next block, or 0 if none

size

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

tag

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

spinnman.model.io_buffer module
class spinnman.model.io_buffer.IOBuffer(x, y, p, iobuf)[source]

Bases: object

The contents of IOBUF for a core

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

None – No known exceptions are raised

iobuf

The contents of the buffer

Returns:The contents of the buffer
Return type:str
p

The ID of the core on the chip

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

The x-coordinate of the chip containing the core

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

The y-coordinate of the chip containing the core

Returns:The y-coordinate of the chip
Return type:int
spinnman.model.machine_dimensions module
class spinnman.model.machine_dimensions.MachineDimensions(width, height)[source]

Bases: object

Represents the size of a machine in chips

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

None – No known exceptions are raised

height

The height of the machine in chips

Returns:The height
Return type:int
width

The width of the machine in chips

Returns:The width
Return type:int
spinnman.model.p2p_table module
class spinnman.model.p2p_table.P2PTable(width, height, column_data)[source]

Bases: object

Represents a P2P routing table read from the machine.

static get_column_offset(column)[source]

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

Parameters:column – 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 – The height of the machine
get_route(x, y)[source]

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

Parameters:
  • x – The x-coordinate of the chip to find the route to
  • y – The y-coordinate of the chip to find the route to
height

The height of the machine that this table represents.

is_route(x, y)[source]

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

Parameters:
  • x – The x-coordinate of the chip to look up
  • y – The y-coordinate of the chip to look up
iterchips()[source]

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

width

The width of the machine that this table represents.

spinnman.model.router_diagnostics module
class spinnman.model.router_diagnostics.RouterDiagnostics(control_register, error_status, register_values)[source]

Bases: object

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

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

spinnman.exceptions.SpinnmanInvalidParameterException – If the number of register values is not 16

error_status

The error status

Returns:The error status
Return type:int
mon

The “mon” part of the control register

Returns:The mon bits
Return type:int
n_dropped_fixed_route_packets

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

Returns:The number of packets
Return type:int
n_dropped_multicast_packets

The number of multicast packets received that were dropped.

Returns:The number of packets
Return type:int
n_dropped_nearest_neighbour_packets

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

Returns:The number of packets
Return type:int
n_dropped_peer_to_peer_packets

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

Returns:The number of packets
Return type:int
n_external_fixed_route_packets

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

Returns:The number of packets
Return type:int
n_external_multicast_packets

The number of multicast packets received from external links.

Returns:The number of packets
Return type:int
n_external_nearest_neighbour_packets

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

Returns:The number of packets
Return type:int
n_external_peer_to_peer_packets

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

Returns:The number of packets
Return type:int
n_local_fixed_route_packets

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

Returns:The number of packets
Return type:int
n_local_multicast_packets

The number of multicast packets received from local cores.

Returns:The number of packets
Return type:int
n_local_nearest_neighbour_packets

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

Returns:The number of packets
Return type:int
n_local_peer_to_peer_packets

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

Returns:The number of packets
Return type:int
registers

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

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

The data gained from the user 0 router diagnostic filter.

Returns:the number of packets captured by this filter.
user_1

The data gained from the user 1 router diagnostic filter

Returns:the number of packets captured by this filter.
user_2

The data gained from the user 2 router diagnostic filter.

Returns:the number of packets captured by this filter.
user_3

The data gained from the user 3 router diagnostic filter.

Returns:the number of packets captured by this filter.
user_registers

The values in the user control registers.

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

The “wait_1” part of the control register

Returns:The wait_1 bits
Return type:int
wait_2

The “wait_2” part of the control register

Returns:The wait_2 bits
Return type:int
spinnman.model.version_info module
class spinnman.model.version_info.VersionInfo(version_data, offset=0)[source]

Bases: object

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

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

spinnman.exceptions.SpinnmanInvalidParameterException – If the message does not contain valid version information

build_date

The build date of the software.

Returns:The number of seconds since 1st January 1970
Return type:int
hardware

The hardware being run on.

Returns:The hardware
Return type:str
name

The name of the software.

Returns:The name
Return type:str
p

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

Returns:the processor ID
Return type:int
version_number

The version number of the software.

Returns:The version
Return type:tuple(int, int, int)
version_string

The version information as text.

Returns:The version information
Return type:str
x

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

Returns:the x-coordinate
Return type:int
y

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

Returns:The y-coordinate
Return type:int
Module contents
class spinnman.model.ADCInfo(adc_data, offset)[source]

Bases: object

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

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

fan 0

Return type:float or None
fan_1

fan 1

Return type:float or None
temp_btm

temperature bottom

Return type:float
temp_ext_0

temperature external 0

Return type:float or None
temp_ext_1

temperature external 1

Return type:float or None
temp_top

temperature top

Return type:float
voltage_1_2a

Actual voltage of the 1.2V a supply rail

Return type:float
voltage_1_2b

Actual voltage of the 1.2V b supply rail

Return type:float
voltage_1_2c

Actual voltage of the 1.2V c supply rail

Return type:float
voltage_1_8

Actual voltage of the 1.8V supply rail

Return type:float
voltage_3_3

Actual voltage of the 3.3V supply rail

Return type:float
voltage_supply

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

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

Bases: object

Contains the details of a BMP connection

boards

The boards to be addressed.

Return type:iterable(int)
cabinet

Get the cabinet number.

Return type:int
frame

Get the frame number.

Return type:int
ip_address

Get the IP address of the BMP.

Return type:str
port_num

The port number associated with this BMP connection.

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

Bases: object

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

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

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

cpu_clock_mhz

The speed of the CPU clock in MHz

Return type:int
cpu_information_base_address

The base address of the CPU information structure

Return type:int
first_free_router_entry

The ID of the first free routing entry on the chip

Return type:int
iobuf_size

The size of the iobuf buffers in bytes

Return type:int
ip_address

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

Return type:str
is_ethernet_available

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

Return type:bool

The links that are available on the chip

Return type:iterable of int
nearest_ethernet_x

The x-coordinate of the nearest chip with Ethernet

Return type:int
nearest_ethernet_y

The y-coordinate of the nearest chip with Ethernet

Return type:int
physical_to_virtual_core_map

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

Return type:bytearray
router_table_copy_address()[source]

The address of the copy of the router table

Return type:int
sdram_base_address

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

Return type:int
sdram_heap_address

The address of the base of the heap in SDRAM

Return type:int
system_ram_heap_address

The address of the base of the heap in system RAM

Return type:int
system_sdram_base_address

The base address of the System SDRAM region on the chip

Return type:int
virtual_core_ids

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

Return type:iterable(int)
x

The x-coordinate of the chip

Return type:int
x_size

The number of chips in the x-dimension

Return type:int
y

The y-coordinate of the chip

Return type:int
y_size

The number of chips in the y-dimension

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

Bases: object

Represents the chip summary information read via an SCP command

Parameters:
  • chip_summary_data (bytearray) – The data from the SCP response
  • offset (int) – The offset into the data where the data starts
  • x – The x-coordinate of the chip that this data is from
  • y – The y-coordinate of the chip that this data is from
core_states

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

Return type:list(spinnman.model.enums.CPUState)
ethernet_ip_address

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

Return type:str
is_ethernet_available

Determines if the Ethernet connection is available on this chip

Return type:bool
largest_free_sdram_block

The size of the largest block of free SDRAM in bytes

Return type:int
largest_free_sram_block

The size of the largest block of free SRAM in bytes

Return type:int
n_cores

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

Return type:int
n_free_multicast_routing_entries

The number of multicast routing entries free on this chip

Return type:int
nearest_ethernet_x

The x coordinate of the nearest Ethernet chip

Return type:int
nearest_ethernet_y

The y coordinate of the nearest Ethernet chip

Return type:int

The IDs of the working links outgoing from this chip

Return type:list(int)
x

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

Return type:int
y

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

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

Bases: object

Represents information about the state of a CPU.

Parameters:
  • x (int) – The x-coordinate of a chip
  • y (int) – The y-coordinate of a chip
  • p (int) – The ID of a core on the chip
  • cpu_data (str) – A bytestring received from SDRAM on the board
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:spinnman.model.enums.mailbox_command.MailboxCommand
application_mailbox_data_address

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

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

The name of the application running on the core.

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

The address of the IOBUF buffer in SDRAM.

Returns:The address
Return type:int

The current link register value (LR).

Returns:The LR value
Return type:int
monitor_mailbox_command

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

Returns:The command
Return type:spinnman.model.mailbox_command.MailboxCommand
monitor_mailbox_data_address

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

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

The ID of the core on the chip.

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

The physical ID of this processor.

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

The value in the processor state register (PSR).

Returns:The PSR value
Return type:int
registers

The current register values (r0 - r7).

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

The reason for a run time error.

Returns:The run time error
Return type:spinnman.model.enums.run_time_error.RunTimeError
software_error_count

The number of software errors counted.

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

The address of the filename of the software source.

Returns:The filename
Return type:str
software_source_line_number

The line number of the software source.

Returns:The line number
Return type:int
software_version

The software version.

Returns:The software version
Return type:int
stack_pointer

The current stack pointer value (SP).

Returns:The SP value
Return type:int
state

The current state of the core.

Returns:The state of the core
Return type:spinnman.model.enums.cpu_state.CPUState
time

The time at which the application started.

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

The current user values (user0 - user3).

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

The x-coordinate of the chip containing the core.

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

The y-coordinate of the chip containing the core.

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

Bases: object

A set of CPU information objects.

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

Add a processor on a given chip to the set.

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

The one per core core info.

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

Get the information for the given core on the given chip

is_core(x, y, p)[source]

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

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

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

iterkeys()[source]

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

itervalues()[source]

Get an iterable of cpu_info.

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

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:
default_routing_statuses
destinations
emergency_routing_statuses
enable_interrupt_on_counter_event
filter_word

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

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

Bases: object

Encapsulate the binaries and cores on which to execute them.

add_processor(binary, chip_x, chip_y, chip_p)[source]

Add a processor to the executable targets

Parameters:
  • binary – the binary path for executable
  • chip_x – the coordinate on the machine in terms of x for the chip
  • chip_y – the coordinate on the machine in terms of y for the chip
  • chip_p – the processor ID to place this executable on
Returns:

add_subsets(binary, subsets)[source]

Add core subsets to a binary

Parameters:
  • binary – the path to the binary needed to be executed
  • subsets – the subset of cores that the binary needs to be loaded on
Returns:

all_core_subsets

All the core subsets for all the binaries

binaries

The binaries of the executables

get_cores_for_binary(binary)[source]

Get the cores that a binary is to run on

Parameters:binary – The binary to find the cores for
known(binary, chip_x, chip_y, chip_p)[source]
total_processors

The total number of cores to be loaded

class spinnman.model.HeapElement(block_address, next_address, free)[source]

Bases: object

An element of one of the heaps on SpiNNaker.

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

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

block_address

The address of the block

is_free

True if this block is a free block, False otherwise

next_address

The address of the next block, or 0 if none

size

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

tag

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

class spinnman.model.IOBuffer(x, y, p, iobuf)[source]

Bases: object

The contents of IOBUF for a core

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

None – No known exceptions are raised

iobuf

The contents of the buffer

Returns:The contents of the buffer
Return type:str
p

The ID of the core on the chip

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

The x-coordinate of the chip containing the core

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

The y-coordinate of the chip containing the core

Returns:The y-coordinate of the chip
Return type:int
class spinnman.model.MachineDimensions(width, height)[source]

Bases: object

Represents the size of a machine in chips

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

None – No known exceptions are raised

height

The height of the machine in chips

Returns:The height
Return type:int
width

The width of the machine in chips

Returns:The width
Return type:int
class spinnman.model.P2PTable(width, height, column_data)[source]

Bases: object

Represents a P2P routing table read from the machine.

static get_column_offset(column)[source]

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

Parameters:column – 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 – The height of the machine
get_route(x, y)[source]

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

Parameters:
  • x – The x-coordinate of the chip to find the route to
  • y – The y-coordinate of the chip to find the route to
height

The height of the machine that this table represents.

is_route(x, y)[source]

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

Parameters:
  • x – The x-coordinate of the chip to look up
  • y – The y-coordinate of the chip to look up
iterchips()[source]

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

width

The width of the machine that this table represents.

class spinnman.model.RouterDiagnostics(control_register, error_status, register_values)[source]

Bases: object

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

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

spinnman.exceptions.SpinnmanInvalidParameterException – If the number of register values is not 16

error_status

The error status

Returns:The error status
Return type:int
mon

The “mon” part of the control register

Returns:The mon bits
Return type:int
n_dropped_fixed_route_packets

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

Returns:The number of packets
Return type:int
n_dropped_multicast_packets

The number of multicast packets received that were dropped.

Returns:The number of packets
Return type:int
n_dropped_nearest_neighbour_packets

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

Returns:The number of packets
Return type:int
n_dropped_peer_to_peer_packets

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

Returns:The number of packets
Return type:int
n_external_fixed_route_packets

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

Returns:The number of packets
Return type:int
n_external_multicast_packets

The number of multicast packets received from external links.

Returns:The number of packets
Return type:int
n_external_nearest_neighbour_packets

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

Returns:The number of packets
Return type:int
n_external_peer_to_peer_packets

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

Returns:The number of packets
Return type:int
n_local_fixed_route_packets

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

Returns:The number of packets
Return type:int
n_local_multicast_packets

The number of multicast packets received from local cores.

Returns:The number of packets
Return type:int
n_local_nearest_neighbour_packets

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

Returns:The number of packets
Return type:int
n_local_peer_to_peer_packets

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

Returns:The number of packets
Return type:int
registers

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

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

The data gained from the user 0 router diagnostic filter.

Returns:the number of packets captured by this filter.
user_1

The data gained from the user 1 router diagnostic filter

Returns:the number of packets captured by this filter.
user_2

The data gained from the user 2 router diagnostic filter.

Returns:the number of packets captured by this filter.
user_3

The data gained from the user 3 router diagnostic filter.

Returns:the number of packets captured by this filter.
user_registers

The values in the user control registers.

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

The “wait_1” part of the control register

Returns:The wait_1 bits
Return type:int
wait_2

The “wait_2” part of the control register

Returns:The wait_2 bits
Return type:int
class spinnman.model.VersionInfo(version_data, offset=0)[source]

Bases: object

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

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

spinnman.exceptions.SpinnmanInvalidParameterException – If the message does not contain valid version information

build_date

The build date of the software.

Returns:The number of seconds since 1st January 1970
Return type:int
hardware

The hardware being run on.

Returns:The hardware
Return type:str
name

The name of the software.

Returns:The name
Return type:str
p

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

Returns:the processor ID
Return type:int
version_number

The version number of the software.

Returns:The version
Return type:tuple(int, int, int)
version_string

The version information as text.

Returns:The version information
Return type:str
x

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

Returns:the x-coordinate
Return type:int
y

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

Returns:The y-coordinate
Return type:int
spinnman.processes package
Submodules
spinnman.processes.abstract_multi_connection_process module
class spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess(next_connection_selector, n_retries=10, timeout=1.0, n_channels=8, intermediate_channel_waits=7)[source]

Bases: spinnman.processes.abstract_process.AbstractProcess

A process that uses multiple connections in communication.

spinnman.processes.abstract_multi_connection_process_connection_selector module
class spinnman.processes.abstract_multi_connection_process_connection_selector.AbstractMultiConnectionProcessConnectionSelector(connections)[source]

Bases: object

A connection selector for multi-connection processes

Parameters:connections – 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 – The SCP message to be sent
Return type:int
spinnman.processes.abstract_process module
class spinnman.processes.abstract_process.AbstractProcess[source]

Bases: object

An abstract process for talking to SpiNNaker efficiently.

check_for_error(print_exception=False)[source]
is_error()[source]
spinnman.processes.abstract_single_connection_process module
class spinnman.processes.abstract_single_connection_process.AbstractSingleConnectionProcess(connection_selector, n_retries=10)[source]

Bases: spinnman.processes.abstract_process.AbstractProcess

A process that uses a single connection in communication.

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

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

run(app_id, core_subsets, wait)[source]
spinnman.processes.de_alloc_sdram_process module
class spinnman.processes.de_alloc_sdram_process.DeAllocSDRAMProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

de_alloc_sdram(x, y, app_id, base_address=None)[source]
no_blocks_freed
spinnman.processes.fill_process module
class spinnman.processes.fill_process.FillDataType(value, struct_type, doc='')[source]

Bases: enum.Enum

An enumeration.

BYTE = 1
HALF_WORD = 2
WORD = 4
struct

An object that can pack and unpack 4 bytes-worth of this type.

Return type:struct.Struct
struct_type

The struct descriptor for packing and unpacking 4 bytes-worth of this type.

Return type:str
class spinnman.processes.fill_process.FillProcess(next_connection_selector, n_retries=10, timeout=1.0, n_channels=8, intermediate_channel_waits=7)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

A process for filling memory.

fill_memory(x, y, base_address, data, size, data_type)[source]
spinnman.processes.get_cpu_info_process module
class spinnman.processes.get_cpu_info_process.GetCPUInfoProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

get_cpu_info(core_subsets)[source]
handle_response(x, y, p, response)[source]
spinnman.processes.get_heap_process module
class spinnman.processes.get_heap_process.GetHeapProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

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]
spinnman.processes.get_machine_process module
class spinnman.processes.get_machine_process.GetMachineProcess(connection_selector, ignore_chips, ignore_cores, ignore_links, max_core_id, max_sdram_size=None)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

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

create_machine(width, height, repair_machine, ignore_bad_ethernets)[source]
get_chip_info()[source]

Get the chip information for the machine.

Note

get_machine_details() must have been called first.

get_machine_details(boot_x, boot_y, width, height, repair_machine, ignore_bad_ethernets)[source]
spinnman.processes.get_routes_process module
class spinnman.processes.get_routes_process.GetMultiCastRoutesProcess(connection_selector, app_id=None)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

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

get_routes(x, y, base_address)[source]
handle_read_response(offset, response)[source]
spinnman.processes.get_tags_process module
class spinnman.processes.get_tags_process.GetTagsProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

get_tags(connection)[source]
handle_get_tag_response(tag, board_address, response)[source]
handle_tag_info_response(response)[source]
spinnman.processes.get_version_process module
class spinnman.processes.get_version_process.GetVersionProcess(connection_selector, n_retries=10)[source]

Bases: spinnman.processes.abstract_single_connection_process.AbstractSingleConnectionProcess

A process for getting the version of the machine.

get_version(x, y, p)[source]
spinnman.processes.load_fixed_route_routing_entry_process module
class spinnman.processes.load_fixed_route_routing_entry_process.LoadFixedRouteRoutingEntryProcess(next_connection_selector, n_retries=10, timeout=1.0, n_channels=8, intermediate_channel_waits=7)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

load_fixed_route(x, y, fixed_route, app_id=0)[source]

Load a fixed route routing entry onto 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.
  • fixed_route – the fixed route entry
  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.
Return type:

None

spinnman.processes.load_routes_process module
class spinnman.processes.load_routes_process.LoadMultiCastRoutesProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

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

handle_router_alloc_response(response)[source]
load_routes(x, y, routes, app_id)[source]
spinnman.processes.malloc_sdram_process module
class spinnman.processes.malloc_sdram_process.MallocSDRAMProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

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

base_address
malloc_sdram(x, y, size, app_id, tag)[source]

Allocate space in the SDRAM space.

spinnman.processes.most_direct_connection_selector module
class spinnman.processes.most_direct_connection_selector.MostDirectConnectionSelector(machine, connections)[source]

Bases: spinnman.processes.abstract_multi_connection_process_connection_selector.AbstractMultiConnectionProcessConnectionSelector

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

Parameters:connections – 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 – The SCP message to be sent
Return type:int
set_machine(new_machine)[source]
spinnman.processes.read_fixed_route_routing_entry_process module
class spinnman.processes.read_fixed_route_routing_entry_process.ReadFixedRouteRoutingEntryProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

A process for reading a chip’s fixed route routing entry.

Creates the process for writing a fixed route entry to a chip’s router.

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

Reads a fixed route routing table 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.
Return type:

None

spinnman.processes.read_iobuf_process module
class spinnman.processes.read_iobuf_process.ReadIOBufProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

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

read_iobuf(iobuf_size, core_subsets)[source]
Return type:iterable of IOBuffer
spinnman.processes.read_memory_process module
class spinnman.processes.read_memory_process.ReadMemoryProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

A process for reading memory on a SpiNNaker chip.

handle_response(offset, response)[source]
read_memory(x, y, p, base_address, length)[source]
spinnman.processes.read_router_diagnostics_process module
class spinnman.processes.read_router_diagnostics_process.ReadRouterDiagnosticsProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

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

get_router_diagnostics(x, y)[source]
handle_control_register_response(response)[source]
handle_error_status_response(response)[source]
handle_register_response(response)[source]
spinnman.processes.round_robin_connection_selector module
class spinnman.processes.round_robin_connection_selector.RoundRobinConnectionSelector(connections)[source]

Bases: spinnman.processes.abstract_multi_connection_process_connection_selector.AbstractMultiConnectionProcessConnectionSelector

Parameters:connections – 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 – The SCP message to be sent
Return type:int
spinnman.processes.send_single_command_process module
class spinnman.processes.send_single_command_process.SendSingleCommandProcess(connection_selector, n_retries=3, timeout=1.0)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

execute(request)[source]
handle_response(response)[source]
spinnman.processes.write_memory_flood_process module
class spinnman.processes.write_memory_flood_process.WriteMemoryFloodProcess(next_connection_selector, n_retries=10, timeout=1.0, n_channels=8, intermediate_channel_waits=7)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

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

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

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

A process for writing memory on a SpiNNaker chip.

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

Writes memory onto a SpiNNaker chip from a bytearray.

Parameters:
  • x – The x-coordinate of the chip where the memory is to be written to
  • y – The y-coordinate of the chip where the memory is to be written to
  • p – The processor of the chip where the memory is to be written to
  • processor_address – the (x, y, p) coords of the chip in question
  • base_address – the address in SDRAM to start writing
  • data (bytearray or bytes) – the data to write
  • offset – where in the data to start writing from
  • n_bytes – how much data to write
Return type:

None

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

Writes memory onto a SpiNNaker chip from a reader.

Parameters:
  • x – The x-coordinate of the chip where the memory is to be written to
  • y – The y-coordinate of the chip where the memory is to be written to
  • p – The processor of the chip where the memory is to be written to
  • base_address – the address in SDRAM to start writing
  • reader (io.RawIOBase or io.BufferedIOBase) – the readable object containing the data to write
  • n_bytes – how much data to write
Return type:

None

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

Bases: spinnman.processes.abstract_process.AbstractProcess

A process that uses multiple connections in communication.

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

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

run(app_id, core_subsets, wait)[source]
class spinnman.processes.DeAllocSDRAMProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

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

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

get_cpu_info(core_subsets)[source]
handle_response(x, y, p, response)[source]
class spinnman.processes.GetHeapProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

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]
class spinnman.processes.GetMachineProcess(connection_selector, ignore_chips, ignore_cores, ignore_links, max_core_id, max_sdram_size=None)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

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

create_machine(width, height, repair_machine, ignore_bad_ethernets)[source]
get_chip_info()[source]

Get the chip information for the machine.

Note

get_machine_details() must have been called first.

get_machine_details(boot_x, boot_y, width, height, repair_machine, ignore_bad_ethernets)[source]
class spinnman.processes.GetMultiCastRoutesProcess(connection_selector, app_id=None)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

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

get_routes(x, y, base_address)[source]
handle_read_response(offset, response)[source]
class spinnman.processes.GetTagsProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

get_tags(connection)[source]
handle_get_tag_response(tag, board_address, response)[source]
handle_tag_info_response(response)[source]
class spinnman.processes.GetVersionProcess(connection_selector, n_retries=10)[source]

Bases: spinnman.processes.abstract_single_connection_process.AbstractSingleConnectionProcess

A process for getting the version of the machine.

get_version(x, y, p)[source]
class spinnman.processes.FillDataType(value, struct_type, doc='')[source]

Bases: enum.Enum

An enumeration.

BYTE = 1
HALF_WORD = 2
WORD = 4
struct

An object that can pack and unpack 4 bytes-worth of this type.

Return type:struct.Struct
struct_type

The struct descriptor for packing and unpacking 4 bytes-worth of this type.

Return type:str
class spinnman.processes.FillProcess(next_connection_selector, n_retries=10, timeout=1.0, n_channels=8, intermediate_channel_waits=7)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

A process for filling memory.

fill_memory(x, y, base_address, data, size, data_type)[source]
class spinnman.processes.LoadFixedRouteRoutingEntryProcess(next_connection_selector, n_retries=10, timeout=1.0, n_channels=8, intermediate_channel_waits=7)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

load_fixed_route(x, y, fixed_route, app_id=0)[source]

Load a fixed route routing entry onto 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.
  • fixed_route – the fixed route entry
  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.
Return type:

None

class spinnman.processes.LoadMultiCastRoutesProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

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

handle_router_alloc_response(response)[source]
load_routes(x, y, routes, app_id)[source]
class spinnman.processes.MallocSDRAMProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

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

base_address
malloc_sdram(x, y, size, app_id, tag)[source]

Allocate space in the SDRAM space.

class spinnman.processes.MostDirectConnectionSelector(machine, connections)[source]

Bases: spinnman.processes.abstract_multi_connection_process_connection_selector.AbstractMultiConnectionProcessConnectionSelector

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

Parameters:connections – 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 – The SCP message to be sent
Return type:int
set_machine(new_machine)[source]
class spinnman.processes.ReadFixedRouteRoutingEntryProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

A process for reading a chip’s fixed route routing entry.

Creates the process for writing a fixed route entry to a chip’s router.

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

Reads a fixed route routing table 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.
Return type:

None

class spinnman.processes.ReadIOBufProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

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

read_iobuf(iobuf_size, core_subsets)[source]
Return type:iterable of IOBuffer
class spinnman.processes.ReadMemoryProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

A process for reading memory on a SpiNNaker chip.

handle_response(offset, response)[source]
read_memory(x, y, p, base_address, length)[source]
class spinnman.processes.ReadRouterDiagnosticsProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

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

get_router_diagnostics(x, y)[source]
handle_control_register_response(response)[source]
handle_error_status_response(response)[source]
handle_register_response(response)[source]
class spinnman.processes.RoundRobinConnectionSelector(connections)[source]

Bases: spinnman.processes.abstract_multi_connection_process_connection_selector.AbstractMultiConnectionProcessConnectionSelector

Parameters:connections – 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 – The SCP message to be sent
Return type:int
class spinnman.processes.SendSingleCommandProcess(connection_selector, n_retries=3, timeout=1.0)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

execute(request)[source]
handle_response(response)[source]
class spinnman.processes.WriteMemoryFloodProcess(next_connection_selector, n_retries=10, timeout=1.0, n_channels=8, intermediate_channel_waits=7)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

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

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

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

A process for writing memory on a SpiNNaker chip.

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

Writes memory onto a SpiNNaker chip from a bytearray.

Parameters:
  • x – The x-coordinate of the chip where the memory is to be written to
  • y – The y-coordinate of the chip where the memory is to be written to
  • p – The processor of the chip where the memory is to be written to
  • processor_address – the (x, y, p) coords of the chip in question
  • base_address – the address in SDRAM to start writing
  • data (bytearray or bytes) – the data to write
  • offset – where in the data to start writing from
  • n_bytes – how much data to write
Return type:

None

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

Writes memory onto a SpiNNaker chip from a reader.

Parameters:
  • x – The x-coordinate of the chip where the memory is to be written to
  • y – The y-coordinate of the chip where the memory is to be written to
  • p – The processor of the chip where the memory is to be written to
  • base_address – the address in SDRAM to start writing
  • reader (io.RawIOBase or io.BufferedIOBase) – the readable object containing the data to write
  • n_bytes – how much data to write
Return type:

None

spinnman.utilities package
Subpackages
spinnman.utilities.io package
Submodules
spinnman.utilities.io.abstract_io module
class spinnman.utilities.io.abstract_io.AbstractIO[source]

Bases: object

address

Return the current absolute address within the region

close()[source]

Close the IO object

closed

Indicates if the object has been closed

fill(repeat_value, bytes_to_fill=None, data_type=<FillDataType.WORD: 4>)[source]

Fill the next part of the region with repeated data

Parameters:
  • repeat_value (int) – The value to repeat
  • bytes_to_fill (int) – Optional number of bytes to fill from current position, or None to fill to the end
  • data_type (spinnman.process.fill_process.FillDataType) – The type of the repeat value
Raises:

EOFError – If the amount of data to fill is more than the region

flush()[source]

Flush any outstanding written data

read(n_bytes=None)[source]

Read a number of bytes, or the rest of the data if n_bytes is None or negative

Parameters:n_bytes – The number of bytes to read
Return type:bytes
Raises:EOFError – If the read will be beyond the end of the region
seek(n_bytes, from_what=0)[source]

Seek to a position within the region

tell()[source]

Return the current position within the region relative to the start

write(data)[source]

Write some data to the region

Parameters:data (bytes) – The data to write
Returns:The number of bytes written
Return type:int
Raises:EOFError – If the write will go over the end of the region
spinnman.utilities.io.file_io module
class spinnman.utilities.io.file_io.FileIO(file_obj, start_offset, end_offset)[source]

Bases: spinnman.utilities.io.abstract_io.AbstractIO

A file input/output interface to match the MemoryIO interface

Parameters:
  • file_obj (str or file) – The file handle or file name to write to
  • start_offset (int) – The start offset into the file
  • end_offset (int or None) – The end offset from the start of the file
address

Return the current absolute address within the region

close()[source]

Close the IO object

closed

Indicates if the object has been closed

fill(repeat_value, bytes_to_fill=None, data_type=<FillDataType.WORD: 4>)[source]

Fill the next part of the region with repeated data

Parameters:
  • repeat_value (int) – The value to repeat
  • bytes_to_fill (int) – Optional number of bytes to fill from current position, or None to fill to the end
  • data_type (spinnman.process.fill_process.FillDataType) – The type of the repeat value
Raises:

EOFError – If the amount of data to fill is more than the region

flush()[source]

Flush any outstanding written data

read(n_bytes=None)[source]

Read a number of bytes, or the rest of the data if n_bytes is None or negative

Parameters:n_bytes – The number of bytes to read
Return type:bytes
Raises:EOFError – If the read will be beyond the end of the region
seek(n_bytes, from_what=0)[source]

Seek to a position within the region

tell()[source]

Return the current position within the region relative to the start

write(data)[source]

Write some data to the region

Parameters:data (bytes) – The data to write
Returns:The number of bytes written
Return type:int
Raises:EOFError – If the write will go over the end of the region
spinnman.utilities.io.memory_io module
class spinnman.utilities.io.memory_io.MemoryIO(transceiver, x, y, start_address, end_address)[source]

Bases: spinnman.utilities.io.abstract_io.AbstractIO

A file-like object for reading and writing memory

Parameters:
  • transceiver – The transceiver to read and write with
  • x – The x-coordinate of the chip to write to
  • y – The y-coordinate of the chip to write to
  • start_address – The start address of the region to write to
  • end_address – The end address of the region to write to. This is the first address just outside the region
address

Return the current absolute address within the region

close()[source]

Close the IO object

closed

Indicates if the object has been closed

fill(repeat_value, bytes_to_fill=None, data_type=<FillDataType.WORD: 4>)[source]

Fill the next part of the region with repeated data

Parameters:
  • repeat_value (int) – The value to repeat
  • bytes_to_fill (int) – Optional number of bytes to fill from current position, or None to fill to the end
  • data_type (spinnman.process.fill_process.FillDataType) – The type of the repeat value
Raises:

EOFError – If the amount of data to fill is more than the region

flush()[source]

Flush any outstanding written data

read(n_bytes=None)[source]

Read a number of bytes, or the rest of the data if n_bytes is None or negative

Parameters:n_bytes – The number of bytes to read
Return type:bytes
Raises:EOFError – If the read will be beyond the end of the region
seek(n_bytes, from_what=0)[source]

Seek to a position within the region Seek to a position within the region

tell()[source]

Return the current position within the region relative to the start

write(data)[source]

Write some data to the region

Parameters:data (bytes) – The data to write
Returns:The number of bytes written
Return type:int
Raises:EOFError – If the write will go over the end of the region
Module contents
class spinnman.utilities.io.AbstractIO[source]

Bases: object

address

Return the current absolute address within the region

close()[source]

Close the IO object

closed

Indicates if the object has been closed

fill(repeat_value, bytes_to_fill=None, data_type=<FillDataType.WORD: 4>)[source]

Fill the next part of the region with repeated data

Parameters:
  • repeat_value (int) – The value to repeat
  • bytes_to_fill (int) – Optional number of bytes to fill from current position, or None to fill to the end
  • data_type (spinnman.process.fill_process.FillDataType) – The type of the repeat value
Raises:

EOFError – If the amount of data to fill is more than the region

flush()[source]

Flush any outstanding written data

read(n_bytes=None)[source]

Read a number of bytes, or the rest of the data if n_bytes is None or negative

Parameters:n_bytes – The number of bytes to read
Return type:bytes
Raises:EOFError – If the read will be beyond the end of the region
seek(n_bytes, from_what=0)[source]

Seek to a position within the region

tell()[source]

Return the current position within the region relative to the start

write(data)[source]

Write some data to the region

Parameters:data (bytes) – The data to write
Returns:The number of bytes written
Return type:int
Raises:EOFError – If the write will go over the end of the region
class spinnman.utilities.io.FileIO(file_obj, start_offset, end_offset)[source]

Bases: spinnman.utilities.io.abstract_io.AbstractIO

A file input/output interface to match the MemoryIO interface

Parameters:
  • file_obj (str or file) – The file handle or file name to write to
  • start_offset (int) – The start offset into the file
  • end_offset (int or None) – The end offset from the start of the file
address

Return the current absolute address within the region

close()[source]

Close the IO object

closed

Indicates if the object has been closed

fill(repeat_value, bytes_to_fill=None, data_type=<FillDataType.WORD: 4>)[source]

Fill the next part of the region with repeated data

Parameters:
  • repeat_value (int) – The value to repeat
  • bytes_to_fill (int) – Optional number of bytes to fill from current position, or None to fill to the end
  • data_type (spinnman.process.fill_process.FillDataType) – The type of the repeat value
Raises:

EOFError – If the amount of data to fill is more than the region

flush()[source]

Flush any outstanding written data

read(n_bytes=None)[source]

Read a number of bytes, or the rest of the data if n_bytes is None or negative

Parameters:n_bytes – The number of bytes to read
Return type:bytes
Raises:EOFError – If the read will be beyond the end of the region
seek(n_bytes, from_what=0)[source]

Seek to a position within the region

tell()[source]

Return the current position within the region relative to the start

write(data)[source]

Write some data to the region

Parameters:data (bytes) – The data to write
Returns:The number of bytes written
Return type:int
Raises:EOFError – If the write will go over the end of the region
class spinnman.utilities.io.MemoryIO(transceiver, x, y, start_address, end_address)[source]

Bases: spinnman.utilities.io.abstract_io.AbstractIO

A file-like object for reading and writing memory

Parameters:
  • transceiver – The transceiver to read and write with
  • x – The x-coordinate of the chip to write to
  • y – The y-coordinate of the chip to write to
  • start_address – The start address of the region to write to
  • end_address – The end address of the region to write to. This is the first address just outside the region
address

Return the current absolute address within the region

close()[source]

Close the IO object

closed

Indicates if the object has been closed

fill(repeat_value, bytes_to_fill=None, data_type=<FillDataType.WORD: 4>)[source]

Fill the next part of the region with repeated data

Parameters:
  • repeat_value (int) – The value to repeat
  • bytes_to_fill (int) – Optional number of bytes to fill from current position, or None to fill to the end
  • data_type (spinnman.process.fill_process.FillDataType) – The type of the repeat value
Raises:

EOFError – If the amount of data to fill is more than the region

flush()[source]

Flush any outstanding written data

read(n_bytes=None)[source]

Read a number of bytes, or the rest of the data if n_bytes is None or negative

Parameters:n_bytes – The number of bytes to read
Return type:bytes
Raises:EOFError – If the read will be beyond the end of the region
seek(n_bytes, from_what=0)[source]

Seek to a position within the region Seek to a position within the region

tell()[source]

Return the current position within the region relative to the start

write(data)[source]

Write some data to the region

Parameters:data (bytes) – The data to write
Returns:The number of bytes written
Return type:int
Raises:EOFError – If the write will go over the end of the region
Submodules
spinnman.utilities.appid_tracker module
class spinnman.utilities.appid_tracker.AppIdTracker(app_ids_in_use=None, min_app_id=17, max_app_id=254)[source]

Bases: object

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

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

Allocate a given ID.

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

Free a given ID.

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

Get a new unallocated ID

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

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

Parameters:handler ((ipaddr, float) --> bool) – A callback that decides whether to stop searching. The callback is given two arguments: the IP address found and the current time.
spinnman.utilities.reports module
spinnman.utilities.reports.generate_machine_report(report_directory, machine, connections)[source]

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

Parameters:
  • report_directory (str) – the directory to which reports are stored
  • machine (spinn_machine.Machine) – the machine python object
  • connections (iterable(spinnman.connections.abstract_classes.AbstractConnection)) – the list of connections to the machine
Return type:

None

Raises:

IOError – when a file cannot be opened for some reason

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

Get the address of the vcpu_t structure for the given core

Parameters:p (int) – The core
spinnman.utilities.utility_functions.reprogram_tag(connection, tag, strip=True)[source]

Reprogram an IP Tag to send responses to a given SCAMPConnection

Parameters:
  • connection – The connection to target the tag at
  • tag – The id of the tag to set
  • strip – True if
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 – The UDP connection down which the trigger message should be sent
  • board_address – The address of the SpiNNaker board to which the message should be sent
spinnman.utilities.utility_functions.work_out_bmp_from_machine_details(hostname, number_of_boards)[source]

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

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

The BMP connection data

Module contents

Submodules

spinnman.constants module

class spinnman.constants.EIEIO_COMMAND_IDS

Bases: enum.Enum

An enumeration.

DATABASE_CONFIRMATION = 1
EVENT_PADDING = 2
EVENT_STOP = 3
HOST_DATA_READ = 9
HOST_DATA_READ_ACK = 12
HOST_SEND_SEQUENCED_DATA = 7
SPINNAKER_REQUEST_BUFFERS = 6
SPINNAKER_REQUEST_READ_DATA = 8
START_RESUME_NOTIFICATION = 11
START_SENDING_REQUESTS = 5
STOP_PAUSE_NOTIFICATION = 10
STOP_SENDING_REQUESTS = 4
class spinnman.constants.IPTAG_TIME_OUT_WAIT_TIMES

Bases: enum.Enum

An enumeration.

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.READ_TYPES

alias of spinnman.constants.Read_types

spinnman.constants.ROUTER_REGISTER_REGISTERS

alias of spinnman.constants.Registers

spinnman.exceptions module

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

failed_core_states()[source]
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

packet
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, tb2=None)[source]

Bases: spinnman.exceptions.SpinnmanException

Encapsulates exceptions from processes which communicate with some core/chip

exception
exception spinnman.exceptions.SpinnmanGroupedProcessException(error_requests, exceptions, tracebacks)[source]

Bases: spinnman.exceptions.SpinnmanException

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

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

Bases: spinnman.exceptions.SpinnmanException

An exception that something went wrong with the underlying IO

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

The problem with IO

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

Bases: spinnman.exceptions.SpinnmanException

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

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

The packet type

problem

The problem with the packet

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

Bases: spinnman.exceptions.SpinnmanException

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

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

The parameter with an invalid value

problem

The problem with the parameter value

value

The value that is invalid

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

Bases: spinnman.exceptions.SpinnmanException

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

Parameters:
  • parameter (str) – The name of the parameter that is invalid
  • param_type (str) – The type of the parameter that is invalid
  • problem (str) – The problem with the parameter
parameter

The parameter with an invalid value

problem

The problem with the parameter value

type

The value that is invalid

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

Bases: spinnman.exceptions.SpinnmanException

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

Parameters:
  • operation (str) – The operation being performed
  • timeout (int) – The timeout value in seconds
operation

The operation that was performed

timeout

The timeout value in seconds

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

Bases: spinnman.exceptions.SpinnmanException

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

Parameters:
  • operation (str) – The operation being performed
  • command (str) – The command being executed
  • response (str) – The response received in error
command

The command being executed

operation

The operation being performed

response

The unexpected response

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

Bases: spinnman.exceptions.SpinnmanException

An exception that indicates that the given operation is not supported

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

The unsupported operation requested

spinnman.get_cores_in_run_state module

spinnman.transceiver module

class spinnman.transceiver.Transceiver(version, connections=None, ignore_chips=None, ignore_cores=None, ignore_links=None, max_core_id=None, scamp_connections=None, max_sdram_size=None, repair_machine=False, ignore_bad_ethernets=True)[source]

Bases: object

An encapsulation of various communications with the SpiNNaker board.

The methods of this class are designed to be 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 also that 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 (iterable of spinnman.connections.abstract_classes.Connection) – An iterable of connections to the board. If not specified, no communication will be possible until connections are found.
  • ignore_chips (set of (int, int)) – An optional set of chips to ignore in the machine. Requests for a “machine” will have these chips excluded, as if they never existed. The processor_ids of the specified chips are ignored.
  • ignore_cores (set of (int, int, int)) – An optional set of cores to ignore in the machine. Requests for a “machine” will have these cores excluded, as if they never existed.
  • ignore_links (set of (int, int, int)) – An optional set of links to ignore in the machine. Requests for a “machine” will have these links excluded, as if they never existed.
  • max_core_id (int) – The maximum core ID in any discovered machine. Requests for a “machine” will only have core IDs up to and including this value.
  • max_sdram_size (int or None) – the max size each chip can say it has for SDRAM (mainly used in debugging purposes)
  • scamp_connections (list of spinnman.connections.SocketAddress_With_Chip or None) – a list of SCAMP connection data or None
  • repair_machine (bool) – Flag to set the behaviour if a repairable error is found on the machine. If true will create a machine without the problamatic bits. (See machine_factory.machine_repair) If False get machine will raise an Exception if a problamatic machine is discovered.
  • ignore_bad_ethernets (bool) – Flag to say that ip_address information on none ethernet chips should be ignored. None_ethernet chips are defined here as ones that do not report themselves their nearest ethernet. The bad ipaddress is always logged If True the ipaddress is ignored If False the chip with the bad ipaddress is removed.
Raises:
app_id_tracker

Get the app ID tracker for this transceiver

Return type:spinnman.utilities.appid_tracker.AppIdTracker
bmp_connection
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 (int) – this parameter is deprecated
  • width (int or None) – this parameter is deprecated
  • height (int or None) – this parameter is deprecated
  • extra_boot_values (dict of SystemVariableDefinition to value) – extra values to set during boot
Raises:
clear_ip_tag(tag, board_address=None)[source]

Clear the setting of an IP tag

Parameters:
  • tag (int) – The tag ID
  • board_address – Board address where the tag should be cleared. If not specified, all SCPSender connections will send the message to clear the tag
Returns:

Nothing is returned

Return type:

None

Raises:
clear_multicast_routes(x, y)[source]

Remove all the multicast routes on a chip

Parameters:
  • x (int) – The x-coordinate of the chip on which to clear the routes
  • y (int) – The y-coordinate of the chip on which to clear the routes
Returns:

Nothing is returned

Return type:

None

Raises:
clear_router_diagnostic_counters(x, y, enable=True, counter_ids=None)[source]

Clear router diagnostic information on a chip

Parameters:
  • x (int) – The x-coordinate of the chip
  • y (int) – The y-coordinate of the chip
  • enable (bool) – True (default) if the counters should be enabled
  • counter_ids (array-like of int) – The IDs of the counters to reset (all by default) and enable if enable is True; each must be between 0 and 15
Return type:

None

Raises:
close(close_original_connections=True, power_off_machine=False)[source]

Close the transceiver and any threads that are running

Parameters:
  • close_original_connections – If True, the original connections passed to the transceiver in the constructor are also closed. If False, only newly discovered connections are closed.
  • power_off_machine (bool) – if true, the machine is sent a power down command via its BMP (if it has one)
Returns:

Nothing is returned

Return type:

None

Raises:

None – No known exceptions are raised

discover_scamp_connections()[source]

Find connections to the board and store these for future use. Note that connections can be empty, in which case another local discovery mechanism will be used. Note that an exception will be thrown if no initial connections can be found to the board.

Returns:

An iterable of discovered connections, not including the initially given connections in the constructor

Return type:

iterable of spinnman.connections.abstract_classes.Connection

Raises:
ensure_board_is_ready(number_of_boards=None, width=None, height=None, n_retries=5, extra_boot_values=None)[source]

Ensure that the board is ready to interact with this version of the transceiver. Boots the board if not already booted and verifies that the version of SCAMP running is compatible with this transceiver.

Parameters:
  • number_of_boards (int) – 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 of SystemVariableDefinition to value) – Any additional values to set during boot
Returns:

The version identifier

Return type:

spinnman.model.version_info.VersionInfo

Raise:

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

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 (iterable of int) – The cores on the chip on which to run the application
  • executable (spinn_storage_handlers.abstract_classes.AbstractDataReader or bytearray or str) – The data that is to be executed. Should be one of the following: * An instance of AbstractDataReader * A bytearray * 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 AbstractDataReader, 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
Returns:

Nothing is returned

Return type:

None

Raises:
execute_application(executable_targets, app_id)[source]

Execute a set of binaries that make up a complete application on specified cores, wait for them to be ready and then start all of the binaries. Note this will get the binaries into c_main but will not signal the barrier.

Parameters:
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 (spinn_machine.CoreSubsets) – Which cores on which chips to start the executable
  • executable (spinn_storage_handlers.abstract_classes.AbstractDataReader or bytearray or str) – The data that is to be executed. Should be one of the following: * An instance of AbstractDataReader * 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 AbstractDataReader, 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
Returns:

Nothing is returned

Return type:

None

Raises:
fill_memory(x, y, base_address, repeat_value, bytes_to_fill, data_type=<FillDataType.WORD: 4>)[source]

Fill some memory with repeated data

Parameters:
  • x (int) – The x-coordinate of the chip
  • y (int) – The y-coordinate of the chip
  • base_address (int) – The address at which to start the fill
  • repeat_value (int) – The data to repeat
  • bytes_to_fill (int) – The number of bytes to fill. Must be compatible with the data type i.e. if the data type is WORD, the number of bytes must be divisible by 4
  • data_type (spinnman.processes.fill_process.FillDataType) –
free_sdram(x, y, base_address, app_id)[source]

Free allocated SDRAM

Parameters:
  • x (int) – The x-coordinate of the chip onto which to ask for memory
  • y (int) – The y-coordinate of the chip onto which to ask for memory
  • base_address (int) – The base address of the allocated memory
  • app_id (int) – The app ID of the allocated memory
free_sdram_by_app_id(x, y, app_id)[source]

Free all SDRAM allocated to a given app ID

Parameters:
  • x (int) – The x-coordinate of the chip onto which to ask for memory
  • y (int) – The y-coordinate of the chip onto which to ask for memory
  • app_id (int) – The app ID of the allocated memory
Returns:

The number of blocks freed

Return type:

int

get_connections()[source]

Get the currently known connections to the board, made up of those passed in to the transceiver and those that are discovered during calls to discover_connections. No further discovery is done here.

Returns:An iterable of connections known to the transceiver
Return type:iterable of spinnman.connections.abstract_classes.Connection
Raises:None – No known exceptions are raised
get_core_state_count(app_id, state)[source]

Get a count of the number of cores which have a given state

Parameters:
  • app_id (int) – The ID of the application from which to get the count.
  • state (spinnman.model.CPUState) – The state count to get
Returns:

A count of the cores with the given status

Return type:

int

Raises:
get_core_status_string(cpu_infos)[source]

Get a string indicating the status of the given cores

Parameters:cpu_infos (spinnman.model.cpu_infos.CPUInfos) – A CPUInfos objects
get_cores_in_state(all_core_subsets, states)[source]

Get all cores that are in a given state or set of states

Parameters:
Returns:

Core subsets object containing cores in the given state(s)

get_cores_not_in_state(all_core_subsets, states)[source]

Get all cores that are not in a given state or set of states

Parameters:
Returns:

Core subsets object containing cores not in the given state(s)

get_cpu_information(core_subsets=None)[source]

Get information about the processors on the board

Parameters:

core_subsets (spinn_machine.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:

iterable of spinnman.model.CPUInfo

Raises:
get_cpu_information_from_core(x, y, p)[source]

Get information about a specific processor on the board

Parameters:
  • x (int) – The x-coordinate of the chip containing the processor
  • y (int) – The y-coordinate of the chip containing the processor
  • p (int) – The ID of the processor to get the information about
Returns:

The CPU information for the selected core

Return type:

spinnman.model.cpu_info.CPUInfo

Raises:
get_heap(x, y, heap=<SystemVariableDefinition.sdram_heap_address: _Definition(offset=76, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The base address of the user SDRAM heap')>)[source]

Get the contents of the given heap on a given chip

Parameters:
get_iobuf(core_subsets=None)[source]

Get the contents of the IOBUF buffer for a number of processors

Parameters:

core_subsets (spinn_machine.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 of spinnman.model.IOBuffer

Raises:
get_iobuf_from_core(x, y, p)[source]

Get the contents of IOBUF for a given core

Parameters:
  • x (int) – The x-coordinate of the chip containing the processor
  • y (int) – The y-coordinate of the chip containing the processor
  • p (int) – The ID of the processor to get the IOBUF for
Returns:

An IOBUF buffer

Return type:

spinnman.model.IOBuffer

Raises:
get_machine_details()[source]

Get the details of the machine made up of chips on a board and how they are connected to each other.

Returns:

A machine description

Return type:

spinn_machine.Machine

Raises:
get_machine_dimensions()[source]

Get the maximum chip x-coordinate and maximum chip y-coordinate of the chips in the machine

Returns:

The dimensions of the machine

Return type:

spinnman.model.machine_dimensions.MachineDimensions

Raises:
get_multicast_routes(x, y, app_id=None)[source]

Get the current multicast routes set up on a chip

Parameters:
  • x (int) – The x-coordinate of the chip from which to get the routes
  • y (int) – The y-coordinate of the chip from which to get the routes
  • app_id (int) – The ID of the application to filter the routes for. If not specified, will return all routes
Returns:

An iterable of multicast routes

Return type:

iterable of spinnman.model.multicast_routing_entry.MulticastRoute

Raises:
get_router_diagnostic_filter(x, y, position)[source]

Gets a router diagnostic filter from a router

Parameters:
  • x (int) – the X address of the router from which this filter is being retrieved
  • y (int) – the Y address of the router from which this filter is being retrieved
  • position (int) – the position in the list of filters where this filter is to be added
Returns:

The diagnostic filter read

Return type:

spinnman.model.diagnostic_filter.DiagnosticFilter

Raises:
get_router_diagnostics(x, y)[source]

Get router diagnostic information from a chip

Parameters:
  • x (int) – The x-coordinate of the chip from which to get the information
  • y (int) – The y-coordinate of the chip from which to get the information
Returns:

The router diagnostic information

Return type:

spinnman.model.router_diagnostics.RouterDiagnostics

Raises:
get_scamp_version(chip_x=255, chip_y=255, connection_selector=None, n_retries=10)[source]

Get the version of SCAMP which is running on the board.

Parameters:
  • connection_selector (AbstractMultiConnectionProcessConnectionSelector) – the connection to send the SCAMP version or none (if none then a random SCAMP connection is used).
  • 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
Returns:

The version identifier

Return type:

VersionInfo

Raises:
get_tags(connection=None)[source]

Get the current set of tags that have been set on the board

Parameters:

connection (spinnman.connections.abstract_classes.SCPSender) – Connection from which the tags should be received. If not specified, all SCPSender connections will be queried and the response will be combined.

Returns:

An iterable of tags

Return type:

iterable of spinn_machine.tags.AbstractTag

Raises:
static get_user_0_register_address_from_core(p)[source]

Get the address of user 0 for a given processor on the board

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 (spinnman.connections.abstract_classes.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
Raises:None – No known exceptions are raised
static is_scamp_version_compabible(version)[source]

Determine if the version of SCAMP is compatible with this transceiver

Parameters:version ((int, int, int)) – The version to test
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 (spinn_machine.fixed_route_routing_entry) – 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.
Returns:

Nothing is returned

Return type:

None

Raises:
load_multicast_routes(x, y, routes, app_id)[source]

Load a set of multicast routes on to a chip

Parameters:
  • x (int) – The x-coordinate of the chip onto which to load the routes
  • y (int) – The y-coordinate of the chip onto which to load the routes
  • routes (iterable of spinn_machine.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.
Returns:

Nothing is returned

Return type:

None

Raises:
locate_spinnaker_connection_for_board_address(board_address)[source]

Find a connection that matches the given board IP address

Parameters:board_address (str) – The IP address of the Ethernet connection on the board
Returns:A connection for the given IP address, or None if no such connection exists
Return type:spinnman.connections.udp_packet_connections.SCAMPConnection
malloc_sdram(x, y, size, app_id, tag=None)[source]

Allocates a chunk of SDRAM on a chip on the machine

Parameters:
  • x (int) – The x-coordinate of the chip onto which to ask for memory
  • y (int) – The y-coordinate of the chip onto which to ask for memory
  • size (int) – the amount of memory to allocate in bytes
  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.
  • tag (int) – the tag for the SDRAM, a 8-bit (chip-wide) tag that can be looked up by a SpiNNaker application to discover the address of the allocated block. If 0 then no tag is applied.
Returns:

the base address of the allocated memory

Return type:

int

number_of_boards_located

Get the number of boards currently configured

power_off(boards=0, cabinet=0, frame=0)[source]

Power off a set of boards in the machine

Parameters:
  • boards – The board or boards to power off
  • cabinet – the ID of the cabinet containing the frame, or 0 if the frame is not in a cabinet
  • frame – the ID of the frame in the cabinet containing the board(s), or 0 if the board is not in a frame
power_off_machine()[source]

Power off the whole machine

power_on(boards=0, cabinet=0, frame=0)[source]

Power on a set of boards in the machine

Parameters:
  • boards – The board or boards to power on
  • cabinet – the ID of the cabinet containing the frame, or 0 if the frame is not in a cabinet
  • frame – the ID of the frame in the cabinet containing the board(s), or 0 if the board is not in a frame
power_on_machine()[source]

Power on the whole machine

read_adc_data(board, cabinet, frame)[source]

Read the BMP ADC data

Parameters:
  • cabinet (int) – cabinet: the cabinet this is targeting
  • frame (int) – the frame this is targeting
  • board – which board to request the ADC data from
Returns:

the FPGA’s ADC data object

read_bmp_version(board, cabinet, frame)[source]

Read the BMP version

Parameters:
  • cabinet (int) – cabinet: the cabinet this is targeting
  • frame (int) – the frame this is targeting
  • board – which board to request the data from
Returns:

the sver from the BMP

read_fixed_route(x, y, app_id)[source]

Reads a fixed route routing table entry from a chip’s router.

Parameters:
  • x (int) – The x-coordinate of the chip onto which to load the routes
  • y (int) – The y-coordinate of the chip onto which to load the routes
  • app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.
Returns:

the route as a fixed route entry

read_fpga_register(fpga_num, register, cabinet, frame, board)[source]

Read a register on a FPGA of a board. The meaning of the register’s contents will depend on the FPGA’s configuration.

Parameters:
  • fpga_num (int) – FPGA number (0, 1 or 2) to communicate with.
  • register (int) – Register address to read to (will be rounded down to the nearest 32-bit word boundary).
  • cabinet (int) – cabinet: the cabinet this is targeting
  • frame (int) – the frame this is targeting
  • board – which board to request the FPGA register from
Returns:

the register data

read_memory(x, y, base_address, length, cpu=0)[source]

Read some areas of 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
Returns:

A bytearray of data read

Return type:

bytearray

Raises:
read_neighbour_memory(x, y, link, base_address, length, cpu=0)[source]
Read some areas of memory on a neighbouring chip using a LINK_READ
SCP command. If sent to a BMP, this command can be used to communicate with the FPGAs’ debug registers.
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:

iterable of bytearray

Raises:
read_user_0(x, y, p)[source]
register_udp_listener(callback, connection_class, local_port=None, local_host=None)[source]
Register a callback for a certain type of traffic to be received via UDP. Note that the connection class must extend spinnman.connections.abstract_classes.Listenable
to avoid clashing with the SCAMP and BMP functionality
Parameters:
  • callback (function(packet)) – Function to be called when a packet is received
  • connection_class (subclass of spinnman.connections.abstract_classes.Listenable) – The class of connection to receive using
  • local_port (int) – The optional port number to listen on; if not specified, an existing connection will be used if possible, otherwise a random free port number will be used
  • local_host (str) – The optional hostname or IP address to listen on; if not specified, all interfaces will be used for listening
Returns:

The connection to be used

Return type:

spinnman.connection.udp_packet_connections.UDPConnection

scamp_connection_selector
send_multicast_message(x, y, multicast_message, connection=None)[source]

Sends a multicast message to the board (currently unsupported)

Parameters:
Returns:

Nothing is returned

Return type:

None

Raises:
send_scp_message(message, connection=None)[source]

Sends an SCP message, without expecting a response

Parameters:
Returns:

The received response, or the callback if get_callback is True

Return type:

spinnman.messages.scp.abstract_messages.AbstractSCPResponse

Raises:
send_sdp_message(message, connection=None)[source]

Sends an SDP message using one of the connections.

Parameters:
Return type:

None

send_signal(app_id, signal)[source]

Send a signal to an application

Parameters:
  • app_id (int) – The ID of the application to send to
  • signal (spinnman.messages.scp.Signal) – The signal to send
Returns:

Nothing is returned

Return type:

None

Raises:
set_ip_tag(ip_tag, use_sender=False)[source]

Set up an IP tag

Parameters:
  • ip_tag (spinn_machine.tags.IPTag) – The tag to set up; note board_address can be None, in which case, the tag will be assigned to all boards
  • use_sender – Optionally use the sender host and port instead of the given host and port in the tag
  • use_sender – bool
Returns:

Nothing is returned

Return type:

None

Raises:
set_led(led, action, board, cabinet, frame)[source]

Set the LED state of a board in the machine

Parameters:
  • led (int or iterable of int) – Number of the LED or an iterable of LEDs to set the state of (0-7)
  • action (spinnman.messages.scp.scp_led_action.SCPLEDAction) – State to set the LED to, either on, off or toggle
  • board (int or iterable) – 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
Return type:

None

set_leds(x, y, cpu, led_states)[source]

Set SetLED states.

Parameters:
  • x (int) – The x-coordinate of the chip on which to set the LEDs
  • y (int) – The x-coordinate of the chip on which to set the LEDs
  • cpu (int) – The CPU of the chip on which to set the LEDs
  • led_states (dict) – A dictionary mapping SetLED index to state with 0 being off, 1 on and 2 inverted.
Returns:

Nothing is returned

Return type:

None

Raises:
set_reverse_ip_tag(reverse_ip_tag)[source]

Set up a reverse IP tag

Parameters:

reverse_ip_tag (spinn_machine.tags.ReverseIPTag) – The reverse tag to set up; note board_address can be None, in which case, the tag will be assigned to all boards

Returns:

Nothing is returned

Return type:

None

Raises:
set_router_diagnostic_filter(x, y, position, diagnostic_filter)[source]

Sets a router diagnostic filter in a router

Parameters:
  • x (int) – the X address of the router in which this filter is being set
  • y (int) – the Y address of the router in which this filter is being set
  • position (int) – the position in the list of filters where this filter is to be added
  • diagnostic_filter (spinnman.model.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).
Return type:

None

Raises:
set_watch_dog(watch_dog)[source]

Enable, disable or set the value of the watch dog timer

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.
Return type:None
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

Parameters:
  • x (int) – chip x coord to write new watchdog param to
  • y (int) – chip y coord to write new watchdog param to
  • watch_dog (bool or int) – Either a boolean indicating whether to enable (True) or disable (False) the watchdog timer, or an int value to set the timer count to
Return type:

None

stop_application(app_id)[source]

Sends a stop request for an app_id

Parameters:

app_id (int) – The ID of the application to send to

Raises:
wait_for_cores_to_be_in_state(all_core_subsets, app_id, cpu_states, timeout=None, time_between_polls=0.1, error_states=frozenset({<CPUState.WATCHDOG: 3>, <CPUState.RUN_TIME_EXCEPTION: 2>}), counts_between_full_check=100)[source]

Waits for the specified cores running the given application to be in some target state or states. Handles failures.

Parameters:
  • all_core_subsets – the cores to check are in a given sync state
  • app_id – the application ID that being used by the simulation
  • cpu_states – The expected states once the applications are ready; success is when each application is in one of these states
  • timeout – The amount of time to wait in seconds for the cores to reach one of the states
  • time_between_polls – Time between checking the state
  • error_states – Set of states that the application can be in that indicate an error, and so should raise an exception
  • counts_between_full_check – The number of times to use the count signal before instead using the full CPU state check
Raises:

spinnman.exceptions.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 – which board to write the FPGA register to
Return type:

None

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

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 (spinn_storage_handlers.abstract_classes.AbstractDataReader or bytearray or int or str) – The data to write. Should be one of the following: * An instance of AbstractDataReader * A bytearray * 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 AbstractDataReader, 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 the data is a filename
Returns:

Nothing is returned

Return type:

None

Raises:
write_memory_flood(base_address, data, n_bytes=None, offset=0, is_filename=False)[source]

Write to the SDRAM of all chips.

Parameters:
  • base_address (int) – The address in SDRAM where the region of memory is to be written
  • data (spinn_storage_handlers.abstract_classes.AbstractDataReader or bytearray or int or str) – The data that is to be written. Should be one of the following: * An instance of AbstractDataReader * 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 AbstractDataReader, 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 the data is a int, then the offset will be ignored and 0 is used.
  • is_filename (bool) – True if the data should be interpreted as a file name
Returns:

Nothing is returned

Return type:

None

Raises:
write_neighbour_memory(x, y, link, base_address, data, n_bytes=None, offset=0, cpu=0)[source]

Write to the memory of a neighbouring chip using a LINK_READ SCP command. If sent to a BMP, this command can be used to communicate with the FPGAs’ debug registers.

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 (spinn_storage_handlers.abstract_classes.AbstractDataReader or bytearray or int) – The data to write. Should be one of the following: * An instance of AbstractDataReader * A bytearray * 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 AbstractDataReader, 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 the 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)
Returns:

Nothing is returned

Return type:

None

Raises:
spinnman.transceiver.create_transceiver_from_hostname(hostname, version, bmp_connection_data=None, number_of_boards=None, ignore_chips=None, ignore_cores=None, ignored_links=None, max_core_id=None, auto_detect_bmp=False, scamp_connections=None, boot_port_no=None, max_sdram_size=None, repair_machine=False, ignore_bad_ethernets=True)[source]

Create a Transceiver by creating a UDPConnection to the given hostname on port 17893 (the default SCAMP port), and a BootConnection on port 54321 (the default boot port), optionally discovering any additional links using the UDPConnection, and then returning the transceiver created with the conjunction of the created UDPConnection and the discovered connections.

Parameters:
  • hostname (str) – The hostname or IP address of the board
  • number_of_boards (int or None) – a number of boards expected to be supported, or None, which defaults to a single board
  • ignore_chips (set of (int, int)) – An optional set of chips to ignore in the machine. Requests for a “machine” will have these chips excluded, as if they never existed. The processor_ids of the specified chips are ignored.
  • ignore_cores (set of (int, int, int)) – An optional set of cores to ignore in the machine. Requests for a “machine” will have these cores excluded, as if they never existed.
  • ignored_links (set of (int, int, int)) – An optional set of links to ignore in the machine. Requests for a “machine” will have these links excluded, as if they never existed.
  • max_core_id (int) – The maximum core ID in any discovered machine. Requests for a “machine” will only have core IDs up to this value.
  • version – 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 (iterable of spinnman.model.bmp_connection_data.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
  • boot_port_no (int) – the port number used to boot the machine
  • scamp_connections (iterable of UDPScampConnections) – the list of connections used for SCAMP communications
  • max_sdram_size (int or None) – the max size each chip can say it has for SDRAM (mainly used in debugging purposes)
  • repair_machine (bool) – Flag to set the behaviour if a repairable error is found on the machine. If true will create a machine without the problamatic bits. (See machine_factory.machine_repair) If False get machine will raise an Exception if a problamatic machine is discovered.
  • ignore_bad_ethernets (bool) – Flag to say that ip_address information on none ethernet chips should be ignored. None_ethernet chips are defined here as ones that do not report themselves their nearest ethernet. The bad ipaddress is always logged If True the ipaddress is ignored If False the chip with the bad ipaddress is removed.
Returns:

The created transceiver

Return type:

spinnman.transceiver.Transceiver

Raises:

Module contents

Used to communicate with a SpiNNaker Board. The main part of this package is the spinnman.transceiver.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 the 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
  • boot_board() and get_scamp_version() are used to ensure that the board is booted correctly before starting a simulation.
  • get_machine_details() is used to get a representation of the current state of the machine, which is used to decide where executables are to be run on the board for a particular simulation, where any external peripherals are connected, and how messages between the executables and/or the external peripherals are to be routed
  • write_memory() and execute() are used to write parameters and execute executables on the board
  • send_signal() is used to send a signal which starts, stops or pauses a simulation.
  • get_core_status_count() is used to determine if a simulation is complete or has gone into an error state.
  • get_iobuf(), get_cpu_information() and get_router_diagnostics() are used to diagnose a problem with a simulation
  • read_memory() is used to read some statistics recorded in SDRAM after a simulation

Indices and tables