spinnman.extended package

Submodules

spinnman.extended.extended_transceiver module

class spinnman.extended.extended_transceiver.ExtendedTransceiver(version, connections=None)[source]

Bases: spinnman.transceiver.Transceiver

An encapsulation of various communications with the SpiNNaker board.

The methods of this class are designed to be thread-safe (provided they do not access a BMP, as access to those is never thread-safe); thus you can make multiple calls to the same (or different) methods from multiple threads and expect each call to work as if it had been called sequentially, although the order of returns is not guaranteed.

Note

With multiple connections to the board, using multiple threads in this way may result in an increase in the overall speed of operation, since the multiple calls may be made separately over the set of given connections.

Parameters:
  • version (int) – The version of the board being connected to
  • connections (list(Connection)) – An iterable of connections to the board. If not specified, no communication will be possible until connections are found.
Raises:
execute(x, y, processors, executable, app_id, n_bytes=None, wait=False, is_filename=False)[source]

Start an executable running on a single chip.

Warning

This method is currently deprecated and likely to be removed.

Parameters:
  • x (int) – The x-coordinate of the chip on which to run the executable
  • y (int) – The y-coordinate of the chip on which to run the executable
  • processors (list(int)) – The cores on the chip on which to run the application
  • executable (RawIOBase or bytes or bytearray or str) –

    The data that is to be executed. Should be one of the following:

    • An instance of RawIOBase
    • A bytearray/bytes
    • A filename of a file containing the executable (in which case is_filename must be set to True)
  • app_id (int) – The ID of the application with which to associate the executable
  • n_bytes (int) –

    The size of the executable data in bytes. If not specified:

    • If executable is an RawIOBase, an error is raised
    • If executable is a bytearray, the length of the bytearray will be used
    • If executable is an int, 4 will be used
    • If executable is a str, the length of the file will be used
  • wait (bool) – True if the binary should enter a “wait” state on loading
  • is_filename (bool) – True if executable is a filename
Raises:
execute_application(executable_targets, app_id)[source]

Execute a set of binaries that make up a complete application on specified cores, wait for them to be ready and then start all of the binaries.

Note

This will get the binaries into c_main but will not signal the barrier.

Parameters:
  • executable_targets (ExecutableTargets) – The binaries to be executed and the cores to execute them on
  • app_id (int) – The app_id to give this application
free_sdram(x, y, base_address, app_id)[source]

Free allocated SDRAM.

Warning

This method is currently deprecated and likely to be removed.

Parameters:
  • x (int) – The x-coordinate of the chip onto which to ask for memory
  • y (int) – The y-coordinate of the chip onto which to ask for memory
  • base_address (int) – The base address of the allocated memory
  • app_id (int) – The app ID of the allocated memory
free_sdram_by_app_id(x, y, app_id)[source]

Free all SDRAM allocated to a given app ID.

Warning

This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.

Parameters:
  • x (int) – The x-coordinate of the chip onto which to ask for memory
  • y (int) – The y-coordinate of the chip onto which to ask for memory
  • app_id (int) – The app ID of the allocated memory
Returns:

The number of blocks freed

Return type:

int

get_connections()[source]

Get the currently known connections to the board, made up of those passed in to the transceiver and those that are discovered during calls to discover_connections. No further discovery is done here.

Returns:An iterable of connections known to the transceiver
Return type:list(Connection)
get_heap(x, y, heap=<SystemVariableDefinition.sdram_heap_address: _Definition(offset=76, data_type=<_DataType.INT: 4>, default=0, array_size=None, doc='The base address of the user SDRAM heap')>)[source]

Get the contents of the given heap on a given chip.

Parameters:
  • x (int) – The x-coordinate of the chip
  • y (int) – The y-coordinate of the chip
  • heap (SystemVariableDefinition) – The SystemVariableDefinition which is the heap to read
Return type:

list(HeapElement)

get_iobuf_from_core(x, y, p)[source]

Get the contents of IOBUF for a given core.

Warning

This method is currently deprecated and likely to be removed.

Parameters:
  • x (int) – The x-coordinate of the chip containing the processor
  • y (int) – The y-coordinate of the chip containing the processor
  • p (int) – The ID of the processor to get the IOBUF for
