spinnman.transceiver package¶
Submodules¶
spinnman.transceiver.base_transceiver module¶
- class spinnman.transceiver.base_transceiver.BaseTransceiver(connections: Iterable[Connection] | None = None, power_cycle: bool = False)[source]¶
Bases:
ExtendableTransceiver
A base for all the code shared by all Version of the Transceiver.
- Parameters:
connections – An iterable of connections to the board. If not specified, no communication will be possible until connections are found.
power_cycle – If True will power cycle the machine:
- 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_cpu_information_from_core(cpu_infos: CPUInfos, x: int, y: int, p: int, states: Iterable[CPUState]) None [source]¶
Adds information about a specific processor on the board to the info
- Parameters:
cpu_infos – Info to add data for this core to
x – The x-coordinate of the chip containing the processor
y – The y-coordinate of the chip containing the processor
p – The ID of the processor to get the information about
states – If provided will only add the info if in one of the states
- Returns:
The CPU information for the selected core
- 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
- add_scamp_connections(connections: Dict[Tuple[int, int], str]) None [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 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
- property bmp_selector: FixedConnectionSelector[BMPConnection] | None¶
Returns the BMP selector
- clear_ip_tag(tag: int, board_address: str | None = None) None [source]¶
Clear the setting of an IP tag.
- Parameters:
tag – The tag ID
board_address – Board address where the tag should be cleared. If not specified, all AbstractSCPConnection connections will send the message to clear the tag
- 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(xy: Tuple[int, int] | None = None) None [source]¶
Remove all the multicast routes on a chip.
- Parameters:
xy – Optional chip to clear the multicast routes on. If not specified, all chips will have their multicast routes cleared.
- 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(xy: Tuple[int, int] | None = None) None [source]¶
Clear router diagnostic information on a chip.
- Parameters:
xy – The optional XY coordinate of the chip to clear the counters on. If not specified, all chips will have their counters cleared.
- 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: bool) None [source]¶
Control the synchronisation of the chips.
- Parameters:
do_sync – Whether to synchronise or not
- discover_scamp_connections() None [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
- execute_flood(core_subsets: CoreSubsets, executable: BinaryIO | bytes | str, app_id: int, *, n_bytes: int | None = None, wait: bool = False) None [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 – Which cores on which chips to start the executable
executable – The data that is to be executed. Should be one of the following: * An instance of RawIOBase * A bytearray * A filename of an executable
app_id – The ID of the application with which to associate the executable
n_bytes –
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 a str, the length of the file will be used
wait – True if the processors should enter a “wait” state on loading
- Raises:
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
- get_clock_drift(x: int, y: int) float [source]¶
Get the clock drift.
- Parameters:
x – The x-coordinate of the chip to get drift for
y – The y-coordinate of the chip to get drift for
- get_connections() Set[Connection] [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
- get_core_state_count(app_id: int, state: CPUState, xys: Iterable[Tuple[int, int]] | None = None) int [source]¶
Get a count of the number of cores which have a given state.
- Parameters:
app_id – The ID of the application from which to get the count.
state – The state count to get
xys – The chips to query, or None for all
- Returns:
A count of the cores with the given status
- 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_cpu_infos(core_subsets: CoreSubsets | None = None, states: CPUState | Iterable[CPUState] | None = None, include: bool = True) CPUInfos [source]¶
Get information about the processors on the board.
- Parameters:
core_subsets – 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.
states – The state or states to filter on (if any)
include – If True includes only infos in the requested state(s). If False includes only infos not in the requested state(s). Ignored if states is None.
- Returns:
The CPU information for the selected cores and States, or all cores/states if core_subsets/states is not specified
- 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(core_subsets: CoreSubsets | None = None) Iterable[IOBuffer] [source]¶
Get the contents of the IOBUF buffer for a number of processors.
- Parameters:
core_subsets – 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
- 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() Machine [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
- 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: int, y: int, app_id: int | None = None) List[MulticastRoutingEntry] [source]¶
Get the current multicast routes set up on a chip.
- Parameters:
x – The x-coordinate of the chip from which to get the routes
y – The y-coordinate of the chip from which to get the routes
app_id – The ID of the application to filter the routes for. If not specified, will return all routes
- Returns:
An iterable of multicast routes
- 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_region_base_address(x: int, y: int, p: int) int [source]¶
Gets the base address of the Region Table
- Parameters:
x – The x-coordinate of the chip containing the processor
y – The y-coordinate of the chip containing the processor
p – The ID of the processor to get the address
- Returns:
The address of the Region table for the selected core
- 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_router_diagnostics(x: int, y: int) RouterDiagnostics [source]¶
Get router diagnostic information from a chip.
- Parameters:
x – The x-coordinate of the chip from which to get the information
y – The y-coordinate of the chip from which to get the information
- Returns:
The router diagnostic information
- 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_connection_selector() MostDirectConnectionSelector [source]¶
Returns the most direct scamp connections
- get_tags(connection: SCAMPConnection | None = None) Iterable[AbstractTag] [source]¶
Get the current set of tags that have been set on the board.
- Parameters:
connection – 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
- 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
- load_fixed_route(x: int, y: int, fixed_route: RoutingEntry, app_id: int) None [source]¶
Loads a fixed route routing table entry onto a chip’s router.
- Parameters:
x – The x-coordinate of the chip onto which to load the routes
y – The y-coordinate of the chip onto which to load the routes
fixed_route – the route for the fixed route entry on this chip
app_id – 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: int, y: int, routes: Collection[MulticastRoutingEntry], app_id: int) None [source]¶
Load a set of multicast routes on to a chip.
- Parameters:
x – The x-coordinate of the chip onto which to load the routes
y – The y-coordinate of the chip onto which to load the routes
routes – An iterable of multicast routes to load
app_id – 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
- malloc_sdram(x: int, y: int, size: int, app_id: int, tag: int = 0) int [source]¶
Allocates a chunk of SDRAM on a chip on the machine.
- Parameters:
x – The x-coordinate of the chip onto which to ask for memory
y – The y-coordinate of the chip onto which to ask for memory
size – the amount of memory to allocate in bytes
app_id – The ID of the application with which to associate the routes. If not specified, defaults to 0.
tag – 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
- malloc_sdram_multi(allocations: List[Tuple[int, int, int, int, int]]) List[int] [source]¶
Allocate space in the SDRAM space for multiple chips
- Parameters:
allocations – List of (x, y, size, app_id, tag)
- Returns:
List of base addresses that match each of the requests
- read_bmp_version(board: int) VersionInfo [source]¶
Read the BMP version.
- Parameters:
board – which board to request the data from
- Returns:
the version_info from the BMP
- read_fixed_route(x: int, y: int, app_id: int) RoutingEntry [source]¶
Reads a fixed route routing table entry from a chip’s router.
- Parameters:
x – The x-coordinate of the chip onto which to load the routes
y – The y-coordinate of the chip onto which to load the routes
app_id – 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: int, register: int, board: int = 0) int [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 – FPGA number (0, 1 or 2) to communicate with.
register – Register address to read to (will be rounded down to the nearest 32-bit word boundary).
board – which board to request the FPGA register from
- Returns:
the register data
- read_memory(x: int, y: int, base_address: int, length: int, cpu: int = 0) bytearray [source]¶
Read some areas of memory (usually SDRAM) from the board.
- Parameters:
x – The x-coordinate of the chip where the memory is to be read from
y – The y-coordinate of the chip where the memory is to be read from
base_address – The address in SDRAM where the region of memory to be read starts
length – The length of the data to be read in bytes
cpu – 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
- 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(x: int, y: int, p: int, user: UserRegister) int [source]¶
Get the contents of the this user register for the given processor.
Note
Conventionally, user_0 usually holds the address of the table of memory regions.
- Parameters:
x – X coordinate of the chip
y – Y coordinate of the chip
p – Virtual processor identifier on the chip
user – The user number to read data for
- 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: int, y: int, base_address: int, cpu: int = 0) int [source]¶
Read a word (usually of SDRAM) from the board.
- Parameters:
x – The x-coordinate of the chip where the word is to be read from
y – The y-coordinate of the chip where the word is to be read from
base_address – The address (usually in SDRAM) where the word to be read starts
cpu – 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
- 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
- property scamp_connection_selector: MostDirectConnectionSelector¶
Returns the scamp selector
- send_chip_update_provenance_and_exit(x: int, y: int, p: int) None [source]¶
Sends a signal to update the provenance and exit
- Parameters:
x
y
p
- send_sdp_message(message: SDPMessage, connection: SDPConnection | None = None) None [source]¶
Sends an SDP message using one of the connections.
- Parameters:
message – The message to send
connection – An optional connection to use
- send_signal(app_id: int, signal: Signal) None [source]¶
Send a signal to an application.
- Parameters:
app_id – The ID of the application to send to
signal – The signal to send
- 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: IPTag, use_sender: bool = False) None [source]¶
Set up an IP tag.
- Parameters:
ip_tag –
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
- 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_reverse_ip_tag(reverse_ip_tag: ReverseIPTag) None [source]¶
Set up a reverse IP tag.
- Parameters:
reverse_ip_tag –
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: int, y: int, position: int, diagnostic_filter: DiagnosticFilter) None [source]¶
Sets a router diagnostic filter in a router.
- Parameters:
x – The X address of the router in which this filter is being set.
y – The Y address of the router in which this filter is being set.
position – The position in the list of filters where this filter is to be added.
diagnostic_filter –
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:
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
- stop_application(app_id: int) None [source]¶
Sends a stop request for an app_id.
- Parameters:
app_id – 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
- update_provenance_and_exit(x: int, y: int, p: int) None [source]¶
Sends a command to update provenance and exit
- Parameters:
x – The x-coordinate of the core
y – The y-coordinate of the core
p – The processor on the core
- wait_for_cores_to_be_in_state(all_core_subsets: CoreSubsets, app_id: int, cpu_states: CPUState | Iterable[CPUState], *, timeout: float | None = None, time_between_polls: float = 0.1, error_states: FrozenSet[CPUState] = frozenset({CPUState.RUN_TIME_EXCEPTION, CPUState.WATCHDOG}), counts_between_full_check: int = 100, progress_bar: ProgressBar | None = None) 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 – 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
progress_bar – Possible progress bar to update.
- Raises:
SpinnmanTimeoutException – If a timeout is specified and exceeded.
- write_fpga_register(fpga_num: int, register: int, value: int, board: int = 0) None [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 – FPGA number (0, 1 or 2) to communicate with.
register – Register address to read to (will be rounded down to the nearest 32-bit word boundary).
value – the value to write into the FPGA register
board – which board to write the FPGA register to
- write_memory(x: int, y: int, base_address: int, data: BinaryIO | bytes | int | str, *, n_bytes: int | None = None, offset: int = 0, cpu: int = 0, get_sum: bool = False) Tuple[int, int] [source]¶
Write to the SDRAM on the board.
- Parameters:
x – The x-coordinate of the chip where the memory is to be written to
y – The y-coordinate of the chip where the memory is to be written to
base_address – The address in SDRAM where the region of memory is to be written
data –
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 string - the filename of a data file
n_bytes –
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 – The offset from which the valid data begins
cpu – The optional CPU to write to
get_sum – whether to return a checksum or 0
- Returns:
The number of bytes written, the checksum (0 if get_sum=False)
- Raises:
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(x: int, y: int, p: int, user: UserRegister, value: int) None [source]¶
Write to the user N “register” for the given processor.
Note
Conventionally, user_0 usually holds the address of the table of memory regions.
- Parameters:
x – X coordinate of the chip
y – Y coordinate of the chip
p – Virtual processor identifier on the chip
user – The user “register” number of write data for
value – The value to write
- 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_many(values: List[Tuple[int, int, int, UserRegister, int]], description: str | None = None) None [source]¶
Write to the user N “register” for each of the given processors
- Parameters:
values – List of (x, y, p, register, value) to write
description – Optional description of what is being written for progress bar
- 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.extendable_transceiver module¶
- class spinnman.transceiver.extendable_transceiver.ExtendableTransceiver[source]¶
Bases:
Transceiver
Support Functions to allow a Transceiver to also be an ExtendedTransceiver
If supporting these is too difficult the methods that require these may be removed.
- abstract property bmp_selector: FixedConnectionSelector[BMPConnection] | None¶
Returns the BMP selector
- abstract property scamp_connection_selector: ConnectionSelector¶
Returns the scamp selector
spinnman.transceiver.version3transceiver module¶
- class spinnman.transceiver.version3transceiver.Version3Transceiver(connections: Iterable[Connection] | None = None, power_cycle: bool = False)[source]¶
Bases:
BaseTransceiver
Implementation of the Transceiver classes for Version 3 boards
This class should ONLY be created via by transceiver_factory.py
- Parameters:
connections – An iterable of connections to the board. If not specified, no communication will be possible until connections are found.
power_cycle – If True will power cycle the machine:
- 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
spinnman.transceiver.version5transceiver module¶
- class spinnman.transceiver.version5transceiver.Version5Transceiver(connections: Iterable[Connection] | None = None, power_cycle: bool = False)[source]¶
Bases:
BaseTransceiver
Implementation of the Transceiver classes for Version 5 boards
This class should ONLY be created via by transceiver_factory.py
- Parameters:
connections – An iterable of connections to the board. If not specified, no communication will be possible until connections are found.
power_cycle – If True will power cycle the machine:
- 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
spinnman.transceiver.virtual5transceiver module¶
- class spinnman.transceiver.virtual5transceiver.Virtual5Transceiver(connections: Iterable[Connection] | None = None, power_cycle: bool = False)[source]¶
Bases:
Version5Transceiver
Overwrites the standard Version 5 Transceiver to intercept the sending of messages.
This is just enough different to pass know tests. Extend for new tests!
- Parameters:
connections – An iterable of connections to the board. If not specified, no communication will be possible until connections are found.
power_cycle – If True will power cycle the machine:
- 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
- get_cpu_infos(core_subsets: CoreSubsets | None = None, states: CPUState | Iterable[CPUState] | None = None, include: bool = True) CPUInfos [source]¶
Get information about the processors on the board.
- Parameters:
core_subsets – 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.
states – The state or states to filter on (if any)
include – If True includes only infos in the requested state(s). If False includes only infos not in the requested state(s). Ignored if states is None.
- Returns:
The CPU information for the selected cores and States, or all cores/states if core_subsets/states is not specified
- 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() Machine [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
- 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
- read_memory(x: int, y: int, base_address: int, length: int, cpu: int = 0) bytearray [source]¶
Read some areas of memory (usually SDRAM) from the board.
- Parameters:
x – The x-coordinate of the chip where the memory is to be read from
y – The y-coordinate of the chip where the memory is to be read from
base_address – The address in SDRAM where the region of memory to be read starts
length – The length of the data to be read in bytes
cpu – 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
- 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
Module contents¶
- class spinnman.transceiver.MockableTransceiver¶
Bases:
ExtendableTransceiver
A based for Mock Transceivers
- add_cpu_information_from_core(cpu_infos: CPUInfos, x: int, y: int, p: int, states: Iterable[CPUState]) None [source]¶
Adds information about a specific processor on the board to the info
- Parameters:
cpu_infos – Info to add data for this core to
x – The x-coordinate of the chip containing the processor
y – The y-coordinate of the chip containing the processor
p – The ID of the processor to get the information about
states – If provided will only add the info if in one of the states
- Returns:
The CPU information for the selected core
- 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
- add_scamp_connections(connections: Dict[Tuple[int, int], str]) None [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 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
- property bmp_selector: FixedConnectionSelector[BMPConnection] | None¶
Returns the BMP selector
- clear_ip_tag(tag: int, board_address: str | None = None) None [source]¶
Clear the setting of an IP tag.
- Parameters:
tag – The tag ID
board_address – Board address where the tag should be cleared. If not specified, all AbstractSCPConnection connections will send the message to clear the tag
- 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(xy: Tuple[int, int] | None = None) None [source]¶
Remove all the multicast routes on a chip.
- Parameters:
xy – Optional chip to clear the multicast routes on. If not specified, all chips will have their multicast routes cleared.
- 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(xy: Tuple[int, int] | None = None) None [source]¶
Clear router diagnostic information on a chip.
- Parameters:
xy – The optional XY coordinate of the chip to clear the counters on. If not specified, all chips will have their counters cleared.
- 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: bool) None [source]¶
Control the synchronisation of the chips.
- Parameters:
do_sync – Whether to synchronise or not
- discover_scamp_connections() None [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
- execute_flood(core_subsets: CoreSubsets, executable: BinaryIO | bytes | str, app_id: int, *, n_bytes: int | None = None, wait: bool = False) None [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 – Which cores on which chips to start the executable
executable – The data that is to be executed. Should be one of the following: * An instance of RawIOBase * A bytearray * A filename of an executable
app_id – The ID of the application with which to associate the executable
n_bytes –
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 a str, the length of the file will be used
wait – True if the processors should enter a “wait” state on loading
- Raises:
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
- get_clock_drift(x: int, y: int) float [source]¶
Get the clock drift.
- Parameters:
x – The x-coordinate of the chip to get drift for
y – The y-coordinate of the chip to get drift for
- get_connections() Set[Connection] [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
- get_core_state_count(app_id: int, state: CPUState, xys: Iterable[Tuple[int, int]] | None = None) int [source]¶
Get a count of the number of cores which have a given state.
- Parameters:
app_id – The ID of the application from which to get the count.
state – The state count to get
xys – The chips to query, or None for all
- Returns:
A count of the cores with the given status
- 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_cpu_infos(core_subsets: CoreSubsets | None = None, states: CPUState | Iterable[CPUState] | None = None, include: bool = True) CPUInfos [source]¶
Get information about the processors on the board.
- Parameters:
core_subsets – 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.
states – The state or states to filter on (if any)
include – If True includes only infos in the requested state(s). If False includes only infos not in the requested state(s). Ignored if states is None.
- Returns:
The CPU information for the selected cores and States, or all cores/states if core_subsets/states is not specified
- 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(core_subsets: CoreSubsets | None = None) Iterable[IOBuffer] [source]¶
Get the contents of the IOBUF buffer for a number of processors.
- Parameters:
core_subsets – 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
- 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() Machine [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
- 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: int, y: int, app_id: int | None = None) List[MulticastRoutingEntry] [source]¶
Get the current multicast routes set up on a chip.
- Parameters:
x – The x-coordinate of the chip from which to get the routes
y – The y-coordinate of the chip from which to get the routes
app_id – The ID of the application to filter the routes for. If not specified, will return all routes
- Returns:
An iterable of multicast routes
- 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_region_base_address(x: int, y: int, p: int) int [source]¶
Gets the base address of the Region Table
- Parameters:
x – The x-coordinate of the chip containing the processor
y – The y-coordinate of the chip containing the processor
p – The ID of the processor to get the address
- Returns:
The address of the Region table for the selected core
- 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_router_diagnostics(x: int, y: int) RouterDiagnostics [source]¶
Get router diagnostic information from a chip.
- Parameters:
x – The x-coordinate of the chip from which to get the information
y – The y-coordinate of the chip from which to get the information
- Returns:
The router diagnostic information
- 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_connection_selector() MostDirectConnectionSelector [source]¶
Returns the most direct scamp connections
- get_tags(connection: SCAMPConnection | None = None) Iterable[AbstractTag] [source]¶
Get the current set of tags that have been set on the board.
- Parameters:
connection – 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
- 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
- load_fixed_route(x: int, y: int, fixed_route: RoutingEntry, app_id: int) None [source]¶
Loads a fixed route routing table entry onto a chip’s router.
- Parameters:
x – The x-coordinate of the chip onto which to load the routes
y – The y-coordinate of the chip onto which to load the routes
fixed_route – the route for the fixed route entry on this chip
app_id – 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: int, y: int, routes: Collection[MulticastRoutingEntry], app_id: int) None [source]¶
Load a set of multicast routes on to a chip.
- Parameters:
x – The x-coordinate of the chip onto which to load the routes
y – The y-coordinate of the chip onto which to load the routes
routes – An iterable of multicast routes to load
app_id – 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
- malloc_sdram(x: int, y: int, size: int, app_id: int, tag: int = 0) int [source]¶
Allocates a chunk of SDRAM on a chip on the machine.
- Parameters:
x – The x-coordinate of the chip onto which to ask for memory
y – The y-coordinate of the chip onto which to ask for memory
size – the amount of memory to allocate in bytes
app_id – The ID of the application with which to associate the routes. If not specified, defaults to 0.
tag – 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
- read_bmp_version(board: int) VersionInfo [source]¶
Read the BMP version.
- Parameters:
board – which board to request the data from
- Returns:
the version_info from the BMP
- read_fixed_route(x: int, y: int, app_id: int) RoutingEntry [source]¶
Reads a fixed route routing table entry from a chip’s router.
- Parameters:
x – The x-coordinate of the chip onto which to load the routes
y – The y-coordinate of the chip onto which to load the routes
app_id – 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: int, register: int, board: int = 0) int [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 – FPGA number (0, 1 or 2) to communicate with.
register – Register address to read to (will be rounded down to the nearest 32-bit word boundary).
board – which board to request the FPGA register from
- Returns:
the register data
- read_memory(x: int, y: int, base_address: int, length: int, cpu: int = 0) bytearray [source]¶
Read some areas of memory (usually SDRAM) from the board.
- Parameters:
x – The x-coordinate of the chip where the memory is to be read from
y – The y-coordinate of the chip where the memory is to be read from
base_address – The address in SDRAM where the region of memory to be read starts
length – The length of the data to be read in bytes
cpu – 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
- 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(x: int, y: int, p: int, user: UserRegister) int [source]¶
Get the contents of the this user register for the given processor.
Note
Conventionally, user_0 usually holds the address of the table of memory regions.
- Parameters:
x – X coordinate of the chip
y – Y coordinate of the chip
p – Virtual processor identifier on the chip
user – The user number to read data for
- 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: int, y: int, base_address: int, cpu: int = 0) int [source]¶
Read a word (usually of SDRAM) from the board.
- Parameters:
x – The x-coordinate of the chip where the word is to be read from
y – The y-coordinate of the chip where the word is to be read from
base_address – The address (usually in SDRAM) where the word to be read starts
cpu – 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
- 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
- property scamp_connection_selector: ConnectionSelector¶
Returns the scamp selector
- send_chip_update_provenance_and_exit(x: int, y: int, p: int) None [source]¶
Sends a signal to update the provenance and exit
- Parameters:
x
y
p
- send_sdp_message(message: SDPMessage, connection: SDPConnection | None = None) None [source]¶
Sends an SDP message using one of the connections.
- Parameters:
message – The message to send
connection – An optional connection to use
- send_signal(app_id: int, signal: Signal) None [source]¶
Send a signal to an application.
- Parameters:
app_id – The ID of the application to send to
signal – The signal to send
- 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: IPTag, use_sender: bool = False) None [source]¶
Set up an IP tag.
- Parameters:
ip_tag –
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
- 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_reverse_ip_tag(reverse_ip_tag: ReverseIPTag) None [source]¶
Set up a reverse IP tag.
- Parameters:
reverse_ip_tag –
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: int, y: int, position: int, diagnostic_filter: DiagnosticFilter) None [source]¶
Sets a router diagnostic filter in a router.
- Parameters:
x – The X address of the router in which this filter is being set.
y – The Y address of the router in which this filter is being set.
position – The position in the list of filters where this filter is to be added.
diagnostic_filter –
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:
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
- stop_application(app_id: int) None [source]¶
Sends a stop request for an app_id.
- Parameters:
app_id – 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
- update_provenance_and_exit(x: int, y: int, p: int) None [source]¶
Sends a command to update provenance and exit
- Parameters:
x – The x-coordinate of the core
y – The y-coordinate of the core
p – The processor on the core
- wait_for_cores_to_be_in_state(all_core_subsets: CoreSubsets, app_id: int, cpu_states: CPUState | Iterable[CPUState], *, timeout: float | None = None, time_between_polls: float = 0.1, error_states: FrozenSet[CPUState] = frozenset({CPUState.RUN_TIME_EXCEPTION, CPUState.WATCHDOG}), counts_between_full_check: int = 100, progress_bar: ProgressBar | None = None) 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 – 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
progress_bar – Possible progress bar to update.
- Raises:
SpinnmanTimeoutException – If a timeout is specified and exceeded.
- write_fpga_register(fpga_num: int, register: int, value: int, board: int = 0) None [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 – FPGA number (0, 1 or 2) to communicate with.
register – Register address to read to (will be rounded down to the nearest 32-bit word boundary).
value – the value to write into the FPGA register
board – which board to write the FPGA register to
- write_memory(x: int, y: int, base_address: int, data: BinaryIO | bytes | int | str, *, n_bytes: int | None = None, offset: int = 0, cpu: int = 0, get_sum: bool = False) Tuple[int, int] [source]¶
Write to the SDRAM on the board.
- Parameters:
x – The x-coordinate of the chip where the memory is to be written to
y – The y-coordinate of the chip where the memory is to be written to
base_address – The address in SDRAM where the region of memory is to be written
data –
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 string - the filename of a data file
n_bytes –
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 – The offset from which the valid data begins
cpu – The optional CPU to write to
get_sum – whether to return a checksum or 0
- Returns:
The number of bytes written, the checksum (0 if get_sum=False)
- Raises:
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(x: int, y: int, p: int, user: UserRegister, value: int) None [source]¶
Write to the user N “register” for the given processor.
Note
Conventionally, user_0 usually holds the address of the table of memory regions.
- Parameters:
x – X coordinate of the chip
y – Y coordinate of the chip
p – Virtual processor identifier on the chip
user – The user “register” number of write data for
value – The value to write
- 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
- written_memory¶
- class spinnman.transceiver.Transceiver¶
Bases:
object
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.
- abstractmethod add_cpu_information_from_core(cpu_infos: CPUInfos, x: int, y: int, p: int, states: Iterable[CPUState]) None [source]¶
Adds information about a specific processor on the board to the info
- Parameters:
cpu_infos – Info to add data for this core to
x – The x-coordinate of the chip containing the processor
y – The y-coordinate of the chip containing the processor
p – The ID of the processor to get the information about
states – If provided will only add the info if in one of the states
- Returns:
The CPU information for the selected core
- 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
- abstractmethod add_scamp_connections(connections: Dict[Tuple[int, int], str]) None [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 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
- abstractmethod clear_ip_tag(tag: int, board_address: str | None = None) None [source]¶
Clear the setting of an IP tag.
- Parameters:
tag – The tag ID
board_address – Board address where the tag should be cleared. If not specified, all AbstractSCPConnection connections will send the message to clear the tag
- 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
- abstractmethod clear_multicast_routes(xy: Tuple[int, int] | None = None) None [source]¶
Remove all the multicast routes on a chip.
- Parameters:
xy – Optional chip to clear the multicast routes on. If not specified, all chips will have their multicast routes cleared.
- 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
- abstractmethod clear_router_diagnostic_counters(xy: Tuple[int, int] | None = None) None [source]¶
Clear router diagnostic information on a chip.
- Parameters:
xy – The optional XY coordinate of the chip to clear the counters on. If not specified, all chips will have their counters cleared.
- 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
- abstractmethod control_sync(do_sync: bool) None [source]¶
Control the synchronisation of the chips.
- Parameters:
do_sync – Whether to synchronise or not
- abstractmethod discover_scamp_connections() None [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
- abstractmethod execute_flood(core_subsets: CoreSubsets, executable: BinaryIO | bytes | str, app_id: int, *, n_bytes: int | None = None, wait: bool = False) None [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 – Which cores on which chips to start the executable
executable – The data that is to be executed. Should be one of the following: * An instance of RawIOBase * A bytearray * A filename of an executable
app_id – The ID of the application with which to associate the executable
n_bytes –
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 a str, the length of the file will be used
wait – True if the processors should enter a “wait” state on loading
- Raises:
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
- abstractmethod get_clock_drift(x: int, y: int) float [source]¶
Get the clock drift.
- Parameters:
x – The x-coordinate of the chip to get drift for
y – The y-coordinate of the chip to get drift for
- abstractmethod get_connections() Set[Connection] [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
- abstractmethod get_core_state_count(app_id: int, state: CPUState, xys: Iterable[Tuple[int, int]] | None = None) int [source]¶
Get a count of the number of cores which have a given state.
- Parameters:
app_id – The ID of the application from which to get the count.
state – The state count to get
xys – The chips to query, or None for all
- Returns:
A count of the cores with the given status
- 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
- abstractmethod get_cpu_infos(core_subsets: CoreSubsets | None = None, states: CPUState | Iterable[CPUState] | None = None, include: bool = True) CPUInfos [source]¶
Get information about the processors on the board.
- Parameters:
core_subsets – 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.
states – The state or states to filter on (if any)
include – If True includes only infos in the requested state(s). If False includes only infos not in the requested state(s). Ignored if states is None.
- Returns:
The CPU information for the selected cores and States, or all cores/states if core_subsets/states is not specified
- 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
- abstractmethod get_iobuf(core_subsets: CoreSubsets | None = None) Iterable[IOBuffer] [source]¶
Get the contents of the IOBUF buffer for a number of processors.
- Parameters:
core_subsets – 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
- 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
- abstractmethod get_machine_details() Machine [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
- 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
- abstractmethod get_multicast_routes(x: int, y: int, app_id: int | None = None) List[MulticastRoutingEntry] [source]¶
Get the current multicast routes set up on a chip.
- Parameters:
x – The x-coordinate of the chip from which to get the routes
y – The y-coordinate of the chip from which to get the routes
app_id – The ID of the application to filter the routes for. If not specified, will return all routes
- Returns:
An iterable of multicast routes
- 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
- abstractmethod get_region_base_address(x: int, y: int, p: int) int [source]¶
Gets the base address of the Region Table
- Parameters:
x – The x-coordinate of the chip containing the processor
y – The y-coordinate of the chip containing the processor
p – The ID of the processor to get the address
- Returns:
The address of the Region table for the selected core
- 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
- abstractmethod get_router_diagnostics(x: int, y: int) RouterDiagnostics [source]¶
Get router diagnostic information from a chip.
- Parameters:
x – The x-coordinate of the chip from which to get the information
y – The y-coordinate of the chip from which to get the information
- Returns:
The router diagnostic information
- 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
- abstractmethod get_scamp_connection_selector() MostDirectConnectionSelector [source]¶
Returns the most direct scamp connections
- abstractmethod get_tags(connection: SCAMPConnection | None = None) Iterable[AbstractTag] [source]¶
Get the current set of tags that have been set on the board.
- Parameters:
connection – 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
- 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
- abstractmethod load_fixed_route(x: int, y: int, fixed_route: RoutingEntry, app_id: int) None [source]¶
Loads a fixed route routing table entry onto a chip’s router.
- Parameters:
x – The x-coordinate of the chip onto which to load the routes
y – The y-coordinate of the chip onto which to load the routes
fixed_route – the route for the fixed route entry on this chip
app_id – 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
- abstractmethod load_multicast_routes(x: int, y: int, routes: Collection[MulticastRoutingEntry], app_id: int) None [source]¶
Load a set of multicast routes on to a chip.
- Parameters:
x – The x-coordinate of the chip onto which to load the routes
y – The y-coordinate of the chip onto which to load the routes
routes – An iterable of multicast routes to load
app_id – 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
- abstractmethod malloc_sdram(x: int, y: int, size: int, app_id: int, tag: int = 0) int [source]¶
Allocates a chunk of SDRAM on a chip on the machine.
- Parameters:
x – The x-coordinate of the chip onto which to ask for memory
y – The y-coordinate of the chip onto which to ask for memory
size – the amount of memory to allocate in bytes
app_id – The ID of the application with which to associate the routes. If not specified, defaults to 0.
tag – 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
- abstractmethod malloc_sdram_multi(allocations: List[Tuple[int, int, int, int, int]]) List[int] [source]¶
Allocate space in the SDRAM space for multiple chips
- Parameters:
allocations – List of (x, y, size, app_id, tag)
- Returns:
List of base addresses that match each of the requests
- abstractmethod read_bmp_version(board: int) VersionInfo [source]¶
Read the BMP version.
- Parameters:
board – which board to request the data from
- Returns:
the version_info from the BMP
- abstractmethod read_fixed_route(x: int, y: int, app_id: int) RoutingEntry [source]¶
Reads a fixed route routing table entry from a chip’s router.
- Parameters:
x – The x-coordinate of the chip onto which to load the routes
y – The y-coordinate of the chip onto which to load the routes
app_id – 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
- abstractmethod read_fpga_register(fpga_num: int, register: int, board: int = 0) int [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 – FPGA number (0, 1 or 2) to communicate with.
register – Register address to read to (will be rounded down to the nearest 32-bit word boundary).
board – which board to request the FPGA register from
- Returns:
the register data
- abstractmethod read_memory(x: int, y: int, base_address: int, length: int, cpu: int = 0) bytearray [source]¶
Read some areas of memory (usually SDRAM) from the board.
- Parameters:
x – The x-coordinate of the chip where the memory is to be read from
y – The y-coordinate of the chip where the memory is to be read from
base_address – The address in SDRAM where the region of memory to be read starts
length – The length of the data to be read in bytes
cpu – 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
- 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
- abstractmethod read_user(x: int, y: int, p: int, user: UserRegister) int [source]¶
Get the contents of the this user register for the given processor.
Note
Conventionally, user_0 usually holds the address of the table of memory regions.
- Parameters:
x – X coordinate of the chip
y – Y coordinate of the chip
p – Virtual processor identifier on the chip
user – The user number to read data for
- 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
- abstractmethod read_word(x: int, y: int, base_address: int, cpu: int = 0) int [source]¶
Read a word (usually of SDRAM) from the board.
- Parameters:
x – The x-coordinate of the chip where the word is to be read from
y – The y-coordinate of the chip where the word is to be read from
base_address – The address (usually in SDRAM) where the word to be read starts
cpu – 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
- 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
- abstractmethod reset_routing() None [source]¶
Reset routing tables and set up some default diagnostics
- abstractmethod send_chip_update_provenance_and_exit(x: int, y: int, p: int) None [source]¶
Sends a signal to update the provenance and exit
- Parameters:
x
y
p
- abstractmethod send_sdp_message(message: SDPMessage, connection: SDPConnection | None = None) None [source]¶
Sends an SDP message using one of the connections.
- Parameters:
message – The message to send
connection – An optional connection to use
- abstractmethod send_signal(app_id: int, signal: Signal) None [source]¶
Send a signal to an application.
- Parameters:
app_id – The ID of the application to send to
signal – The signal to send
- 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
- abstractmethod set_ip_tag(ip_tag: IPTag, use_sender: bool = False) None [source]¶
Set up an IP tag.
- Parameters:
ip_tag –
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
- 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
- abstractmethod set_reverse_ip_tag(reverse_ip_tag: ReverseIPTag) None [source]¶
Set up a reverse IP tag.
- Parameters:
reverse_ip_tag –
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
- abstractmethod set_router_diagnostic_filter(x: int, y: int, position: int, diagnostic_filter: DiagnosticFilter) None [source]¶
Sets a router diagnostic filter in a router.
- Parameters:
x – The X address of the router in which this filter is being set.
y – The Y address of the router in which this filter is being set.
position – The position in the list of filters where this filter is to be added.
diagnostic_filter –
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:
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
- abstractmethod stop_application(app_id: int) None [source]¶
Sends a stop request for an app_id.
- Parameters:
app_id – 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
- abstractmethod update_provenance_and_exit(x: int, y: int, p: int) None [source]¶
Sends a command to update provenance and exit
- Parameters:
x – The x-coordinate of the core
y – The y-coordinate of the core
p – The processor on the core
- abstractmethod wait_for_cores_to_be_in_state(all_core_subsets: CoreSubsets, app_id: int, cpu_states: CPUState | Iterable[CPUState], *, timeout: float | None = None, time_between_polls: float = 0.1, error_states: FrozenSet[CPUState] = frozenset({CPUState.RUN_TIME_EXCEPTION, CPUState.WATCHDOG}), counts_between_full_check: int = 100, progress_bar: ProgressBar | None = None) 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 – 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
progress_bar – Possible progress bar to update.
- Raises:
SpinnmanTimeoutException – If a timeout is specified and exceeded.
- abstractmethod write_fpga_register(fpga_num: int, register: int, value: int, board: int = 0) None [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 – FPGA number (0, 1 or 2) to communicate with.
register – Register address to read to (will be rounded down to the nearest 32-bit word boundary).
value – the value to write into the FPGA register
board – which board to write the FPGA register to
- abstractmethod write_memory(x: int, y: int, base_address: int, data: BinaryIO | bytes | int | str, *, n_bytes: int | None = None, offset: int = 0, cpu: int = 0, get_sum: bool = False) Tuple[int, int] [source]¶
Write to the SDRAM on the board.
- Parameters:
x – The x-coordinate of the chip where the memory is to be written to
y – The y-coordinate of the chip where the memory is to be written to
base_address – The address in SDRAM where the region of memory is to be written
data –
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 string - the filename of a data file
n_bytes –
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 – The offset from which the valid data begins
cpu – The optional CPU to write to
get_sum – whether to return a checksum or 0
- Returns:
The number of bytes written, the checksum (0 if get_sum=False)
- Raises:
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
- abstractmethod write_user(x: int, y: int, p: int, user: UserRegister, value: int) None [source]¶
Write to the user N “register” for the given processor.
Note
Conventionally, user_0 usually holds the address of the table of memory regions.
- Parameters:
x – X coordinate of the chip
y – Y coordinate of the chip
p – Virtual processor identifier on the chip
user – The user “register” number of write data for
value – The value to write
- 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_many(values: List[Tuple[int, int, int, UserRegister, int]], description: str | None = None) None [source]¶
Write to the user N “register” for each of the given processors
- Parameters:
values – List of (x, y, p, register, value) to write
description – Optional description of what is being written for progress bar
- 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_connections(connections: Iterable[Connection], virtual: bool = False, power_cycle: bool = False, extended: bool = False) Transceiver ¶
Create a Transceiver with these connections
- Parameters:
connections – An iterable of connections to the board. If not specified, no communication will be possible until connections are found.
virtual – If True will return a virtual Transceiver
power_cycle – If True will power cycle the machine
extended
- Returns:
The created transceiver
- 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
- spinnman.transceiver.create_transceiver_from_hostname(hostname: str | None, *, bmp_connection_data: BMPConnectionData | None = None, auto_detect_bmp: bool = False, power_cycle: bool = False, extended: bool = False) Transceiver ¶
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 – The hostname or IP address of the board or None if only the BMP connections are of interest
bmp_connection_data – the details of the BMP connections used to boot multi-board systems
auto_detect_bmp –
True
if the BMP of version 4 or 5 boards should be automatically determined from the board IP addresspower_cycle – If True will power cycle the machine
extended – If True will return an Extended version of the Transceiver
- Returns:
The created transceiver
- 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