spinn_machine.version package

Submodules

spinn_machine.version.abstract_version module

class spinn_machine.version.abstract_version.AbstractVersion(max_cores_per_chip: int, max_sdram_per_chip: int)[source]

Bases: object

Base class for the version classes.

Version classes are the main way to create a Machine object of the correct class.

The version classes contain properties that will change depending on the version.

abstract property board_shape: Tuple[int, int]

The width and height of a single board of this type

abstract property chip_core_map: Dict[Tuple[int, int], int]

A map off the expected x,y coordinates on a standard board to the most likely number of cores on that chip.

abstract property clock_speeds_hz: List[int]

The processor clock speeds in Hz this processor can run at

create_machine(width: int | None, height: int | None, origin: str | None = None) Machine[source]

Creates a new empty machine based on the width, height and version.

Parameters:
  • width – The width of the machine excluding any virtual chips

  • height – The height of the machine excluding any virtual chips

  • origin – Extra information about how this machine was created to be used in str(version). Example “Virtual” or “Json

Returns:

A subclass of Machine with no chips in it

Raises:

SpinnMachineInvalidParameterException – If the size is unexpected

abstract property dtcm_bytes: int

The Data Tightly Coupled Memory available on a processor in bytes

property expected_xys: Sequence[Tuple[int, int]]

List of the standard x,y coordinates of chips for this version.

Remember that will the board may have dead or excluded chips.

Returns:

The list of Local X, Y, link, fpga_link_id and fpga_id

These are applied local to each Ethernet Chip and even if the link is connected to another board

abstractmethod get_active_energy(time_s: float, n_frames: int, n_boards: int, n_chips: int, chip_active_time: Dict[Tuple[int, int], Tuple[float, int]], router_packets: Dict[Tuple[int, int], Dict[str, int]]) float[source]

Returns the active energy consumption of the system in joules

Parameters:
  • time_s – The time to calculate the energy for in seconds

  • n_frames – The number of frames

  • n_boards – The number of boards

  • n_chips – The number of chips

  • chip_active_time – The time the cores were active in seconds

  • router_packets – The number of packets sent by each router

abstractmethod get_idle_energy(time_s: float, n_frames: int, n_boards: int, n_chips: int) float[source]

Returns the idle energy consumption of the system in joules

Parameters:
  • time_s – The time to calculate the energy for in seconds

  • n_frames – The number of frames

  • n_boards – The number of boards

  • n_chips – The number of chips

abstractmethod get_potential_ethernet_chips(width: int, height: int) Sequence[Tuple[int, int]][source]

Get the coordinates of chips that should be Ethernet chips.

This may well be passed down to SpiNNakerTriadGeometry.

Note

This methods assumes that width and height would pass verify_size(). If not, the results may be wrong.

Parameters:
  • width – The width of the machine to find the chips in

  • height – The height of the machine to find the chips in

abstractmethod get_router_report_packet_types() List[str][source]

Returns the list of packet types that the router can send

abstractmethod id_to_qx_qy_qp(core_id: int) Tuple[int, int, int][source]

Converts core id to quad coordinates

Parameters:

core_id – id of the core

Returns:

(qx, qy, qp)

Raises:

NotImplementedError – If called on a version that does not support quads

abstractmethod illegal_ethernet_message(x: int, y: int) str | None[source]

Checks if x and y could be for an Ethernet.

This method will return an explanation if the values for x and y are known be illegal for an Ethernet chip.

Due to the limited information available this method will generate False negatives. So this method returning None does not imply that x, y is an Ethernet location

Parameters:
  • x

  • y

Returns:

An explanation that the x and y can never be an Ethernet

property max_cores_per_chip: int

Gets the maximum number of cores per chip for the whole system.

There is no guarantee that there will be any chips with this many cores, only that there will be no cores with more.

property max_sdram_per_chip: int

Gets the maximum SDRAM per chip for the whole system.

While it is likely that all Chips will have this SDRAM this should not be counted on. Ask each Chip for its SDRAM.

Returns:

the default SDRAM per chip

abstract property minimum_cores_expected: int

The minimum number of Chip that we expect from a Chip

If there are less that this number of Cores Machine.validate and other methods are allowed to raise an exception

Returns:

The lowest number of cores to accept before flagging a Chip to be blacklisted

property n_chips_per_board: int

The normal number of chips on each board of this version.

Remember that will the board may have dead or excluded chips.

abstract property n_router_entries: int

The standard number of router entries in a router table.

While it is likely that all chips will have this number it should not be counted on. Ask each chip’s router for the correct value.

abstract property n_scamp_cores: int

The number of scamp cores per chip.