Returns:

An IOBUF buffer

Return type:

IOBuffer

Raises:
get_router_diagnostic_filter(x, y, position)[source]

Gets a router diagnostic filter from a router.

Parameters:
  • x (int) – the X address of the router from which this filter is being retrieved
  • y (int) – the Y address of the router from which this filter is being retrieved
  • position (int) – the position in the list of filters to read the information from
Returns:

The diagnostic filter read

Return type:

DiagnosticFilter

Raises:
is_connected(connection=None)[source]

Determines if the board can be contacted.

Parameters:connection (Connection) – The connection which is to be tested. If None, all connections will be tested, and the board will be considered to be connected if any one connection works.
Returns:True if the board can be contacted, False otherwise
Return type:bool
number_of_boards_located

The number of boards currently configured.

Warning

This property is currently deprecated and likely to be removed.

Return type:int
read_adc_data(board)[source]

Read the BMP ADC data.

Warning

This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.

Parameters:board (int) – which board to request the ADC data from
Returns:the FPGA’s ADC data object
Return type:ADCInfo
read_neighbour_memory(x, y, link, base_address, length, cpu=0)[source]

Read some areas of memory on a neighbouring chip using a LINK_READ SCP command. If sent to a BMP, this command can be used to communicate with the FPGAs’ debug registers.

Warning

This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.

Parameters:
  • x (int) – The x-coordinate of the chip whose neighbour is to be read from
  • y (int) – The y-coordinate of the chip whose neighbour is to be read from
  • cpu (int) – The CPU to use, typically 0 (or if a BMP, the slot number)
  • link (int) – The link index to send the request to (or if BMP, the FPGA number)
  • base_address (int) – The address in SDRAM where the region of memory to be read starts
  • length (int) – The length of the data to be read in bytes
Returns:

An iterable of chunks of data read in order

Return type:

bytes

Raises:
send_scp_message(message, connection=None)[source]

Sends an SCP message, without expecting a response.

Parameters:
Raises:
set_led(led, action, board)[source]

Set the LED state of a board in the machine.

Warning

This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.

Parameters:
  • led (int or iterable(int)) – Number of the LED or an iterable of LEDs to set the state of (0-7)
  • action (LEDAction) – State to set the LED to, either on, off or toggle
  • board (int or iterable(int)) – Specifies the board to control the LEDs of. This may also be an iterable of multiple boards. The command will actually be sent to the first board in the iterable.
set_leds(x, y, cpu, led_states)[source]

Set LED states.

Warning

The set_leds is deprecated and untested due to no known use.

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

Enable, disable or set the value of the watch dog timer.

Warning

This method is currently deprecated and untested as there is no known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging.

Parameters:watch_dog (bool or int) – Either a boolean indicating whether to enable (True) or disable (False) the watch dog timer, or an int value to set the timer count to.
write_memory_flood(base_address, data, n_bytes=None, offset=0, is_filename=False)[source]

Write to the SDRAM of all chips.

Parameters:
  • base_address (int) – The address in SDRAM where the region of memory is to be written
  • data (RawIOBase or bytes or bytearray or int or str) –

    The data that is to be written. Should be one of the following:

    • An instance of RawIOBase
    • A byte-string
    • A single integer
    • A file name of a file to read (in which case is_filename should be set to True)
  • n_bytes (int) –

    The amount of data to be written in bytes. If not specified:

    • If data is an RawIOBase, an error is raised
    • If data is a bytearray or bytes, the length of the bytearray will be used
    • If data is an int, 4 will be used
    • If data is a str, the size of the file will be used
  • offset (int) – The offset where the valid data starts; if data is an int, then the offset will be ignored and 0 is used.
  • is_filename (bool) – True if data should be interpreted as a file name
Raises:
write_neighbour_memory(x, y, link, base_address, data, n_bytes=None, offset=0, cpu=0)[source]

Write to the memory of a neighbouring chip using a LINK_READ SCP command. If sent to a BMP, this command can be used to communicate with the FPGAs’ debug registers.

Warning

This method is deprecated and untested due to no known use.

Parameters:
  • x (int) – The x-coordinate of the chip whose neighbour is to be written to
  • y (int) – The y-coordinate of the chip whose neighbour is to be written to
  • link (int) – The link index to send the request to (or if BMP, the FPGA number)
  • base_address (int) – The address in SDRAM where the region of memory is to be written
  • data (RawIOBase or bytes or bytearray or int) –

    The data to write. Should be one of the following:

    • An instance of RawIOBase
    • A bytearray/bytes
    • A single integer; will be written in little-endian byte order
  • n_bytes (int) –

    The amount of data to be written in bytes. If not specified:

    • If data is an RawIOBase, an error is raised
    • If data is a bytearray, the length of the bytearray will be used
    • If data is an int, 4 will be used
  • offset (int) – The offset where the valid data starts (if data is an int then offset will be ignored and used 0)
  • cpu (int) – The CPU to use, typically 0 (or if a BMP, the slot number)
Raises:
spinnman.extended.extended_transceiver.create_transceiver_from_hostname(hostname, version, bmp_connection_data=None, number_of_boards=None, auto_detect_bmp=False)[source]

Create a Transceiver by creating a UDPConnection to the given hostname on port 17893 (the default SCAMP port), and a BootConnection on port 54321 (the default boot port), optionally discovering any additional links using the UDPConnection, and then returning the transceiver created with the conjunction of the created UDPConnection and the discovered connections.

Parameters:
  • hostname (str or None) – The hostname or IP address of the board or None if only the BMP connections are of interest
  • number_of_boards (int or None) – a number of boards expected to be supported, or None, which defaults to a single board
  • version (int) – the type of SpiNNaker board used within the SpiNNaker machine being used. If a Spinn-5 board, then the version will be 5, Spinn-3 would equal 3 and so on.
  • bmp_connection_data (list(BMPConnectionData)) – the details of the BMP connections used to boot multi-board systems
  • auto_detect_bmp (bool) – True if the BMP of version 4 or 5 boards should be automatically determined from the board IP address
  • scamp_connections – the list of connections used for SCAMP communications
Returns:

The created transceiver

Return type:

Transceiver

Raises:

Module contents

class spinnman.extended.BMPSetLed(led, action, boards)

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

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

This class is currently deprecated and untested as there is no known use except for Transceiver.set_led which is itself deprecated.

Parameters:
  • led (int or list(int)) – Number of the LED or an iterable of LEDs to set the state of (0-7)
  • action (LEDAction) – State to set the LED to, either on, off or toggle
  • boards (int or list(int)) – Specifies the board to control the LEDs of. This may also be an iterable of multiple boards (in the same frame).
get_scp_response()[source]

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

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.extended.DeAllocSDRAMProcess(connection_selector)

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

Warning

This class is currently deprecated and untested as there is no known use except for Transceiver.free_sdram and free_sdram_by_app_id which are both themselves deprecated.

Parameters:connection_selector (AbstractMultiConnectionProcessConnectionSelector) –
de_alloc_sdram(x, y, app_id, base_address=None)[source]
Parameters:
no_blocks_freed
Return type:int
class spinnman.extended.ReadADC(board)

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

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

This class is currently deprecated and untested as there is no known use except for Transceiver.read_adc_data which is itself deprecated.

Note

The equivalent code in Java is not deprecated.

Parameters:board (int) – which board to request the ADC register from
get_scp_response()[source]

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

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.extended.SetLED(x, y, cpu, led_states)

Bases: spinnman.messages.scp.abstract_messages.AbstractSCPRequest

A request to change the state of an SetLED.

This class is currently deprecated and untested as there is no known use except for Transceiver.set_led which is itself deprecated.

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

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

Returns:An SCP response, or None if no response is required
Return type:AbstractSCPResponse
class spinnman.extended.WriteMemoryFloodProcess(next_connection_selector)

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

A process for writing memory on multiple SpiNNaker chips at once.

write_memory_from_bytearray(nearest_neighbour_id, base_address, data, offset, n_bytes=None)[source]
Parameters:
write_memory_from_reader(nearest_neighbour_id, base_address, reader, n_bytes)[source]
Parameters: