spinnman package¶
Subpackages¶
- spinnman.connections package
- spinnman.data package
- spinnman.messages package
- spinnman.model package
- spinnman.processes package
- spinnman.spalloc package
- spinnman.utilities package
Submodules¶
spinnman.constants module¶
-
spinnman.constants.
BMP_ADC_MAX
= 4096¶ The range of values the BMP’s 12-bit ADCs can measure.
-
spinnman.constants.
BMP_MISSING_FAN
= -1¶ Fan speed value returned when a fan is absent.
-
spinnman.constants.
BMP_MISSING_TEMP
= -32768¶ Temperature value returned when a probe is not connected.
-
spinnman.constants.
BMP_POST_POWER_ON_SLEEP_TIME
= 5.0¶ Time to sleep after powering on boards
-
spinnman.constants.
BMP_POWER_ON_TIMEOUT
= 10.0¶ Timeout for BMP power-on commands to reply.
-
spinnman.constants.
BMP_TEMP_SCALE
= 0.00390625¶ Multiplier to convert from temperature probe values to degrees Celsius.
-
spinnman.constants.
BMP_TIMEOUT
= 0.5¶ Timeout for other BMP commands to reply
-
spinnman.constants.
BMP_V_SCALE_12
= 0.003662109375¶ Multiplier to convert from ADC value to volts for 12 V lines.
-
spinnman.constants.
BMP_V_SCALE_2_5
= 0.0006103515625¶ Multiplier to convert from ADC value to volts for lines less than 2.5 V.
-
spinnman.constants.
BMP_V_SCALE_3_3
= 0.00091552734375¶ Multiplier to convert from ADC value to volts for 3.3 V lines.
-
spinnman.constants.
BOOT_RETRIES
= 3¶ This is the number of retries during boot - this is different because otherwise boot takes too long (retrying on a non-booted machine will never work)
-
spinnman.constants.
CPU_INFO_BYTES
= 128¶ How many bytes the CPU info data takes up
-
spinnman.constants.
CPU_INFO_OFFSET
= 3842011136¶ The address of the start of the VCPU structure (copied from sark.h)
-
spinnman.constants.
CPU_IOBUF_ADDRESS_OFFSET
= 88¶ The address at which the iobuf address starts
-
spinnman.constants.
CPU_USER_0_START_ADDRESS
= 112¶ The address at which user0 register starts
-
spinnman.constants.
CPU_USER_1_START_ADDRESS
= 116¶ The address at which user1 register starts
-
spinnman.constants.
CPU_USER_2_START_ADDRESS
= 120¶ The address at which user2 register starts
-
spinnman.constants.
CPU_USER_3_START_ADDRESS
= 124¶ The address at which user3 register starts
-
class
spinnman.constants.
EIEIO_COMMAND_IDS
[source]¶ Bases:
enum.Enum
A listing of what SpiNNaker specific EIEIO commands there are.
-
DATABASE
= 1¶ Database handshake with external program; not routed via SpiNNaker
-
EVENT_PADDING
= 2¶ Fill in buffer area with padding
-
EVENT_STOP
= 3¶ End of all buffers, stop execution
-
HOST_DATA_READ
= 9¶ Host confirming data being read form SpiNNaker memory
-
HOST_DATA_READ_ACK
= 12¶ Host confirming request to read data received
-
HOST_SEND_SEQUENCED_DATA
= 7¶ Buffers being sent from host to SpiNNaker
-
SPINNAKER_REQUEST_BUFFERS
= 6¶ Spinnaker requesting new buffers for spike source population
-
SPINNAKER_REQUEST_READ_DATA
= 8¶ Buffers available to be read from a buffered out vertex
-
START_RESUME_NOTIFICATION
= 11¶ Command for notifying the external devices that the simulation has started
-
START_SENDING_REQUESTS
= 5¶ Start complaining that there is SDRAM free space for buffers
-
STOP_PAUSE_NOTIFICATION
= 10¶ Command for notifying the external devices that the simulation has stopped
-
STOP_SENDING_REQUESTS
= 4¶ Stop complaining that there is SDRAM free space for buffers
-
-
class
spinnman.constants.
IPTAG_TIME_OUT_WAIT_TIMES
[source]¶ Bases:
enum.Enum
The values used by the SCP IP tag time outs. These control how long to wait for any message request which requires a response, before raising an error.
The value is calculated via the following formula:
10ms * 2^(tag_timeout_value - 1)
-
TIMEOUT_10_ms
= 1¶
-
TIMEOUT_1280_ms
= 8¶
-
TIMEOUT_160_ms
= 5¶
-
TIMEOUT_20_ms
= 2¶
-
TIMEOUT_2560_ms
= 9¶
-
TIMEOUT_320_ms
= 6¶
-
TIMEOUT_40_ms
= 3¶
-
TIMEOUT_640_ms
= 7¶
-
TIMEOUT_80_ms
= 4¶
-
-
spinnman.constants.
MAX_TAG_ID
= 7¶ Max user requested tag value
-
spinnman.constants.
NO_ROUTER_DIAGNOSTIC_FILTERS
= 16¶ Number of router diagnostic filters
-
spinnman.constants.
N_RETRIES
= 10¶ This is the default number of retries when using SCP
-
class
spinnman.constants.
READ_TYPES
[source]¶ Bases:
enum.Enum
The types of read available from SARK. These values are used to tell SARK how to read the data in a time efficient manner.
-
BYTE
= 0¶
-
HALF_WORD
= 1¶
-
WORD
= 2¶
-
-
spinnman.constants.
ROUTER_DEFAULT_FILTERS_MAX_POSITION
= 11¶ Point where default filters finish and user set-able ones are available
-
spinnman.constants.
ROUTER_DIAGNOSTIC_FILTER_SIZE
= 4¶ Size of a router diagnostic filter control register in bytes
-
spinnman.constants.
ROUTER_FILTER_CONTROLS_OFFSET
= 512¶ Offset for the router filter controls first register (one word each)
-
spinnman.constants.
ROUTER_REGISTER_BASE_ADDRESS
= 3774873600¶ The base address of a routers diagnostic filter controls
-
spinnman.constants.
ROUTER_REGISTER_P2P_ADDRESS
= 3774939136¶ The base address of a routers p2p routing table
-
class
spinnman.constants.
ROUTER_REGISTER_REGISTERS
[source]¶ Bases:
enum.Enum
The indices to the router registers.
-
DUMP_FR
= 11¶
-
DUMP_MC
= 8¶
-
DUMP_NN
= 10¶
-
DUMP_PP
= 9¶
-
EXT_FR
= 7¶
-
EXT_MC
= 1¶
-
EXT_NN
= 5¶
-
EXT_PP
= 3¶
-
LOC_FR
= 6¶
-
LOC_MC
= 0¶
-
LOC_NN
= 4¶
-
LOC_PP
= 2¶
-
USER_0
= 12¶
-
USER_1
= 13¶
-
USER_2
= 14¶
-
USER_3
= 15¶
-
-
spinnman.constants.
SCP_SCAMP_PORT
= 17893¶ The default port of the connection
-
spinnman.constants.
SCP_TIMEOUT
= 1.0¶ This is the default timeout when using SCP
-
spinnman.constants.
SYSTEM_VARIABLE_BASE_ADDRESS
= 4110450432¶ The base address of the system variable structure in System ram
-
spinnman.constants.
SYSTEM_VARIABLE_BYTES
= 256¶ The size of the system variable structure in bytes
-
spinnman.constants.
UDP_BOOT_CONNECTION_DEFAULT_PORT
= 54321¶ The default port of the connection
-
spinnman.constants.
UDP_MESSAGE_MAX_SIZE
= 256¶ The max size a UDP packet can be, excluding headers
-
spinnman.constants.
address_length_dtype
= {(0, 0): <READ_TYPES.WORD: 2>, (0, 1): <READ_TYPES.BYTE: 0>, (0, 2): <READ_TYPES.HALF_WORD: 1>, (0, 3): <READ_TYPES.BYTE: 0>, (1, 0): <READ_TYPES.BYTE: 0>, (1, 1): <READ_TYPES.BYTE: 0>, (1, 2): <READ_TYPES.BYTE: 0>, (1, 3): <READ_TYPES.BYTE: 0>, (2, 0): <READ_TYPES.HALF_WORD: 1>, (2, 1): <READ_TYPES.BYTE: 0>, (2, 2): <READ_TYPES.HALF_WORD: 1>, (2, 3): <READ_TYPES.BYTE: 0>, (3, 0): <READ_TYPES.BYTE: 0>, (3, 1): <READ_TYPES.BYTE: 0>, (3, 2): <READ_TYPES.BYTE: 0>, (3, 3): <READ_TYPES.BYTE: 0>}¶ This is a mapping between read address in the mapping between word byte position, the number of bytes you wish to read, and the type of time efficient way to read said amount of bytes via SARK
spinnman.exceptions module¶
-
exception
spinnman.exceptions.
SpallocException
[source]¶ Bases:
spinnman.exceptions.SpinnmanException
Raised when there is a problem with the Spalloc session or job.
-
exception
spinnman.exceptions.
SpiNNManCoresNotInStateException
(timeout, expected_states, failed_core_states)[source]¶ Bases:
spinnman.exceptions.SpinnmanTimeoutException
Cores failed to reach a given state within a timeout.
Parameters:
-
exception
spinnman.exceptions.
SpinnmanEIEIOPacketParsingException
(parsing_format, packet)[source]¶ Bases:
spinnman.exceptions.SpinnmanException
Unable to complete the parsing of the EIEIO packet received. The routine used is invalid or the content of the packet is invalid.
Parameters:
-
exception
spinnman.exceptions.
SpinnmanEOFException
[source]¶ Bases:
spinnman.exceptions.SpinnmanIOException
An exception that we’re trying to do I/O on a closed socket. That isn’t going to work!
-
exception
spinnman.exceptions.
SpinnmanException
[source]¶ Bases:
Exception
Superclass of exceptions that occur when dealing with communication with SpiNNaker.
-
exception
spinnman.exceptions.
SpinnmanGenericProcessException
(exception, tb, x, y, p, phys_p, tb2=None)[source]¶ Bases:
spinnman.exceptions.SpinnmanException
Encapsulates exceptions from processes which communicate with some core/chip.
Parameters:
-
exception
spinnman.exceptions.
SpinnmanGroupedProcessException
(error_requests, exceptions, tracebacks, connections)[source]¶ Bases:
spinnman.exceptions.SpinnmanException
Encapsulates exceptions from processes which communicate with a collection of cores/chips.
-
exception
spinnman.exceptions.
SpinnmanIOException
(problem)[source]¶ Bases:
spinnman.exceptions.SpinnmanException
An exception that something went wrong with the underlying IO.
Parameters: problem (str) – The problem with the IO
-
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:
-
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: -
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: -
type
¶ The value that is invalid.
-
-
exception
spinnman.exceptions.
SpinnmanTimeoutException
(operation, timeout, msg=None)[source]¶ Bases:
spinnman.exceptions.SpinnmanException
An exception that indicates that a timeout occurred before an operation could finish.
Parameters:
-
exception
spinnman.exceptions.
SpinnmanUnexpectedResponseCodeException
(operation, command, response)[source]¶ Bases:
spinnman.exceptions.SpinnmanException
Indicate that a response code returned from the board was unexpected for the current operation.
Parameters: -
command
¶ The command being executed.
-
-
exception
spinnman.exceptions.
SpinnmanUnsupportedOperationException
(operation)[source]¶ Bases:
spinnman.exceptions.SpinnmanException
An exception that indicates that the given operation is not supported.
Parameters: operation (str) – The operation being requested
spinnman.get_cores_in_run_state module¶
This is a script used to check the state of a SpiNNaker machine.
-
spinnman.get_cores_in_run_state.
get_cores_in_run_state
(txrx, app_id, print_all_chips)[source]¶ Parameters: - txrx (Transceiver) –
- app_id (int) –
- print_all_chips (bool) –
spinnman.transceiver module¶
-
class
spinnman.transceiver.
Transceiver
(version, connections=None)[source]¶ Bases:
spinn_utilities.abstract_context_manager.AbstractContextManager
An encapsulation of various communications with the SpiNNaker board.
The methods of this class are designed to be thread-safe (provided they do not access a BMP, as access to those is never thread-safe); thus you can make multiple calls to the same (or different) methods from multiple threads and expect each call to work as if it had been called sequentially, although the order of returns is not guaranteed.
Note
With multiple connections to the board, using multiple threads in this way may result in an increase in the overall speed of operation, since the multiple calls may be made separately over the set of given connections.
Parameters: - version (int) – The version of the board being connected to
- connections (list(Connection)) – An iterable of connections to the board. If not specified, no communication will be possible until connections are found.
Raises: - SpinnmanIOException – If there is an error communicating with the board, or if no
connections to the board can be found (if connections is
None
) - SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
add_scamp_connections
(connections)[source]¶ Check connections to the board and store these for future use.
Note
An exception will be thrown if no initial connections can be found to the board.
Parameters: connections (dict((int,int),str)) – Dict of x,y to ip address
Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
bmp_connection
¶ The BMP connections.
Warning
This property is currently deprecated and likely to be removed.
Return type: dict(tuple(int,int),MostDirectConnectionSelector)
-
boot_board
(number_of_boards=None, width=None, height=None, extra_boot_values=None)[source]¶ Attempt to boot the board. No check is performed to see if the board is already booted.
Parameters: - number_of_boards – this parameter is deprecated
- width – this parameter is deprecated
- height – this parameter is deprecated
- extra_boot_values (dict(SystemVariableDefinition,object)) – extra values to set during boot
Raises: - SpinnmanInvalidParameterException – If the board version is not known
- SpinnmanIOException – If there is an error communicating with the board
-
clear_ip_tag
(tag, board_address=None)[source]¶ Clear the setting of an IP tag.
Parameters: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If the tag is not a valid tag
- If the connection cannot send SDP messages
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
clear_multicast_routes
(x, y)[source]¶ Remove all the multicast routes on a chip.
Parameters: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
clear_router_diagnostic_counters
(x, y, enable=True, counter_ids=None)[source]¶ Clear router diagnostic information on a chip.
Parameters: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters or a counter ID is out of range
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
control_sync
(do_sync)[source]¶ Control the synchronization of the chips.
Parameters: do_sync (bool) – Whether to synchonize or not
-
discover_scamp_connections
()[source]¶ Find connections to the board and store these for future use.
Note
An exception will be thrown if no initial connections can be found to the board.
Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
ensure_board_is_ready
(number_of_boards=None, width=None, height=None, n_retries=5, extra_boot_values=None)[source]¶ Ensure that the board is ready to interact with this version of the transceiver. Boots the board if not already booted and verifies that the version of SCAMP running is compatible with this transceiver.
Parameters: - number_of_boards (int or None) – this parameter is deprecated and will be ignored
- width (int or None) – this parameter is deprecated and will be ignored
- height (int or None) – this parameter is deprecated and will be ignored
- n_retries (int) – The number of times to retry booting
- extra_boot_values (dict(SystemVariableDefinition,object)) – Any additional values to set during boot
Returns: The version identifier
Return type: Raises: - If there is a problem booting the board
- If the version of software on the board is not compatible with this transceiver
-
execute
(x, y, processors, executable, app_id, n_bytes=None, wait=False, is_filename=False)[source]¶ Start an executable running on a single chip.
Warning
This method is currently deprecated and likely to be removed.
Parameters: - x (int) – The x-coordinate of the chip on which to run the executable
- y (int) – The y-coordinate of the chip on which to run the executable
- processors (list(int)) – The cores on the chip on which to run the application
- executable (RawIOBase or bytes or bytearray or str) –
The data that is to be executed. Should be one of the following:
- An instance of RawIOBase
- A bytearray/bytes
- A filename of a file containing the executable (in which case is_filename must be set to True)
- app_id (int) – The ID of the application with which to associate the executable
- n_bytes (int) –
The size of the executable data in bytes. If not specified:
- If executable is an RawIOBase, an error is raised
- If executable is a bytearray, the length of the bytearray will be used
- If executable is an int, 4 will be used
- If executable is a str, the length of the file will be used
- wait (bool) – True if the binary should enter a “wait” state on loading
- is_filename (bool) – True if executable is a filename
Raises: - SpinnmanIOException –
- If there is an error communicating with the board
- If there is an error reading the executable
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If x, y, p does not lead to a valid core
- If app_id is an invalid application ID
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
execute_application
(executable_targets, app_id)[source]¶ Execute a set of binaries that make up a complete application on specified cores, wait for them to be ready and then start all of the binaries.
Note
This will get the binaries into c_main but will not signal the barrier.
Parameters: - executable_targets (ExecutableTargets) – The binaries to be executed and the cores to execute them on
- app_id (int) – The app_id to give this application
-
execute_flood
(core_subsets, executable, app_id, n_bytes=None, wait=False, is_filename=False)[source]¶ Start an executable running on multiple places on the board. This will be optimised based on the selected cores, but it may still require a number of communications with the board to execute.
Parameters: - core_subsets (CoreSubsets) – Which cores on which chips to start the executable
- executable (RawIOBase or bytes or bytearray or str) –
The data that is to be executed. Should be one of the following:
- An instance of RawIOBase
- A bytearray
- A filename of an executable (in which case is_filename must be set to True)
- app_id (int) – The ID of the application with which to associate the executable
- n_bytes (int) –
The size of the executable data in bytes. If not specified:
- If executable is an RawIOBase, an error is raised
- If executable is a bytearray, the length of the bytearray will be used
- If executable is an int, 4 will be used
- If executable is a str, the length of the file will be used
- wait (bool) – True if the processors should enter a “wait” state on loading
- is_filename (bool) – True if the data is a filename
Raises: - SpinnmanIOException –
- If there is an error communicating with the board
- If there is an error reading the executable
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If one of the specified cores is not valid
- If app_id is an invalid application ID
- If a packet is received that has invalid parameters
- If executable is an RawIOBase but n_bytes is not specified
- If executable is an int and n_bytes is more than 4
- If n_bytes is less than 0
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
free_sdram
(x, y, base_address, app_id)[source]¶ Free allocated SDRAM.
Warning
This method is currently deprecated and likely to be removed.
Parameters:
-
free_sdram_by_app_id
(x, y, app_id)[source]¶ Free all SDRAM allocated to a given app ID.
Warning
This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.
Parameters: Returns: The number of blocks freed
Return type:
-
get_connections
()[source]¶ Get the currently known connections to the board, made up of those passed in to the transceiver and those that are discovered during calls to discover_connections. No further discovery is done here.
Returns: An iterable of connections known to the transceiver Return type: list(Connection)
-
get_core_state_count
(app_id, state)[source]¶ Get a count of the number of cores which have a given state.
Parameters: Returns: A count of the cores with the given status
Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If state is not a valid status
- If app_id is not a valid application ID
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
get_core_status_string
(cpu_infos)[source]¶ Get a string indicating the status of the given cores.
Parameters: cpu_infos (CPUInfos) – A CPUInfos objects Return type: str
-
get_cores_in_state
(all_core_subsets, states)[source]¶ Get all cores that are in a given state or set of states.
Parameters: - all_core_subsets (CoreSubsets) – The cores to filter
- states (CPUState or set(CPUState)) – The state or states to filter on
Returns: Core subsets object containing cores in the given state(s)
Return type:
-
get_cores_not_in_state
(all_core_subsets, states)[source]¶ Get all cores that are not in a given state or set of states.
Parameters: - all_core_subsets (CoreSubsets) – The cores to filter
- states (CPUState or set(CPUState)) – The state or states to filter on
Returns: Core subsets object containing cores not in the given state(s)
Return type:
-
get_cpu_information
(core_subsets=None)[source]¶ Get information about the processors on the board.
Parameters: core_subsets (CoreSubsets) – A set of chips and cores from which to get the information. If not specified, the information from all of the cores on all of the chips on the board are obtained.
Returns: An iterable of the CPU information for the selected cores, or all cores if core_subsets is not specified
Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If chip_and_cores contains invalid items
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
get_cpu_information_from_core
(x, y, p)[source]¶ Get information about a specific processor on the board.
Parameters: Returns: The CPU information for the selected core
Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If x, y, p is not a valid processor
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
get_heap
(x, y, heap=<SystemVariableDefinition.sdram_heap_address: _Definition(offset=76, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The base address of the user SDRAM heap')>)[source]¶ Get the contents of the given heap on a given chip.
Parameters: - x (int) – The x-coordinate of the chip
- y (int) – The y-coordinate of the chip
- heap (SystemVariableDefinition) – The SystemVariableDefinition which is the heap to read
Return type:
-
get_iobuf
(core_subsets=None)[source]¶ Get the contents of the IOBUF buffer for a number of processors.
Parameters: core_subsets (CoreSubsets) – A set of chips and cores from which to get the buffers. If not specified, the buffers from all of the cores on all of the chips on the board are obtained.
Returns: An iterable of the buffers, which may not be in the order of core_subsets
Return type: iterable(IOBuffer)
Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If chip_and_cores contains invalid items
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
get_iobuf_from_core
(x, y, p)[source]¶ Get the contents of IOBUF for a given core.
Warning
This method is currently deprecated and likely to be removed.
Parameters: Returns: An IOBUF buffer
Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If chip_and_cores contains invalid items
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
get_machine_details
()[source]¶ Get the details of the machine made up of chips on a board and how they are connected to each other.
Returns: A machine description
Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
get_machine_dimensions
()[source]¶ Get the maximum chip x-coordinate and maximum chip y-coordinate of the chips in the machine.
Returns: The dimensions of the machine
Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
get_multicast_routes
(x, y, app_id=None)[source]¶ Get the current multicast routes set up on a chip.
Parameters: Returns: An iterable of multicast routes
Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
get_router_diagnostic_filter
(x, y, position)[source]¶ Gets a router diagnostic filter from a router.
Parameters: Returns: The diagnostic filter read
Return type: Raises: - SpinnmanIOException –
- If there is an error communicating with the board
- If there is an error reading the data
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If x, y does not lead to a valid chip
- If a packet is received that has invalid parameters
- If position is less than 0 or more than 15
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
- SpinnmanIOException –
-
get_router_diagnostics
(x, y)[source]¶ Get router diagnostic information from a chip.
Parameters: Returns: The router diagnostic information
Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
get_scamp_version
(chip_x=255, chip_y=255, connection_selector=None, n_retries=10)[source]¶ Get the version of SCAMP which is running on the board.
Parameters: - chip_x (int) – the chip’s x coordinate to query for SCAMP version
- chip_y (int) – the chip’s y coordinate to query for SCAMP version
- connection_selector (AbstractMultiConnectionProcessConnectionSelector) – the connection to send the SCAMP version or None (if None then a random SCAMP connection is used).
- n_retries (int) –
Returns: The version identifier
Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidParameterException – If the timeout is less than 1
- SpinnmanTimeoutException – If none of the retries resulted in a response before the timeout (suggesting that the board is not booted).
Get the current set of tags that have been set on the board.
Parameters: connection (AbstractSCPConnection) – Connection from which the tags should be received. If not specified, all AbstractSCPConnection connections will be queried and the response will be combined.
Returns: An iterable of tags
Return type: iterable(AbstractTag)
Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If the connection cannot send SDP messages
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
static
get_user_0_register_address_from_core
(p)[source]¶ Get the address of user 0 for a given processor on the board.
Note
Conventionally, user_0 usually holds the address of the table of memory regions.
Parameters: p (int) – The ID of the processor to get the user 0 address from Returns: The address for user 0 register for this processor Return type: int
-
static
get_user_1_register_address_from_core
(p)[source]¶ Get the address of user 1 for a given processor on the board.
Parameters: p (int) – The ID of the processor to get the user 1 address from Returns: The address for user 1 register for this processor Return type: int
-
static
get_user_2_register_address_from_core
(p)[source]¶ Get the address of user 2 for a given processor on the board.
Parameters: p (int) – The ID of the processor to get the user 2 address from Returns: The address for user 2 register for this processor Return type: int
-
static
get_user_3_register_address_from_core
(p)[source]¶ Get the address of user 3 for a given processor on the board.
Parameters: p (int) – The ID of the processor to get the user 3 address from Returns: The address for user 3 register for this processor Return type: int
-
is_connected
(connection=None)[source]¶ Determines if the board can be contacted.
Parameters: connection (Connection) – The connection which is to be tested. If None, all connections will be tested, and the board will be considered to be connected if any one connection works. Returns: True if the board can be contacted, False otherwise Return type: bool
-
static
is_scamp_version_compabible
(version)[source]¶ Determine if the version of SCAMP is compatible with this transceiver.
Parameters: version (tuple(int,int,int)) – The version to test Return type: bool
-
load_fixed_route
(x, y, fixed_route, app_id)[source]¶ Loads a fixed route routing table entry onto a chip’s router.
Parameters: - x (int) – The x-coordinate of the chip onto which to load the routes
- y (int) – The y-coordinate of the chip onto which to load the routes
- fixed_route (FixedRouteEntry) – the route for the fixed route entry on this chip
- app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.
Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If any of the routes are invalid
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
load_multicast_routes
(x, y, routes, app_id)[source]¶ Load a set of multicast routes on to a chip.
Parameters: - x (int) – The x-coordinate of the chip onto which to load the routes
- y (int) – The y-coordinate of the chip onto which to load the routes
- routes (iterable(MulticastRoutingEntry)) – An iterable of multicast routes to load
- app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.
Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If any of the routes are invalid
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
locate_spinnaker_connection_for_board_address
(board_address)[source]¶ Find a connection that matches the given board IP address.
Parameters: board_address (str) – The IP address of the Ethernet connection on the board Returns: A connection for the given IP address, or None if no such connection exists Return type: SCAMPConnection
-
malloc_sdram
(x, y, size, app_id, tag=None)[source]¶ Allocates a chunk of SDRAM on a chip on the machine.
Parameters: - x (int) – The x-coordinate of the chip onto which to ask for memory
- y (int) – The y-coordinate of the chip onto which to ask for memory
- size (int) – the amount of memory to allocate in bytes
- app_id (int) – The ID of the application with which to associate the routes. If not specified, defaults to 0.
- tag (int) – the tag for the SDRAM, a 8-bit (chip-wide) tag that can be looked up by a SpiNNaker application to discover the address of the allocated block. If 0 then no tag is applied.
Returns: the base address of the allocated memory
Return type:
-
number_of_boards_located
¶ The number of boards currently configured.
Warning
This property is currently deprecated and likely to be removed.
Return type: int
-
power_off
(boards=0, cabinet=0, frame=0)[source]¶ Power off a set of boards in the machine.
Parameters:
-
power_off_machine
()[source]¶ Power off the whole machine.
:rtype bool :return success or failure to power off the machine
-
power_on
(boards=0, cabinet=0, frame=0)[source]¶ Power on a set of boards in the machine.
Parameters:
-
power_on_machine
()[source]¶ Power on the whole machine.
:rtype bool :return success of failure to power on machine
-
read_adc_data
(board, cabinet, frame)[source]¶ Read the BMP ADC data.
Warning
This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.
Parameters: Returns: the FPGA’s ADC data object
Return type:
-
read_bmp_version
(board, cabinet, frame)[source]¶ Read the BMP version.
Parameters: Returns: the sver from the BMP
-
read_fixed_route
(x, y, app_id)[source]¶ Reads a fixed route routing table entry from a chip’s router.
Parameters: Returns: the route as a fixed route entry
-
read_fpga_register
(fpga_num, register, cabinet, frame, board)[source]¶ Read a register on a FPGA of a board. The meaning of the register’s contents will depend on the FPGA’s configuration.
Parameters: - fpga_num (int) – FPGA number (0, 1 or 2) to communicate with.
- register (int) – Register address to read to (will be rounded down to the nearest 32-bit word boundary).
- cabinet (int) – cabinet: the cabinet this is targeting
- frame (int) – the frame this is targeting
- board (int) – which board to request the FPGA register from
Returns: the register data
Return type:
-
read_memory
(x, y, base_address, length, cpu=0)[source]¶ Read some areas of memory (usually SDRAM) from the board.
Parameters: - x (int) – The x-coordinate of the chip where the memory is to be read from
- y (int) – The y-coordinate of the chip where the memory is to be read from
- base_address (int) – The address in SDRAM where the region of memory to be read starts
- length (int) – The length of the data to be read in bytes
- cpu (int) – the core ID used to read the memory of; should usually be 0 when reading from SDRAM, but may be other values when reading from DTCM.
Returns: A bytearray of data read
Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If one of x, y, cpu, base_address or length is invalid
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
read_neighbour_memory
(x, y, link, base_address, length, cpu=0)[source]¶ Read some areas of memory on a neighbouring chip using a LINK_READ SCP command. If sent to a BMP, this command can be used to communicate with the FPGAs’ debug registers.
Warning
This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.
Parameters: - x (int) – The x-coordinate of the chip whose neighbour is to be read from
- y (int) – The y-coordinate of the chip whose neighbour is to be read from
- cpu (int) – The CPU to use, typically 0 (or if a BMP, the slot number)
- link (int) – The link index to send the request to (or if BMP, the FPGA number)
- base_address (int) – The address in SDRAM where the region of memory to be read starts
- length (int) – The length of the data to be read in bytes
Returns: An iterable of chunks of data read in order
Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If one of x, y, cpu, base_address or length is invalid
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
read_user_0
(x, y, p)[source]¶ Get the contents of the user_0 register for the given processor.
Note
Conventionally, user_0 usually holds the address of the table of memory regions.
Parameters: Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If x, y, p does not identify a valid processor
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
read_user_1
(x, y, p)[source]¶ Get the contents of the user_1 register for the given processor.
Parameters: Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If x, y, p does not identify a valid processor
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
read_word
(x, y, base_address, cpu=0)[source]¶ Read a word (usually of SDRAM) from the board.
Parameters: - x (int) – The x-coordinate of the chip where the word is to be read from
- y (int) – The y-coordinate of the chip where the word is to be read from
- base_address (int) – The address (usually in SDRAM) where the word to be read starts
- cpu (int) – the core ID used to read the word; should usually be 0 when reading from SDRAM, but may be other values when reading from DTCM.
Returns: The unsigned integer value at
base_address
Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If one of x, y, cpu or base_address is invalid
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
send_scp_message
(message, connection=None)[source]¶ Sends an SCP message, without expecting a response.
Parameters: - message (AbstractSCPRequest) – The message to send
- connection (SCAMPConnection) – The connection to use (omit to pick a random one)
Raises: - SpinnmanTimeoutException – If there is a timeout before a message is received
- SpinnmanInvalidParameterException – If one of the fields of the received message is invalid
- SpinnmanInvalidPacketException –
- If the message is not a recognised packet type
- If a packet is received that is not a valid response
- SpinnmanUnsupportedOperationException – If no connection can send the type of message given
- SpinnmanIOException – If there is an error sending the message or receiving the response
- SpinnmanUnexpectedResponseCodeException – If the response is not one of the expected codes
-
send_sdp_message
(message, connection=None)[source]¶ Sends an SDP message using one of the connections.
Parameters: - message (SDPMessage) – The message to send
- connection (SDPConnection) – An optional connection to use
-
send_signal
(app_id, signal)[source]¶ Send a signal to an application.
Parameters: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If signal is not a valid signal
- If app_id is not a valid application ID
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
set_ip_tag
(ip_tag, use_sender=False)[source]¶ Set up an IP tag.
Parameters: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If the IP tag fields are incorrect
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
set_led
(led, action, board, cabinet, frame)[source]¶ Set the LED state of a board in the machine.
Warning
This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.
Parameters: - led (int or iterable(int)) – Number of the LED or an iterable of LEDs to set the state of (0-7)
- action (LEDAction) – State to set the LED to, either on, off or toggle
- board (int or iterable(int)) – Specifies the board to control the LEDs of. This may also be an iterable of multiple boards (in the same frame). The command will actually be sent to the first board in the iterable.
- cabinet (int) – the cabinet this is targeting
- frame (int) – the frame this is targeting
-
set_leds
(x, y, cpu, led_states)[source]¶ Set LED states.
Warning
The set_leds is deprecated and untested due to no known use.
Parameters: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
set_reverse_ip_tag
(reverse_ip_tag)[source]¶ Set up a reverse IP tag.
Parameters: reverse_ip_tag (ReverseIPTag) –
The reverse tag to set up.
Note
The board_address field can be None, in which case, the tag will be assigned to all boards.
Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If the reverse IP tag fields are incorrect
- If a packet is received that has invalid parameters
- If the UDP port is one that is already used by SpiNNaker for
- system functions
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
set_router_diagnostic_filter
(x, y, position, diagnostic_filter)[source]¶ Sets a router diagnostic filter in a router.
Parameters: - x (int) – The X address of the router in which this filter is being set.
- y (int) – The Y address of the router in which this filter is being set.
- position (int) – The position in the list of filters where this filter is to be added.
- diagnostic_filter (DiagnosticFilter) –
The diagnostic filter being set in the placed, between 0 and 15.
Note
Positions 0 to 11 are used by the default filters, and setting these positions will result in a warning.
Raises: - SpinnmanIOException –
- If there is an error communicating with the board
- If there is an error reading the data
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If x, y does not lead to a valid chip
- If position is less than 0 or more than 15
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
set_watch_dog
(watch_dog)[source]¶ Enable, disable or set the value of the watch dog timer.
Warning
This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.
Parameters: watch_dog (bool or int) – Either a boolean indicating whether to enable (True) or disable (False) the watch dog timer, or an int value to set the timer count to.
-
set_watch_dog_on_chip
(x, y, watch_dog)[source]¶ Enable, disable or set the value of the watch dog timer on a specific chip.
Warning
This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.
Parameters:
-
stop_application
(app_id)[source]¶ Sends a stop request for an app_id.
Parameters: app_id (int) – The ID of the application to send to
Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If app_id is not a valid application ID
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
wait_for_cores_to_be_in_state
(all_core_subsets, app_id, cpu_states, timeout=None, time_between_polls=0.1, error_states=frozenset({<CPUState.WATCHDOG: 3>, <CPUState.RUN_TIME_EXCEPTION: 2>}), counts_between_full_check=100, progress_bar=None)[source]¶ Waits for the specified cores running the given application to be in some target state or states. Handles failures.
Parameters: - all_core_subsets (CoreSubsets) – the cores to check are in a given sync state
- app_id (int) – the application ID that being used by the simulation
- cpu_states (set(CPUState)) – The expected states once the applications are ready; success is when each application is in one of these states
- timeout (float) – The amount of time to wait in seconds for the cores to reach one of the states
- time_between_polls (float) – Time between checking the state
- error_states (set(CPUState)) – Set of states that the application can be in that indicate an error, and so should raise an exception
- counts_between_full_check (int) – The number of times to use the count signal before instead using the full CPU state check
- progress_bar (ProgressBar or None) – Possible progress bar to update.
Raises: SpinnmanTimeoutException – If a timeout is specified and exceeded.
-
write_fpga_register
(fpga_num, register, value, cabinet, frame, board)[source]¶ Write a register on a FPGA of a board. The meaning of setting the register’s contents will depend on the FPGA’s configuration.
Parameters: - fpga_num (int) – FPGA number (0, 1 or 2) to communicate with.
- register (int) – Register address to read to (will be rounded down to the nearest 32-bit word boundary).
- value (int) – the value to write into the FPGA register
- cabinet (int) – cabinet: the cabinet this is targeting
- frame (int) – the frame this is targeting
- board (int) – which board to write the FPGA register to
-
write_memory
(x, y, base_address, data, n_bytes=None, offset=0, cpu=0, is_filename=False, get_sum=False)[source]¶ Write to the SDRAM on the board.
Parameters: - x (int) – The x-coordinate of the chip where the memory is to be written to
- y (int) – The y-coordinate of the chip where the memory is to be written to
- base_address (int) – The address in SDRAM where the region of memory is to be written
- data (RawIOBase or bytes or bytearray or int or str) –
The data to write. Should be one of the following:
- An instance of RawIOBase
- A bytearray/bytes
- A single integer - will be written in little-endian byte order
- A filename of a data file (in which case is_filename must be set to True)
- n_bytes (int) –
The amount of data to be written in bytes. If not specified:
- If data is an RawIOBase, an error is raised
- If data is a bytearray, the length of the bytearray will be used
- If data is an int, 4 will be used
- If data is a str, the length of the file will be used
- offset (int) – The offset from which the valid data begins
- cpu (int) – The optional CPU to write to
- is_filename (bool) – True if data is a filename
- get_sum (bool) – whether to return a checksum or 0
Returns: The number of bytes written, the checksum (0 if get_sum=False)
Return type: Raises: - SpinnmanIOException –
- If there is an error communicating with the board
- If there is an error reading the data
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If x, y does not lead to a valid chip
- If a packet is received that has invalid parameters
- If base_address is not a positive integer
- If data is an RawIOBase but n_bytes is not specified
- If data is an int and n_bytes is more than 4
- If n_bytes is less than 0
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
write_memory_flood
(base_address, data, n_bytes=None, offset=0, is_filename=False)[source]¶ Write to the SDRAM of all chips.
Parameters: - base_address (int) – The address in SDRAM where the region of memory is to be written
- data (RawIOBase or bytes or bytearray or int or str) –
The data that is to be written. Should be one of the following:
- An instance of RawIOBase
- A bytearray or bytestring
- A single integer
- A file name of a file to read (in which case is_filename should be set to True)
- n_bytes (int) –
The amount of data to be written in bytes. If not specified:
- If data is an RawIOBase, an error is raised
- If data is a bytearray, the length of the bytearray will be used
- If data is an int, 4 will be used
- If data is a str, the size of the file will be used
- offset (int) – The offset where the valid data starts; if data is an int, then the offset will be ignored and 0 is used.
- is_filename (bool) – True if data should be interpreted as a file name
Raises: - SpinnmanIOException –
- If there is an error communicating with the board
- If there is an error reading the executable
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If one of the specified chips is not valid
- If app_id is an invalid application ID
- If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
write_neighbour_memory
(x, y, link, base_address, data, n_bytes=None, offset=0, cpu=0)[source]¶ Write to the memory of a neighbouring chip using a LINK_READ SCP command. If sent to a BMP, this command can be used to communicate with the FPGAs’ debug registers.
Warning
This method is deprecated and untested due to no known use.
Parameters: - x (int) – The x-coordinate of the chip whose neighbour is to be written to
- y (int) – The y-coordinate of the chip whose neighbour is to be written to
- link (int) – The link index to send the request to (or if BMP, the FPGA number)
- base_address (int) – The address in SDRAM where the region of memory is to be written
- data (RawIOBase or bytes or bytearray or int) –
The data to write. Should be one of the following:
- An instance of RawIOBase
- A bytearray/bytes
- A single integer; will be written in little-endian byte order
- n_bytes (int) –
The amount of data to be written in bytes. If not specified:
- If data is an RawIOBase, an error is raised
- If data is a bytearray, the length of the bytearray will be used
- If data is an int, 4 will be used
- offset (int) – The offset where the valid data starts (if data is an int then offset will be ignored and used 0)
- cpu (int) – The CPU to use, typically 0 (or if a BMP, the slot number)
Raises: - SpinnmanIOException –
- If there is an error communicating with the board
- If there is an error reading the data
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException –
- If x, y does not lead to a valid chip
- If a packet is received that has invalid parameters
- If base_address is not a positive integer
- If data is an RawIOBase but n_bytes is not specified
- If data is an int and n_bytes is more than 4
- If n_bytes is less than 0
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
write_user_0
(x, y, p, value)[source]¶ Write to the user_0 register for the given processor.
Note
Conventionally, user_0 usually holds the address of the table of memory regions.
Parameters: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If x, y, p does not identify a valid processor
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
write_user_1
(x, y, p, value)[source]¶ Write to the user_1 register for the given processor.
Parameters: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If x, y, p does not identify a valid processor
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
-
spinnman.transceiver.
create_transceiver_from_hostname
(hostname, version, bmp_connection_data=None, number_of_boards=None, auto_detect_bmp=False)[source]¶ Create a Transceiver by creating a
UDPConnection
to the given hostname on port 17893 (the default SCAMP port), and aBootConnection
on port 54321 (the default boot port), optionally discovering any additional links using the UDPConnection, and then returning the transceiver created with the conjunction of the created UDPConnection and the discovered connections.Parameters: - hostname (str or None) – The hostname or IP address of the board or None if only the BMP conenctions are of interest
- number_of_boards (int or None) – a number of boards expected to be supported, or
None
, which defaults to a single board - version (int) – the type of SpiNNaker board used within the SpiNNaker machine being used. If a spinn-5 board, then the version will be 5, spinn-3 would equal 3 and so on.
- bmp_connection_data (list(BMPConnectionData)) – the details of the BMP connections used to boot multi-board systems
- auto_detect_bmp (bool) –
True
if the BMP of version 4 or 5 boards should be automatically determined from the board IP address - scamp_connections – the list of connections used for SCAMP communications
Returns: The created transceiver
Return type: Raises: - SpinnmanIOException – If there is an error communicating with the board
- SpinnmanInvalidPacketException – If a packet is received that is not in the valid format
- SpinnmanInvalidParameterException – If a packet is received that has invalid parameters
- SpinnmanUnexpectedResponseCodeException – If a response indicates an error during the exchange
Module contents¶
Used to communicate with a SpiNNaker Board. The main part of this package is
the Transceiver
class. This can be used to
send and receive packets in various SpiNNaker formats, depending on what
connections are available.
Functional Requirements¶
- Connect to and communicate with a machine using a number of different connections.
- Boot a machine with the expected version of the software.
- If the machine is already booted but the version is not the version expected, an exception will be thrown.
- Check the version of the software which the machine is booted with.
- Query the state of the machine to determine:
- What the current state of the machine is in terms of the chips and cores available, the SDRAM available on the chips and which links are available between which chips.
- What external links to the host exist (and separately add the discovered links to the set of links used to communicate with the machine).
- What is running on the machine and where, and what the current status of those processes are.
- How many cores are in a given state.
- What is in the IOBUF buffers.
- What the current routing entries for a given router are.
- What the routing status counter values are.
- Load application binaries on to the machine, either to individual cores or via a “flood-fill” mechanism to multiple cores simultaneously (which may be a subset of the cores on a subset of the chips).
- Write data to SDRAM, either on an individual chip, or via a “flood-fill” mechanism to multiple chips simultaneously.
- Send a signal to an application.
- Read data from SDRAM on an individual chip.
- Send and receive SpiNNaker packets where the connections allow this.
- If no connection supports this packet type, an exception is thrown.
- The user should be able to select which connection is used. Selection of a connection which does not support the traffic type will also result in an exception.
- Send and receive SCP and SDP packets where the connections allow this.
- If no connection supports the packet type, an exception is thrown.
- The user should be able to select which connection is used. Selection of a connection which does not support the traffic type will also result in an exception.
- It should be possible to call any of the functions simultaneously,
including the same function more than once.
- Where possible, multiple connections should be used to overlap calls.
- The functions should not return until they have confirmed that any messages sent have been received, and any responses have been received.
- Functions should not respond with the result of a different function.
- Functions can further sub-divide the call into a number of separate calls that can be divided across the available connections, so long as the other requirements are met.
- More than one machine can be connected to the same host.
- Once the subset of connections has been worked out for each machine, the operation of these machines should be independent.
Use Cases¶
- Connecting is done by using
create_transceiver_from_hostname()
. boot_board()
andget_scamp_version()
are used to ensure that the board is booted correctly before starting a simulation.get_machine_details()
is used to get a representation of the current state of the machine, which is used to decide where executables are to be run on the board for a particular simulation, where any external peripherals are connected, and how messages between the executables and/or the external peripherals are to be routed.write_memory()
andexecute()
are used to write parameters and execute executables on the boardsend_signal()
is used to send a signal which starts, stops or pauses a simulation.get_core_state_count()
is used to determine if a simulation is complete or has gone into an error state.get_iobuf()
,get_cpu_information()
andget_router_diagnostics()
are used to diagnose a problem with a simulation.read_memory()
is used to read some statistics recorded in SDRAM after a simulation.