spinnman package¶
Subpackages¶
- spinnman.connections package
- Subpackages
- spinnman.connections.abstract_classes package
- Submodules
- spinnman.connections.abstract_classes.connection module
- spinnman.connections.abstract_classes.eieio_receiver module
- spinnman.connections.abstract_classes.eieio_sender module
- spinnman.connections.abstract_classes.listenable module
- spinnman.connections.abstract_classes.multicast_receiver module
- spinnman.connections.abstract_classes.multicast_sender module
- spinnman.connections.abstract_classes.scp_receiver module
- spinnman.connections.abstract_classes.scp_sender module
- spinnman.connections.abstract_classes.sdp_receiver module
- spinnman.connections.abstract_classes.sdp_sender module
- spinnman.connections.abstract_classes.spinnaker_boot_receiver module
- spinnman.connections.abstract_classes.spinnaker_boot_sender module
- Module contents
- spinnman.connections.udp_packet_connections package
- Submodules
- spinnman.connections.udp_packet_connections.bmp_connection module
- spinnman.connections.udp_packet_connections.boot_connection module
- spinnman.connections.udp_packet_connections.eieio_connection module
- spinnman.connections.udp_packet_connections.ip_address_connection module
- spinnman.connections.udp_packet_connections.scamp_connection module
- spinnman.connections.udp_packet_connections.sdp_connection module
- spinnman.connections.udp_packet_connections.udp_connection module
- spinnman.connections.udp_packet_connections.udp_listenable_connection module
- spinnman.connections.udp_packet_connections.utils module
- Module contents
- spinnman.connections.abstract_classes package
- Submodules
- spinnman.connections.connection_listener module
- spinnman.connections.scp_request_pipeline module
- spinnman.connections.socket_address_with_chip module
- spinnman.connections.token_bucket module
- Module contents
- Subpackages
- spinnman.messages package
- Subpackages
- spinnman.messages.eieio package
- Subpackages
- spinnman.messages.eieio.command_messages package
- Submodules
- spinnman.messages.eieio.command_messages.database_confirmation module
- spinnman.messages.eieio.command_messages.eieio_command_header module
- spinnman.messages.eieio.command_messages.eieio_command_message module
- spinnman.messages.eieio.command_messages.event_stop_request module
- spinnman.messages.eieio.command_messages.host_data_read module
- spinnman.messages.eieio.command_messages.host_data_read_ack module
- spinnman.messages.eieio.command_messages.host_send_sequenced_data module
- spinnman.messages.eieio.command_messages.notification_protocol_pause_stop module
- spinnman.messages.eieio.command_messages.notification_protocol_start_resume module
- spinnman.messages.eieio.command_messages.padding_request module
- spinnman.messages.eieio.command_messages.spinnaker_request_buffers module
- spinnman.messages.eieio.command_messages.spinnaker_request_read_data module
- spinnman.messages.eieio.command_messages.start_requests module
- spinnman.messages.eieio.command_messages.stop_requests module
- Module contents
- spinnman.messages.eieio.data_messages package
- Submodules
- spinnman.messages.eieio.data_messages.abstract_data_element module
- spinnman.messages.eieio.data_messages.eieio_data_header module
- spinnman.messages.eieio.data_messages.eieio_data_message module
- spinnman.messages.eieio.data_messages.key_data_element module
- spinnman.messages.eieio.data_messages.key_payload_data_element module
- Module contents
- spinnman.messages.eieio.command_messages package
- Submodules
- spinnman.messages.eieio.create_eieio_command module
- spinnman.messages.eieio.create_eieio_data module
- spinnman.messages.eieio.eieio_message module
- spinnman.messages.eieio.eieio_prefix module
- spinnman.messages.eieio.eieio_type module
- Module contents
- Subpackages
- spinnman.messages.scp package
- Subpackages
- spinnman.messages.scp.abstract_messages package
- spinnman.messages.scp.enums package
- Submodules
- spinnman.messages.scp.enums.alloc_free module
- spinnman.messages.scp.enums.bmp_info module
- spinnman.messages.scp.enums.iptag_command module
- spinnman.messages.scp.enums.led_action module
- spinnman.messages.scp.enums.power_command module
- spinnman.messages.scp.enums.scp_command module
- spinnman.messages.scp.enums.scp_result module
- spinnman.messages.scp.enums.signal module
- Module contents
- spinnman.messages.scp.impl package
- Submodules
- spinnman.messages.scp.impl.app_stop module
- spinnman.messages.scp.impl.application_run module
- spinnman.messages.scp.impl.bmp_get_version module
- spinnman.messages.scp.impl.bmp_set_led module
- spinnman.messages.scp.impl.check_ok_response module
- spinnman.messages.scp.impl.count_state module
- spinnman.messages.scp.impl.count_state_response module
- spinnman.messages.scp.impl.fill_request module
- spinnman.messages.scp.impl.fixed_route_init module
- spinnman.messages.scp.impl.fixed_route_read module
- spinnman.messages.scp.impl.flood_fill_data module
- spinnman.messages.scp.impl.flood_fill_end module
- spinnman.messages.scp.impl.flood_fill_start module
- spinnman.messages.scp.impl.get_chip_info module
- spinnman.messages.scp.impl.get_chip_info_response module
- spinnman.messages.scp.impl.get_version module
- spinnman.messages.scp.impl.get_version_response module
- spinnman.messages.scp.impl.iptag_clear module
- spinnman.messages.scp.impl.iptag_get module
- spinnman.messages.scp.impl.iptag_get_info module
- spinnman.messages.scp.impl.iptag_get_info_response module
- spinnman.messages.scp.impl.iptag_set module
- spinnman.messages.scp.impl.iptag_set_tto module
- spinnman.messages.scp.impl.read_adc module
- spinnman.messages.scp.impl.read_fpga_register module
- spinnman.messages.scp.impl.read_link module
- spinnman.messages.scp.impl.read_memory module
- spinnman.messages.scp.impl.reverse_iptag_set module
- spinnman.messages.scp.impl.router_alloc module
- spinnman.messages.scp.impl.router_clear module
- spinnman.messages.scp.impl.router_init module
- spinnman.messages.scp.impl.sdram_alloc module
- spinnman.messages.scp.impl.sdram_de_alloc module
- spinnman.messages.scp.impl.send_signal module
- spinnman.messages.scp.impl.set_led module
- spinnman.messages.scp.impl.set_power module
- spinnman.messages.scp.impl.write_fpga_register module
- spinnman.messages.scp.impl.write_link module
- spinnman.messages.scp.impl.write_memory module
- Module contents
- Submodules
- spinnman.messages.scp.scp_request_header module
- spinnman.messages.scp.scp_response_header module
- Module contents
- Subpackages
- spinnman.messages.sdp package
- spinnman.messages.spinnaker_boot package
- spinnman.messages.eieio package
- Submodules
- spinnman.messages.multicast_message module
- Module contents
- Subpackages
- spinnman.model package
- Subpackages
- spinnman.model.enums package
- Submodules
- spinnman.model.enums.cpu_state module
- spinnman.model.enums.diagnostic_filter_default_routing_status module
- spinnman.model.enums.diagnostic_filter_destination module
- spinnman.model.enums.diagnostic_filter_emergency_routing_status module
- spinnman.model.enums.diagnostic_filter_packet_type module
- spinnman.model.enums.diagnostic_filter_payload_status module
- spinnman.model.enums.diagnostic_filter_source module
- spinnman.model.enums.mailbox_command module
- spinnman.model.enums.p2p_table_route module
- spinnman.model.enums.run_time_error module
- Module contents
- spinnman.model.enums package
- Submodules
- spinnman.model.adc_info module
- spinnman.model.bmp_connection_data module
- spinnman.model.chip_info module
- spinnman.model.chip_summary_info module
- spinnman.model.cpu_info module
- spinnman.model.cpu_infos module
- spinnman.model.diagnostic_filter module
- spinnman.model.executable_targets module
- spinnman.model.heap_element module
- spinnman.model.io_buffer module
- spinnman.model.machine_dimensions module
- spinnman.model.p2p_table module
- spinnman.model.router_diagnostics module
- spinnman.model.version_info module
- Module contents
- Subpackages
- spinnman.processes package
- Submodules
- spinnman.processes.abstract_multi_connection_process module
- spinnman.processes.abstract_multi_connection_process_connection_selector module
- spinnman.processes.abstract_process module
- spinnman.processes.abstract_single_connection_process module
- spinnman.processes.application_run_process module
- spinnman.processes.de_alloc_sdram_process module
- spinnman.processes.fill_process module
- spinnman.processes.get_cpu_info_process module
- spinnman.processes.get_heap_process module
- spinnman.processes.get_machine_process module
- spinnman.processes.get_routes_process module
- spinnman.processes.get_tags_process module
- spinnman.processes.get_version_process module
- spinnman.processes.load_fixed_route_routing_entry_process module
- spinnman.processes.load_routes_process module
- spinnman.processes.malloc_sdram_process module
- spinnman.processes.most_direct_connection_selector module
- spinnman.processes.read_fixed_route_routing_entry_process module
- spinnman.processes.read_iobuf_process module
- spinnman.processes.read_memory_process module
- spinnman.processes.read_router_diagnostics_process module
- spinnman.processes.round_robin_connection_selector module
- spinnman.processes.send_single_command_process module
- spinnman.processes.write_memory_flood_process module
- spinnman.processes.write_memory_process module
- Module contents
- spinnman.utilities package
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
-
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: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board, or if no connections to the board can be found (if connections is None)
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: - spinnman.exceptions.SpinnmanInvalidParameterException – If the board version is not known
- spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
-
clear_ip_tag
(tag, board_address=None)[source]¶ Clear the setting of an IP tag
Parameters: - 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: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If the tag is not a valid tag
- If the connection cannot send SDP messages
- If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
clear_multicast_routes
(x, y)[source]¶ Remove all the multicast routes on a chip
Parameters: - 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: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
clear_router_diagnostic_counters
(x, y, enable=True, counter_ids=None)[source]¶ Clear router diagnostic information on a chip
Parameters: - 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: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException – If a packet is received that has invalid parameters or a counter ID is out of range
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
ensure_board_is_ready
(number_of_boards=None, width=None, height=None, n_retries=5, extra_boot_values=None)[source]¶ Ensure that the board is ready to interact with this version of the transceiver. Boots the board if not already booted and verifies that the version of SCAMP running is compatible with this transceiver.
Parameters: - number_of_boards (int) – 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: 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: - spinnman.exceptions.SpinnmanIOException –
- If there is an error communicating with the board
- If there is an error reading the executable
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If x, y, p does not lead to a valid core
- If app_id is an invalid application ID
- If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
execute_application
(executable_targets, app_id)[source]¶ Execute a set of binaries that make up a complete application on specified cores, wait for them to be ready and then start all of the binaries. Note this will get the binaries into c_main but will not signal the barrier.
Parameters: - executable_targets (
spinnman.model.executable_targets.ExecutableTargets
) – The binaries to be executed and the cores to execute them on - app_id (int) – The app_id to give this application
- executable_targets (
-
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: - spinnman.exceptions.SpinnmanIOException –
- If there is an error communicating with the board
- If there is an error reading the executable
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If one of the specified cores is not valid
- If app_id is an invalid application ID
- If a packet is received that has invalid parameters
- If data is an AbstractDataReader but n_bytes is not specified
- If data is an int and n_bytes is more than 4
- If n_bytes is less than 0
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
- core_subsets (
-
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: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If state is not a valid status
- If app_id is not a valid application ID
- If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
get_core_status_string
(cpu_infos)[source]¶ Get a string indicating the status of the given cores
Parameters: cpu_infos ( 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: - all_core_subsets (
spinn_machine.CoreSubsets
) – The cores to filter - states (
spinnman.model.enums.CPUState
or set(spinnman.model.enums.CPUState
)) – The state or states to filter on
Returns: Core subsets object containing cores in the given state(s)
- all_core_subsets (
-
get_cores_not_in_state
(all_core_subsets, states)[source]¶ Get all cores that are not in a given state or set of states
Parameters: - all_core_subsets (
spinn_machine.CoreSubsets
) – The cores to filter - states (
spinnman.model.enums.CPUState
or set(spinnman.model.enums.CPUState
)) – The state or states to filter on
Returns: Core subsets object containing cores not in the given state(s)
- all_core_subsets (
-
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: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If chip_and_cores contains invalid items
- If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
get_cpu_information_from_core
(x, y, p)[source]¶ Get information about a specific processor on the board
Parameters: - 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: Raises: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If x, y, p is not a valid processor
- If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
get_heap
(x, y, heap=<SystemVariableDefinition.sdram_heap_address: _Definition(offset=76, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The base address of the user SDRAM heap')>)[source]¶ Get the contents of the given heap on a given chip
Parameters: - x (int) – The x-coordinate of the chip
- y (int) – The y-coordinate of the chip
- heap (
spinnman.messages.spinnaker_boot.SystemVariableDefinition
) – The SystemVariableDefinition which is the heap to read
-
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: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If chip_and_cores contains invalid items
- If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
get_iobuf_from_core
(x, y, p)[source]¶ Get the contents of IOBUF for a given core
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: Raises: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If chip_and_cores contains invalid items
- If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
get_machine_details
()[source]¶ Get the details of the machine made up of chips on a board and how they are connected to each other.
Returns: A machine description
Return type: Raises: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
get_machine_dimensions
()[source]¶ Get the maximum chip x-coordinate and maximum chip y-coordinate of the chips in the machine
Returns: The dimensions of the machine
Return type: Raises: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
get_multicast_routes
(x, y, app_id=None)[source]¶ Get the current multicast routes set up on a chip
Parameters: - 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: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
get_router_diagnostic_filter
(x, y, position)[source]¶ Gets a router diagnostic filter from a router
Parameters: - 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: Raises: - spinnman.exceptions.SpinnmanIOException –
- If there is an error communicating with the board
- If there is an error reading the data
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If x, y does not lead to a valid chip
- If a packet is received that has invalid parameters
- If position is less than 0 or more than 15
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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: Raises: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
get_scamp_version
(chip_x=255, chip_y=255, connection_selector=None, n_retries=10)[source]¶ Get the version of SCAMP which is running on the board.
Parameters: - 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: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidParameterException – If the timeout is less than 1
- spinnman.exceptions.SpinnmanTimeoutException – If none of the retries resulted in a response before the timeout (suggesting that the board is not booted).
- connection_selector (
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: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If the connection cannot send SDP messages
- If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
static
get_user_0_register_address_from_core
(p)[source]¶ Get the address of user 0 for a given processor on the board
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: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If any of the routes are invalid
- If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
load_multicast_routes
(x, y, routes, app_id)[source]¶ Load a set of multicast routes on to a chip
Parameters: - x (int) – The x-coordinate of the chip onto which to load the routes
- y (int) – The y-coordinate of the chip onto which to load the routes
- routes (iterable 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: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If any of the routes are invalid
- If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
locate_spinnaker_connection_for_board_address
(board_address)[source]¶ Find a connection that matches the given board IP address
Parameters: board_address (str) – The IP address of the Ethernet connection on the board Returns: A connection for the given IP address, or None if no such connection exists Return type: 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_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
-
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: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If one of x, y, p, base_address or length is invalid
- If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
read_neighbour_memory
(x, y, link, base_address, length, cpu=0)[source]¶ - Read some areas of memory on a neighbouring chip using a LINK_READ
- SCP command. If sent to a BMP, this command can be used to communicate with the FPGAs’ debug registers.
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: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If one of x, y, p, base_address or length is invalid
- If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
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
- Register a callback for a certain type of traffic to be received via UDP. Note that the connection class must extend
-
scamp_connection_selector
¶
-
send_multicast_message
(x, y, multicast_message, connection=None)[source]¶ Sends a multicast message to the board (currently unsupported)
Parameters: - x (int) – The x-coordinate of the chip where the message should first arrive on the board
- y (int) – The y-coordinate of the chip where the message should first arrive on the board
- multicast_message (
spinnman.messages.multicast_message.MulticastMessage
) – A multicast message to send - connection (
spinnman.connections.abstract_classes.MulticastSender
) – A specific connection over which to send the message. If not specified, an appropriate connection is chosen automatically.
Returns: Nothing is returned
Return type: None
Raises: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanUnsupportedOperationException –
- If there is no connection that supports sending over multicast (or the given connection does not)
- If there is no connection that can make the packet arrive at the selected chip (ignoring routing tables)
-
send_scp_message
(message, connection=None)[source]¶ Sends an SCP message, without expecting a response
Parameters: - message (
spinnman.messages.scp.abstract_messages.AbstractSCPRequest
) – The message to send - connection (
spinnman.connections.abstract_classes.Connection
) – The connection to use (omit to pick a random one)
Returns: The received response, or the callback if get_callback is True
Return type: Raises: - spinnman.exceptions.SpinnmanTimeoutException – If there is a timeout before a message is received
- spinnman.exceptions.SpinnmanInvalidParameterException – If one of the fields of the received message is invalid
- spinnman.exceptions.SpinnmanInvalidPacketException –
- If the message is not a recognised packet type
- If a packet is received that is not a valid response
- spinnman.exceptions.SpinnmanUnsupportedOperationException – If no connection can send the type of message given
- spinnman.exceptions.SpinnmanIOException – If there is an error sending the message or receiving the response
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If the response is not one of the expected codes
- message (
-
send_sdp_message
(message, connection=None)[source]¶ Sends an SDP message using one of the connections.
Parameters: - message (
spinnman.messages.sdp.SDPMessage
) – The message to send - connection (
spinnman.connections.abstract_classes.Connection
) – An optional connection to use
Return type: None
- message (
-
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: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If signal is not a valid signal
- If app_id is not a valid application ID
- If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
set_ip_tag
(ip_tag, use_sender=False)[source]¶ Set up an IP tag
Parameters: - 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: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If the IP tag fields are incorrect
- If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
- ip_tag (
-
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: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
set_reverse_ip_tag
(reverse_ip_tag)[source]¶ Set up a reverse IP tag
Parameters: reverse_ip_tag (
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 boardsReturns: Nothing is returned
Return type: None
Raises: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If the reverse IP tag fields are incorrect
- If a packet is received that has invalid parameters
- If the UDP port is one that is already used by SpiNNaker for system functions
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
set_router_diagnostic_filter
(x, y, position, diagnostic_filter)[source]¶ Sets a router diagnostic filter in a router
Parameters: - x (int) – the X address of the router in which this filter is being set
- y (int) – the Y address of the router in which this filter is being set
- position (int) – the position in the list of filters where this filter is to be added
- diagnostic_filter (
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: - spinnman.exceptions.SpinnmanIOException –
- If there is an error communicating with the board
- If there is an error reading the data
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If x, y does not lead to a valid chip
- If position is less than 0 or more than 15
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
set_watch_dog
(watch_dog)[source]¶ Enable, disable or set the value of the watch dog timer
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: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If app_id is not a valid application ID
- If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
wait_for_cores_to_be_in_state
(all_core_subsets, app_id, cpu_states, timeout=None, time_between_polls=0.1, error_states=frozenset({<CPUState.RUN_TIME_EXCEPTION: 2>, <CPUState.WATCHDOG: 3>}), 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: - spinnman.exceptions.SpinnmanIOException –
- If there is an error communicating with the board
- If there is an error reading the data
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If x, y does not lead to a valid chip
- If a packet is received that has invalid parameters
- If base_address is not a positive integer
- If data is an AbstractDataReader but n_bytes is not specified
- If data is an int and n_bytes is more than 4
- If n_bytes is less than 0
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
write_memory_flood
(base_address, data, n_bytes=None, offset=0, is_filename=False)[source]¶ Write to the SDRAM of all chips.
Parameters: - base_address (int) – The address in SDRAM where the region of memory is to be written
- data (
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: - spinnman.exceptions.SpinnmanIOException –
- If there is an error communicating with the board
- If there is an error reading the executable
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If one of the specified chips is not valid
- If app_id is an invalid application ID
- If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
write_neighbour_memory
(x, y, link, base_address, data, n_bytes=None, offset=0, cpu=0)[source]¶ Write to the memory of a neighbouring chip using a LINK_READ SCP command. If sent to a BMP, this command can be used to communicate with the FPGAs’ debug registers.
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.exceptions.SpinnmanIOException –
- If there is an error communicating with the board
- If there is an error reading the data
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException –
- If x, y does not lead to a valid chip
- If a packet is received that has invalid parameters
- If base_address is not a positive integer
- If data is an AbstractDataReader but n_bytes is not specified
- If data is an int and n_bytes is more than 4
- If n_bytes is less than 0
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
spinnman.transceiver.
create_transceiver_from_hostname
(hostname, version, bmp_connection_data=None, number_of_boards=None, 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: Raises: - spinnman.exceptions.SpinnmanIOException – If there is an error communicating with the board
- spinnman.exceptions.SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- spinnman.exceptions.SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- spinnman.exceptions.SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
Module contents¶
Used to communicate with a SpiNNaker Board. The main part of this package is the 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()
andget_scamp_version()
are used to ensure that the board is booted correctly before starting a simulation.get_machine_details()
is used to get a representation of the current state of the machine, which is used to decide where executables are to be run on the board for a particular simulation, where any external peripherals are connected, and how messages between the executables and/or the external peripherals are to be routedwrite_memory()
andexecute()
are used to write parameters and execute executables on the boardsend_signal()
is used to send a signal which starts, stops or pauses a simulation.get_core_status_count()
is used to determine if a simulation is complete or has gone into an error state.get_iobuf()
,get_cpu_information()
andget_router_diagnostics()
are used to diagnose a problem with a simulationread_memory()
is used to read some statistics recorded in SDRAM after a simulation