abstract property name: str

The name of the specific version.

abstract property number: int

The version number that produced this Version.

parse_cores_string(core_string: str) Iterable[int][source]

Parses a string representation of a core or cores

The main usage of this method is to support the cfg down_cores.

This may be a single positive int which will be taken as the virtual core id

This may be a single negative int which will be taken as the physical core id

This may be two int values separated by a minus which will be taken as a range of one of the above

Other formats are version specific. See version_parse_cores_string

Parameters:

core_string – A string to parse

Returns:

A list of cores, which might be just one

abstractmethod quads_maps() Dict[int, Tuple[int, int, int]] | None[source]

If applicable returns a map of virtual id to quad qx, qy, qp

Spin 1 boards will return None!

abstractmethod qx_qy_qp_to_id(qx: int, qy: int, qp: int) int[source]

Converts quad coordinates to the core id

Parameters:
  • qx – quad x coordinate of the core

  • qy – quad y coordinate of the core

  • qp – quad p coordinate of the core

Raises:

NotImplementedError – If called on a version that does not support quads

size_from_n_boards(n_boards: int) Tuple[int, int][source]

Returns the size needed to support this many boards.

Parameters:

n_boards

Raises:

SpinnMachineException – If multiple boards are needed but not supported

size_from_n_chips(n_chips: int) Tuple[int, int][source]

Returns the size needed to support this many chips.

Designed for use with virtual boards. Does not include a safety factor for blacklisted Chips. For real machines a slightly bigger Machine may be needed.

Raises:

SpinnMachineException – If multiple boards are needed but not supported

size_from_n_cores(n_cores: int) Tuple[int, int][source]

Returns the size needed to support this many cores.

Takes into consideration scamp and monitor cores.

Designed for use with virtual boards. Does not include a safety factor for blacklisted cores or chips. For real machines a slightly bigger Machine may be needed.

Parameters:

n_cores – Number of None Scamp and monitor cores needed

The list of Local X, Y and link Id to add spinnaker links to

These are applied local to each Ethernet Chip and only if the link is not connected to another board

abstract property supports_multiple_boards: bool

Specifies if this version allows machines of more than one board

Returns:

verify_size(width: int | None, height: int | None) None[source]

Checks that the width and height are allowed for this version.

Parameters:
  • width

  • height

Raises:

SpinnMachineException – If the size is unexpected

abstractmethod version_parse_cores_string(core_string: str) Iterable[int][source]

A version specific parsing of the core string

Parameters:

core_string

Returns:

A list of cores, which might be just one

spinn_machine.version.vec2mesh_reader module

spinn_machine.version.version_201 module

class spinn_machine.version.version_201.Version201[source]

Bases: VersionSpin2

Code for the 1 Chip test Spin2 board versions

property board_shape: Tuple[int, int]

The width and height of a single board of this type

property chip_core_map: Dict[Tuple[int, int], int]

A map off the expected x,y coordinates on a standard board to the most likely number of cores on that chip.

The list of Local X, Y, link, fpga_link_id and fpga_id

These are applied local to each Ethernet Chip and even if the link is connected to another board

get_potential_ethernet_chips(width: int, height: int) Sequence[Tuple[int, int]][source]

Get the coordinates of chips that should be Ethernet chips.

This may well be passed down to SpiNNakerTriadGeometry.

Note

This methods assumes that width and height would pass verify_size(). If not, the results may be wrong.

Parameters:
  • width – The width of the machine to find the chips in

  • height – The height of the machine to find the chips in

illegal_ethernet_message(x: int, y: int) str | None[source]

Checks if x and y could be for an Ethernet.

This method will return an explanation if the values for x and y are known be illegal for an Ethernet chip.

Due to the limited information available this method will generate False negatives. So this method returning None does not imply that x, y is an Ethernet location

Parameters:
  • x

  • y

Returns:

An explanation that the x and y can never be an Ethernet

property name: str

The name of the specific version.

property number: int

The version number that produced this Version.

The list of Local X, Y and link Id to add spinnaker links to

These are applied local to each Ethernet Chip and only if the link is not connected to another board

property supports_multiple_boards: bool

Specifies if this version allows machines of more than one board

Returns:

spinn_machine.version.version_248 module

class spinn_machine.version.version_248.Version248[source]

Bases: VersionSpin2, Version48Chips

Code for the 48 Chip Spin2 board versions

property chip_core_map: Dict[Tuple[int, int], int]

A map off the expected x,y coordinates on a standard board to the most likely number of cores on that chip.

The list of Local X, Y, link, fpga_link_id and fpga_id

These are applied local to each Ethernet Chip and even if the link is connected to another board

property name: str

The name of the specific version.

property number: int

The version number that produced this Version.

The list of Local X, Y and link Id to add spinnaker links to

These are applied local to each Ethernet Chip and only if the link is not connected to another board

spinn_machine.version.version_3 module

class spinn_machine.version.version_3.Version3[source]

Bases: VersionSpin1

Code for the small Spin1 4 Chip boards

Covers versions 2 and 3

WATTS_FOR_4_CHIP_BOARD_IDLE_COST: Final = 3.56

From measuring the power of an idle 4-chip board for 1 hour, the cost is 3.56W

property board_shape: Tuple[int, int]

The width and height of a single board of this type

property chip_core_map: Dict[Tuple[int, int], int]

A map off the expected x,y coordinates on a standard board to the most likely number of cores on that chip.

The list of Local X, Y, link, fpga_link_id and fpga_id

These are applied local to each Ethernet Chip and even if the link is connected to another board

get_active_energy(time_s: float, n_frames: int, n_boards: int, n_chips: int, chip_active_time: Dict[Tuple[int, int], Tuple[float, int]], router_packets: Dict[Tuple[int, int], Dict[str, int]]) float[source]

Returns the active energy consumption of the system in joules

Parameters:
  • time_s – The time to calculate the energy for in seconds

  • n_frames – The number of frames

  • n_boards – The number of boards

  • n_chips – The number of chips

  • chip_active_time – The time the cores were active in seconds

  • router_packets – The number of packets sent by each router

get_idle_energy(time_s: float, n_frames: int, n_boards: int, n_chips: int) float[source]

Returns the idle energy consumption of the system in joules

Parameters:
  • time_s – The time to calculate the energy for in seconds

  • n_frames – The number of frames

  • n_boards – The number of boards

  • n_chips – The number of chips

get_potential_ethernet_chips(width: int, height: int) Sequence[Tuple[int, int]][source]

Get the coordinates of chips that should be Ethernet chips.

This may well be passed down to SpiNNakerTriadGeometry.

Note

This methods assumes that width and height would pass verify_size(). If not, the results may be wrong.

Parameters:
  • width – The width of the machine to find the chips in

  • height – The height of the machine to find the chips in

illegal_ethernet_message(x: int, y: int) str | None[source]

Checks if x and y could be for an Ethernet.

This method will return an explanation if the values for x and y are known be illegal for an Ethernet chip.

Due to the limited information available this method will generate False negatives. So this method returning None does not imply that x, y is an Ethernet location

Parameters:
  • x

  • y

Returns:

An explanation that the x and y can never be an Ethernet

property name: str

The name of the specific version.

property number: int

The version number that produced this Version.

The list of Local X, Y and link Id to add spinnaker links to

These are applied local to each Ethernet Chip and only if the link is not connected to another board

property supports_multiple_boards: bool

Specifies if this version allows machines of more than one board

Returns:

spinn_machine.version.version_48_chips module

class spinn_machine.version.version_48_chips.Version48Chips(max_cores_per_chip: int, max_sdram_per_chip: int)[source]

Bases: AbstractVersion

Code shared by 48 Chip boards

property board_shape: Tuple[int, int]

The width and height of a single board of this type

get_potential_ethernet_chips(width: int, height: int) Sequence[Tuple[int, int]][source]

Get the coordinates of chips that should be Ethernet chips.

This may well be passed down to SpiNNakerTriadGeometry.

Note

This methods assumes that width and height would pass verify_size(). If not, the results may be wrong.

Parameters:
  • width – The width of the machine to find the chips in

  • height – The height of the machine to find the chips in

illegal_ethernet_message(x: int, y: int) str | None[source]

Checks if x and y could be for an Ethernet.

This method will return an explanation if the values for x and y are known be illegal for an Ethernet chip.

Due to the limited information available this method will generate False negatives. So this method returning None does not imply that x, y is an Ethernet location

Parameters:
  • x

  • y

Returns:

An explanation that the x and y can never be an Ethernet

size_from_n_boards(n_boards: int) Tuple[int, int][source]

Returns the size needed to support this many boards.

Parameters:

n_boards

Raises:

SpinnMachineException – If multiple boards are needed but not supported

property supports_multiple_boards: bool

Specifies if this version allows machines of more than one board

Returns:

spinn_machine.version.version_5 module

class spinn_machine.version.version_5.Version5[source]

Bases: VersionSpin1, Version48Chips

Code for the large Spin1 48 Chip boards

Covers versions 4 and 5

WATTS_FOR_48_CHIP_BOARD_IDLE_COST: Final = 26.84

