spinnman.utilities package¶
Submodules¶
spinnman.utilities.appid_tracker module¶
- class spinnman.utilities.appid_tracker.AppIdTracker(app_ids_in_use: Iterable[int] | None = None, min_app_id: int = 17, max_app_id: int = 254)[source]¶
Bases:
object
A tracker of application IDs to make it easier to allocate new IDs.
- Parameters:
spinnman.utilities.locate_connected_machine_ip_address module¶
- spinnman.utilities.locate_connected_machine_ip_address.locate_connected_machine(handler: Callable[[str, float], bool]) None [source]¶
Locates any SpiNNaker machines IP addresses from the auto-transmitted packets from non-booted SpiNNaker machines.
- Parameters:
handler (Callable) – A callback that decides whether to stop searching. The callback is given two arguments: the IP address found and the current time. It should return True if the search should cease.
spinnman.utilities.reports module¶
- spinnman.utilities.reports.generate_machine_report(report_directory: str, machine: Machine, connections: List[Connection]) None [source]¶
Generate report on the physical structure of the target SpiNNaker machine.
- Parameters:
report_directory (str) – the directory to which reports are stored
machine (Machine) – the machine python object
connections (list(Connection)) – the list of connections to the machine
- Raises:
IOError – when a file cannot be opened for some reason
spinnman.utilities.socket_utils module¶
Wrappers around socket-related system calls to do exception remapping and apply some consistency to things.
- spinnman.utilities.socket_utils.bind_socket(sock: socket, host: str, port: int) None [source]¶
Wrapper round bind() system call.
- spinnman.utilities.socket_utils.connect_socket(sock: socket, remote_address: str, remote_port: int) None [source]¶
Wrapper round connect() system call.
- spinnman.utilities.socket_utils.get_socket_address(sock: socket) Tuple[str, int] [source]¶
Wrapper round getsockname() system call.
- spinnman.utilities.socket_utils.get_tcp_socket() socket [source]¶
Wrapper round socket() system call to produce TCP/IPv4 sockets.
Note
TCP sockets cannot be used to talk to a SpiNNaker board.
- spinnman.utilities.socket_utils.get_udp_socket() socket [source]¶
Wrapper round socket() system call to produce UDP/IPv4 sockets.
- spinnman.utilities.socket_utils.receive_message(sock: socket, timeout: float | None, size: int) bytes [source]¶
Wrapper round recv() system call.
- spinnman.utilities.socket_utils.receive_message_and_address(sock: socket, timeout: float | None, size: int) Tuple[bytes, Tuple[str, int]] [source]¶
Wrapper round recvfrom() system call.
- spinnman.utilities.socket_utils.resolve_host(host: str) str [source]¶
Wrapper round gethostbyname() system call.
- spinnman.utilities.socket_utils.send_message(sock: socket, data: bytes) int [source]¶
Wrapper round send() system call.
spinnman.utilities.utility_functions module¶
- spinnman.utilities.utility_functions.get_vcpu_address(p: int) int [source]¶
Get the address of the vcpu_t structure for the given core.
- spinnman.utilities.utility_functions.reprogram_tag(connection: SCAMPConnection, tag: int, strip: bool = True) None [source]¶
Reprogram an IP Tag to send responses to a given SCAMPConnection.
- Parameters:
connection (SCAMPConnection) – The connection to target the tag at
tag (int) – The id of the tag to set
strip (bool) – True if the tag should strip SDP headers from outgoing messages
- Raises:
SpinnmanTimeoutException – If things time out several times
- spinnman.utilities.utility_functions.reprogram_tag_to_listener(connection: UDPConnection, x: int, y: int, ip_address: str, tag: int, strip: bool = True, read_response: bool = True) None [source]¶
Reprogram an IP Tag to send responses to a given connection that is not connected to a specific board. Such connections are normally receive-only connections.
- Parameters:
connection (UDPConnection) – The connection to target the tag at
x (int) – The X coordinate of the Ethernet-enabled chip that should send to the connection
y (int) – The Y coordinate of the Ethernet-enabled chip that should send to the connection
ip_address (str) – The IP address of the Ethernet-enabled chip that should be given the message
tag (int) – The id of the tag to set
strip (bool) – True if the tag should strip SDP headers from outgoing messages
read_response (bool) – True if the response to the reprogramming should be read
- Raises:
SpinnmanTimeoutException – If things time out several times
- spinnman.utilities.utility_functions.send_port_trigger_message(connection: UDPConnection, board_address: str) None [source]¶
Sends a port trigger message using a connection to (hopefully) open a port in a NAT and/or firewall to allow incoming packets to be received.
- Parameters:
connection (UDPConnection) – The UDP connection down which the trigger message should be sent
board_address (str) – The IP address of the SpiNNaker board to which the message should be sent
- spinnman.utilities.utility_functions.work_out_bmp_from_machine_details(hostname: str) BMPConnectionData [source]¶
Work out the BMP connection IP address given the machine details. This is assumed to be the IP address of the machine, with 1 subtracted from the final part e.g. if the machine IP address is 192.168.0.5, the BMP IP address is assumed to be 192.168.0.4
- Parameters:
hostname (str) – the SpiNNaker machine main hostname or IP address
- Returns:
The BMP connection data
- Return type: