pacman.model.resources package¶
Module contents¶
- class pacman.model.resources.AbstractSDRAM¶
Bases:
objectRepresents an amount of SDRAM used on a chip in the machine.
- abstractmethod get_total_sdram(n_timesteps: int | None) int[source]¶
The total SDRAM.
- Parameters:
n_timesteps – number of timesteps to cost for
- Returns:
- abstract property per_timestep: float¶
The extra SDRAM cost for each additional timestep.
Warning
May well be zero.
- abstractmethod report(timesteps: int | None, indent: str = '', preamble: str = '', target: TextIO | None = None) None[source]¶
Writes a description of this SDRAM to the target.
- Parameters:
timesteps – Number of timesteps to do total cost for
indent – Text at the start of this and all children
preamble – Additional text at the start but not in children
target – Where to write the output.
Noneis standard print
- class pacman.model.resources.ConstantSDRAM(sdram: int)¶
Bases:
AbstractSDRAMRepresents an amount of SDRAM used on a chip in the machine.
This is used when the amount of SDRAM needed is not effected by runtime
- Parameters:
sdram – The amount of SDRAM in bytes
- get_total_sdram(n_timesteps: int | None) int[source]¶
The total SDRAM.
- Parameters:
n_timesteps – number of timesteps to cost for
- Returns:
- property per_timestep: float¶
The extra SDRAM cost for each additional timestep.
Warning
May well be zero.
- report(timesteps: int | None, indent: str = '', preamble: str = '', target: TextIO | None = None) None[source]¶
Writes a description of this SDRAM to the target.
- Parameters:
timesteps – Number of timesteps to do total cost for
indent – Text at the start of this and all children
preamble – Additional text at the start but not in children
target – Where to write the output.
Noneis standard print
- class pacman.model.resources.IPtagResource(ip_address: str, port: int, strip_sdp: bool, tag: int | None = None, traffic_identifier: str = 'DEFAULT')¶
Bases:
objectRepresents the ability to have a SpiNNaker machine send messages to you during execution.
- Parameters:
ip_address – The IP address of the host that will receive data from this tag
port – The port that will
strip_sdp – Whether the tag requires that SDP headers are stripped before transmission of data
tag – A fixed tag ID to assign, or None if any tag is OK
traffic_identifier – The traffic to be sent using this tag; traffic with the same traffic_identifier can be sent using the same tag
- class pacman.model.resources.MultiRegionSDRAM¶
Bases:
AbstractSDRAMA resource for SDRAM that comes in regions.
Note
Adding or subtracting two MultiRegionSDRAM objects will be assumed to be an operation over multiple cores/placements so these functions return a VariableSDRAM object without the regions data.
To add extra SDRAM costs for the same core/placement use the methods
add_cost()andmerge().- add_cost(region: int | str | Enum, fixed_sdram: int | float | integer | floating, per_timestep_sdram: int | float | integer | floating = 0) None[source]¶
Adds the cost for the specified region.
- Parameters:
region – Key to identify the region
fixed_sdram – The fixed cost for this region.
per_timestep_sdram – The variable cost for this region is any
- get_total_sdram(n_timesteps: int | None) int[source]¶
The total SDRAM.
- Parameters:
n_timesteps – number of timesteps to cost for
- Returns:
- merge(other: MultiRegionSDRAM) None[source]¶
Combines the other SDRAM costs keeping the region mappings.
Note
This method should only be called when combining cost for the same core/ placement. Use + to combine for different cores
- Parameters:
other – Another mapping of costs by region
- nest(region: int | str | Enum, other: AbstractSDRAM) None[source]¶
Combines the other SDRAM cost, in a nested fashion.
The totals for the new region are added to the total of this one. A new region is created summarising the cost of others. If other contains a regions which is the same as one in self they are not combined, but kept separate.
- Parameters:
region – Key to identify the summary region
other – Another SDRAM model to make combine by nesting
- property per_timestep: float¶
The extra SDRAM cost for each additional timestep.
Warning
May well be zero.
- property regions: dict[int | str | Enum, AbstractSDRAM]¶
The map from region identifiers to the amount of SDRAM required.
- report(timesteps: int | None, indent: str = '', preamble: str = '', target: TextIO | None = None) None[source]¶
Writes a description of this SDRAM to the target.
- Parameters:
timesteps – Number of timesteps to do total cost for
indent – Text at the start of this and all children
preamble – Additional text at the start but not in children
target – Where to write the output.
Noneis standard print
- class pacman.model.resources.ReverseIPtagResource(port: int | None = None, sdp_port: int = 1, tag: int | None = None)¶
Bases:
objectRepresents the ability to talk to a SpiNNaker machine by sending UDP packets to it during execution.
- Parameters:
port – The UDP port to listen to on the board for this tag or None for a default
sdp_port – The SDP port number to be used when constructing SDP packets from the received UDP packets for this tag
tag – A fixed tag ID to assign, or None if any tag is OK
Bases:
AbstractSDRAMRepresents an amount of SDRAM used on a chip in the machine.
This is split into cost for each core and ones for each chip
Creates an SDRAM of both per_core and shared requirements.
Note
Each key must map GLOBALLY to the same SDRAM (or an equal one) It is recommended that a vertex use its label at the start the key
- Parameters:
shared – The sdram that will be allocated ONCE per Chip This is a dict of keys to sdram
per_core – The amount of SDRAM that will be needed on every core.
The fixed SDRAM cost.
The total SDRAM.
- Parameters:
n_timesteps – number of timesteps to cost for
- Returns:
The extra SDRAM cost for each additional timestep.
Warning
May well be zero.
Writes a description of this SDRAM to the target.
- Parameters:
timesteps – Number of timesteps to do total cost for
indent – Text at the start of this and all children
preamble – Additional text at the start but not in children
target – Where to write the output.
Noneis standard print
A short string representation of this SDRAM.
To be used within main str methods
- class pacman.model.resources.VariableSDRAM(fixed_sdram: int, per_timestep_sdram: float)¶
Bases:
AbstractSDRAMRepresents an amount of SDRAM used on a chip in the machine.
This is where the usage increase as the run time increases
- Parameters:
fixed_sdram – The amount of SDRAM (in bytes) that represents static overhead
per_timestep_sdram – The amount of SDRAM (in bytes) required per timestep. Often represents the space to record a timestep.
- get_total_sdram(n_timesteps: int | None) int[source]¶
The total SDRAM.
- Parameters:
n_timesteps – number of timesteps to cost for
- Returns:
- property per_timestep: float¶
The extra SDRAM cost for each additional timestep.
Warning
May well be zero.
- report(timesteps: int | None, indent: str = '', preamble: str = '', target: TextIO | None = None) None[source]¶
Writes a description of this SDRAM to the target.
- Parameters:
timesteps – Number of timesteps to do total cost for
indent – Text at the start of this and all children
preamble – Additional text at the start but not in children
target – Where to write the output.
Noneis standard print