from Optimising the overall power usage on the SpiNNaker neuromimetic platform, an idle board uses 26.84W

WATTS_FOR_48_CHIP_BOX_COST_OVERHEAD: Final = 5.04

from Optimising the overall power usage on the SpiNNaker neuromimetic platform, an idle board uses 26.84W and from measurement of a boxed board with all cores idle for 1 hour including the power supply and all parts, uses 31.88W, so the overhead is 5.04W

WATTS_FOR_FRAME_IDLE_COST: Final = 117

measured from the real power meter and timing between the photos for a days powered off this is the cost of just a frame itself, including the switch and cooling, while the system is idle.

WATTS_PER_FRAME_ACTIVE_COST_OVERHEAD: Final = 37.163557999999995

measured from the loading of the column and extrapolated this is the cost of just a frame itself, including the switch and cooling, while the system is active, over the idle cost for simplicity

property chip_core_map: Dict[Tuple[int, int], int]

A map off the expected x,y coordinates on a standard board to the most likely number of cores on that chip.

The list of Local X, Y, link, fpga_link_id and fpga_id

These are applied local to each Ethernet Chip and even if the link is connected to another board

get_active_energy(time_s: float, n_frames: int, n_boards: int, n_chips: int, chip_active_time: Dict[Tuple[int, int], Tuple[float, int]], router_packets: Dict[Tuple[int, int], Dict[str, int]]) float[source]

Returns the active energy consumption of the system in joules

Parameters:
  • time_s – The time to calculate the energy for in seconds

  • n_frames – The number of frames

  • n_boards – The number of boards

  • n_chips – The number of chips

  • chip_active_time – The time the cores were active in seconds

  • router_packets – The number of packets sent by each router

get_idle_energy(time_s: float, n_frames: int, n_boards: int, n_chips: int) float[source]

Returns the idle energy consumption of the system in joules

Parameters:
  • time_s – The time to calculate the energy for in seconds

  • n_frames – The number of frames

  • n_boards – The number of boards

  • n_chips – The number of chips

property name: str

The name of the specific version.

property number: int

The version number that produced this Version.

The list of Local X, Y and link Id to add spinnaker links to

These are applied local to each Ethernet Chip and only if the link is not connected to another board

spinn_machine.version.version_spin1 module

class spinn_machine.version.version_spin1.VersionSpin1[source]

Bases: AbstractVersion

Shared code for all Spin1 board versions

COST_PER_PACKET_TYPE = {'External_FR_Packets': 1.8e-09, 'External_Multicast_Packets': 1e-09, 'External_NN_Packets': 1e-09, 'External_P2P_Packets': 1.8e-09, 'Local_FR_Packets': 1.8e-09, 'Local_Multicast_Packets': 1e-09, 'Local_NN_Packets': 1e-09, 'Local_P2P_Packets': 1.8e-09, 'Reinjected': 1e-09}

Cost of each packet type

JOULES_PER_PACKET: Final = 1e-09

stated in papers (SpiNNaker: A 1-W 18 core system-on-Chip for Massively-Parallel Neural Network Simulation) 25pJ per bit - spike packets are 40 bits so 1nJ per spike

JOULES_PER_PACKET_WITH_PAYLOAD: Final = 1.8e-09

As above, but with extra 32-bits

JOULES_PER_ROUTER_BIT = 2.5e-11

stated in papers (SpiNNaker: A 1-W 18 core system-on-Chip for Massively-Parallel Neural Network Simulation) 25pJ per bit

WATTS_PER_CORE_ACTIVE_OVERHEAD: Final = 0.034

From measuring the power of all 48 chips on a boxed board with all cores idle for 1 hour and 806 cores active for 1 hour we get 31.88W idle and 59.38W active, so 27.50W active overhead, which is 0.034W per core

WATTS_PER_IDLE_CHIP: Final = 0.35

From Optimising the overall power usage on the SpiNNaker neuromimetic platform - all chips on a 48-chip board together use 5.23 + 5.17 + 5.52W + SDRAM of 0.90W = 16.82W when idle, so each chip use 0.35W

property clock_speeds_hz: List[int]

The processor clock speeds in Hz this processor can run at

property dtcm_bytes: int

The Data Tightly Coupled Memory available on a processor in bytes

get_router_report_packet_types() List[str][source]

Returns the list of packet types that the router can send

id_to_qx_qy_qp(core_id: int) Tuple[int, int, int][source]

Converts core id to quad coordinates

Parameters:

core_id – id of the core

Returns:

(qx, qy, qp)

Raises:

NotImplementedError – If called on a version that does not support quads

property minimum_cores_expected: int

The minimum number of Chip that we expect from a Chip

