spinnaker2.configuration
Example:
from spinnaker2.configuration import PEConfig, ExperimentConfig, MemoryRegion, Experiment
from spinnaker2.coordinates import ByteAddr, WordAddr, PE
import spinnaker2.hardware
pe = PE(1,1,0)
pe_cfg = PEConfig(pe, "test_app", "path/to/test/binaries/s2app_arm.mem")
pe_cfg.add_mem_data_to_send(ByteAddr(0x10000).to_WordAddr(), [10,20,30])
pe_cfg.add_mem_region_to_read("my_result", MemoryRegion(ByteAddr(0x10000).to_WordAddr(), 1))
exp_config = ExperimentConfig(duration_in_s=1.0)
exp_config.add(pe_config)
experiment = Experiment(exp_config, spinnaker2.hardware._experiment_app_path_s2_chip())
cmd_opts = ['-e', "192.168.1.59"]
experiment.run(cmd_opts)
my_result = experiment.get_result(pe, "my_result")
Classes:
Experiment
Bases: ExperimentResult
Runs experiment on SpiNNaker2 chip and stores results.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
ExperimentConfig
|
experiment configuration |
required |
app_path
|
str
|
path to experiment runner executable |
required |
Source code in src/spinnaker2/configuration.py
__init__(experiment_config, app_path)
init experiment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_config
|
ExperimentConfig
|
experiment configuration |
required |
app_path
|
str
|
path to experiment runner executable |
required |
Source code in src/spinnaker2/configuration.py
run(cmd_opts=[])
run experiment on SpiNNaker2 hardware.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cmd_opts
|
list of strings
|
command line options for the experiment runner |
[]
|
Source code in src/spinnaker2/configuration.py
ExperimentConfig
Bases: object
Configuration of experiment on a SpiNNaker2 chip.
This class provides a container for the experiment specification for one SpiNNakere2 chip. Besides the configuration of used PEs it contains the runtime and the synchronous_start flag.
Attributes:
Name | Type | Description |
---|---|---|
runtime_in_s |
experiment runtime in seconds |
|
synchronous_start |
bool
|
start all PEs synchronously via feedthrough interrupt. Default: False |
pe_configs |
list of PEConfigs |
Source code in src/spinnaker2/configuration.py
__init__(runtime_in_s)
init experiment configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
runtime_in_s
|
experiment runtime in seconds |
required |
add(*configs)
add one or several PEConfig
dump_spec(json_file='spec.json')
dump experiment specification to JSON file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
json_file
|
str
|
name of JSON file |
'spec.json'
|
Source code in src/spinnaker2/configuration.py
ExperimentResult
Bases: object
Container for results of SpiNNaker2 experiment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
results
|
dict
|
results from SpiNNaker2 experiments. Contains the mem_regions_to_read of the PEConfig. |
required |
Source code in src/spinnaker2/configuration.py
get_result(pe, name)
get result of recorded memory region on PE.
Returns the raw data of a memory region recorded after the experiment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pe
|
PE coordinate |
required | |
name
|
name of memory region |
required |
Source code in src/spinnaker2/configuration.py
MemoryRegion
Bases: object
memory region on a SpiNNaker2 PE.
A memory region is defined by its start address and the number of 32-bit words.
Attributes:
Name | Type | Description |
---|---|---|
word_addr |
WordAddr
|
start address. |
word_count |
int
|
size of memory region in 32-bit words |
Source code in src/spinnaker2/configuration.py
__init__(word_addr, word_count)
Init MemoryRegion.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
word_addr
|
WordAddr
|
start address. |
required |
word_count
|
int
|
size of memory region in 32-bit words |
required |
Source code in src/spinnaker2/configuration.py
PEConfig
Bases: object
Configuration of a SpiNNaker2 PE.
This class provides a container for the experiment specification related to one SpiNNaker2 processing element. It contains the mem-file, the input data blocks and the memory regions to read after the experiment as well as the coordinate of the PE.
Attributes:
Name | Type | Description |
---|---|---|
pe |
PE coordinate |
|
app_name |
name of application to run on this PE. |
|
mem_file |
str or None
|
path to mem-file with instruction memory. |
mem_regions_to_read |
dict
|
memory regions to read from the PE after the experiment. The dict keys are unique names for the memory regions to ease the retrieval of the data after the experiment. |
mem_data_to_send |
list
|
list of memory data blocks to send to the PE. Each block is defined by a start address (WordAddr) and a data array of 32-bit words (unsigned integer). |
Source code in src/spinnaker2/configuration.py
__init__(pe, app_name, mem_file=None)
init PE configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pe
|
PE coordinate. |
required | |
app_name
|
name of application to run on this PE. |
required | |
mem_file
|
str or None
|
path to mem-file with instruction memory. |
None
|
Source code in src/spinnaker2/configuration.py
add_mem_data_to_send(start_addr, data_array)
add memory data to send
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_addr
|
PE local word address to write |
required | |
data_array
|
list of 32-bit words representing 4 bytes each |
required |
Source code in src/spinnaker2/configuration.py
add_mem_region_to_read(name, mem_region)
add memory region to read.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
name tag for the memory region (string) |
required | |
mem_region
|
MemoryRegion |
required |