If there are less that this number of Cores Machine.validate and other methods are allowed to raise an exception

Returns:

The lowest number of cores to accept before flagging a Chip to be blacklisted

property n_router_entries: int

The standard number of router entries in a router table.

While it is likely that all chips will have this number it should not be counted on. Ask each chip’s router for the correct value.

property n_scamp_cores: int

The number of scamp cores per chip.

quads_maps() None[source]

If applicable returns a map of virtual id to quad qx, qy, qp

Spin 1 boards will return None!

qx_qy_qp_to_id(qx: int, qy: int, qp: int) int[source]

Converts quad coordinates to the core id

Parameters:
  • qx – quad x coordinate of the core

  • qy – quad y coordinate of the core

  • qp – quad p coordinate of the core

Raises:

NotImplementedError – If called on a version that does not support quads

version_parse_cores_string(core_string: str) Iterable[int][source]

A version specific parsing of the core string

Parameters:

core_string

Returns:

A list of cores, which might be just one

spinn_machine.version.version_spin2 module

class spinn_machine.version.version_spin2.VersionSpin2[source]

Bases: AbstractVersion

Code for the Spin2 board versions

property clock_speeds_hz: List[int]

The processor clock speeds in Hz this processor can run at

property dtcm_bytes: int

The Data Tightly Coupled Memory available on a processor in bytes

get_active_energy(time_s: float, n_frames: int, n_boards: int, n_chips: int, chip_active_time: Dict[Tuple[int, int], Tuple[float, int]], router_packets: Dict[Tuple[int, int], Dict[str, int]]) float[source]

Returns the active energy consumption of the system in joules

Parameters:
  • time_s – The time to calculate the energy for in seconds

  • n_frames – The number of frames

  • n_boards – The number of boards

  • n_chips – The number of chips

  • chip_active_time – The time the cores were active in seconds

  • router_packets – The number of packets sent by each router

get_idle_energy(time_s: float, n_frames: int, n_boards: int, n_chips: int) float[source]

Returns the idle energy consumption of the system in joules

Parameters:
  • time_s – The time to calculate the energy for in seconds

  • n_frames – The number of frames

  • n_boards – The number of boards

  • n_chips – The number of chips

get_router_report_packet_types() List[str][source]

Returns the list of packet types that the router can send

id_to_qx_qy_qp(core_id: int) Tuple[int, int, int][source]

Converts core id to quad coordinates

Parameters:

core_id – id of the core

Returns:

(qx, qy, qp)

Raises:

NotImplementedError – If called on a version that does not support quads

property minimum_cores_expected: int

The minimum number of Chip that we expect from a Chip

If there are less that this number of Cores Machine.validate and other methods are allowed to raise an exception

Returns:

The lowest number of cores to accept before flagging a Chip to be blacklisted

property n_router_entries: int

The standard number of router entries in a router table.

While it is likely that all chips will have this number it should not be counted on. Ask each chip’s router for the correct value.

property n_scamp_cores: int

The number of scamp cores per chip.

quads_maps() Dict[int, Tuple[int, int, int]][source]

If applicable returns a map of virtual id to quad qx, qy, qp

Spin 1 boards will return None!

qx_qy_qp_to_id(qx: int, qy: int, qp: int) int[source]

Converts quad coordinates to the core id

Parameters:
  • qx – quad x coordinate of the core

  • qy – quad y coordinate of the core

  • qp – quad p coordinate of the core

Raises:

NotImplementedError – If called on a version that does not support quads

version_parse_cores_string(core_string: str) Iterable[int][source]

A version specific parsing of the core string

Parameters:

core_string

Returns:

A list of cores, which might be just one

spinn_machine.version.version_strings module

class spinn_machine.version.version_strings.VersionStrings(value)[source]

Bases: Enum

A description of strings in cfg settings to say test versions

As additional Versions are added this should allow easy testing of these as far as possible.

ANY = 1
BIG = 3
EIGHT_BY_EIGHT = 5
FOUR_PLUS = 2
WITH_FPGAS = 6
classmethod from_string(value: str) VersionStrings[source]

Gets a VersionString object from a String

Parameters:

value

property options: List[int]

The list of the versions covered by this string

This list can grow as new versions are added

property short_str: str

The text but in a shortened version

This makes the text lower case and removes some special characters

classmethod shorten(value: str) str[source]

Makes the String lower case and removes some special characters

Parameters:

value

Module contents

spinn_machine.version.version_factory() AbstractVersion

Creates a Machine Version class based on cfg settings.

Returns:

A subclass of AbstractVersion

Raises:

SpinnMachineException – If the cfg version is not set correctly