spynnaker.pyNN.models.neuron package

Subpackages

Submodules

spynnaker.pyNN.models.neuron.generator_data module

class spynnaker.pyNN.models.neuron.generator_data.GeneratorData(synaptic_matrix_offset, delayed_synaptic_matrix_offset, app_edge, synapse_information, max_row_info, max_pre_atoms_per_core, max_post_atoms_per_core)[source]

Bases: object

Data for each connection of the synapse generator.

BASE_SIZE = 44
property gen_data

The data to be written for this connection.

Return type:

list(ndarray(uint32))

property size

The size of the generated data, in bytes.

Return type:

int

spynnaker.pyNN.models.neuron.master_pop_table module

class spynnaker.pyNN.models.neuron.master_pop_table.MasterPopTableAsBinarySearch[source]

Bases: object

Master population table, implemented as binary search master.

add_application_entry(block_start_addr, row_length, key_and_mask, core_mask, core_shift, n_neurons, n_colour_bits)[source]

Add an entry for an application-edge to the population table.

Parameters:
  • block_start_addr (int) – where the synaptic matrix block starts

  • row_length (int) – how long in words each row is

  • key_and_mask (BaseKeyAndMask) – the key and mask for this master pop entry

  • core_mask (int) – Mask for the part of the key that identifies the core

  • core_shift (int) – The shift of the mask to get to the core_mask

  • n_neurons (int) – The number of neurons in each machine vertex (bar the last)

  • n_colour_bits (int) – The number of bits to use for colour

Returns:

The index of the entry, to be used to retrieve it

Return type:

int

Raises:

SynapticConfigurationException – If a bad address is used.

add_invalid_application_entry(key_and_mask, core_mask, core_shift, n_neurons, n_colour_bits)[source]

Add an entry to the table from an application vertex that doesn’t point to anywhere. Used to keep indices in synchronisation between e.g. normal and delay entries and between entries on different cores.

Parameters:
  • key_and_mask (BaseKeyAndMask) – a key_and_mask object used as part of describing an edge that will require being received to be stored in the master pop table; the whole edge will become multiple calls to this function

  • core_mask (int) – Mask for the part of the key that identifies the core

  • core_shift (int) – The shift of the mask to get to the core_mask

  • n_neurons (int) – The number of neurons in each machine vertex (bar the last)

  • n_colour_bits (int) – The number of bits to use for colour

Returns:

The index of the added entry

Return type:

int

static get_allowed_row_length(row_length)[source]

Get the next allowed row length.

Parameters:

row_length (int) – the row length being considered

Returns:

the row length available

Return type:

int

Raises:

SynapseRowTooBigException – If the row won’t fit

static get_master_population_table_size(incoming_projections)[source]

Get the size of the master population table in SDRAM.

Parameters:

incoming_projections (list(projection Projection)) – The projections arriving at the vertex that are to be handled by this table

Returns:

the size the master pop table will take in SDRAM (in bytes)

Return type:

int

static get_next_allowed_address(next_address)[source]

Get the next allowed address.

Parameters:

next_address (int) – The next address that would be used

Returns:

The next address that can be used following next_address

Return type:

int

Raises:

SynapticConfigurationException – if the address is out of range

get_pop_table_data()[source]

Get the master pop table data as a numpy array.

Return type:

ndarray

initialise_table()[source]

Initialise the master pop data structure.

property max_core_mask

The maximum core mask supported when n_neurons is > 0; this is the maximum number of cores that can be supported in a joined mask.

Return type:

int

property max_index

The maximum index of a synaptic connection.

Return type:

int

property max_n_neurons_per_core

The maximum number of neurons per core supported when a core-mask is > 0.

Return type:

int

spynnaker.pyNN.models.neuron.neuron_data module

class spynnaker.pyNN.models.neuron.neuron_data.NeuronData(app_vertex)[source]

Bases: object

Holds and creates the data for a group of neurons.

property gen_on_machine

Whether the neuron data can be generated on the machine or not.

Return type:

bool

generate_data()[source]

Do the data generation internally.

read_data(placement, neuron_regions)[source]

Read the current state of the data from the machine into the application vertex.

Parameters:
  • placement (Placement) – The placement of the vertex to read

  • neuron_regions (NeuronRegions) – The regions to read from

read_initial_data(placement, neuron_regions)[source]

Read the initial state of the data from the machine into the application vertex.

Parameters:
  • placement (Placement) – The placement of the vertex to read

  • neuron_regions (NeuronRegions) – The regions to read from

reset_generation()[source]

Reset generation so it is done again.

write_data(spec, vertex_slice, neuron_regions, gen_on_machine=True)[source]

Write the generated data.

Parameters:
  • spec (DataSpecificationGenerator) – The data specification to write to

  • vertex_slice (Slice) – The vertex slice to generate for

  • neuron_regions (NeuronRegions) – The regions to write to

  • gen_on_machine (bool) – Whether to allow generation on machine

spynnaker.pyNN.models.neuron.population_machine_common module

class spynnaker.pyNN.models.neuron.population_machine_common.CommonRegions(system: int, provenance: int, profile: int, recording: int)[source]

Bases: object

Identifiers for common regions.

profile: int

Profiling data region

provenance: int

Provenance collection region

recording: int

Recording channels region

system: int

System control region

class spynnaker.pyNN.models.neuron.population_machine_common.PopulationMachineCommon(label, app_vertex, vertex_slice, sdram, regions, n_provenance_items, profile_tags, binary_file_name)[source]

Bases: MachineVertex, ProvidesProvenanceDataFromMachineImpl, AbstractReceiveBuffersToHost, AbstractHasProfileData, AbstractHasAssociatedBinary

A common machine vertex for all population binaries.

Parameters:
  • label (str) – The label of the vertex

  • app_vertex (AbstractPopulationVertex) – The associated application vertex

  • vertex_slice (Slice) – The slice of the population that this implements

  • sdram (AbstractSDRAM) – The SDRAM used by the vertex

  • regions (.CommonRegions) – The regions to be assigned

  • n_provenance_items (int) – The number of additional provenance items to be read

  • profile_tags (dict(int,str)) – A mapping of profile identifiers to names

  • binary_file_name (str) – The name of the binary file

get_binary_file_name()[source]

Get the binary name to be run for this vertex.

Return type:

str

get_binary_start_type()[source]

Get the start type of the binary to be run.

Return type:

ExecutableType

get_n_keys_for_partition(partition_id)[source]

Get the number of keys required by the given partition of edges.

Parameters:

partition_id (str) – The identifier of the partition; the partition_id param is only used by some MachineVertex subclasses

Returns:

The number of keys required

Return type:

int

get_profile_data(placement)[source]

Get the profile data recorded during simulation.

Parameters:

placement (Placement) –

Return type:

ProfileData

get_recording_region_base_address(placement)[source]

Get the recording region base address.

Parameters:

placement (Placement) – the placement object of the core to find the address of

Returns:

the base address of the recording region

Return type:

int

property sdram_required

The SDRAM space required by the vertex.

Return type:

AbstractSDRAM

spynnaker.pyNN.models.neuron.population_machine_synapses module

class spynnaker.pyNN.models.neuron.population_machine_synapses.PopulationMachineSynapses[source]

Bases: PopulationMachineSynapsesProvenance, AbstractSupportsBitFieldRoutingCompression, AbstractSynapseExpandable, HasSynapses

Mix-in for machine vertices that contain synapses.

abstract property app_vertex

The application vertex of the machine vertex.

Note

This is likely to be available via the MachineVertex.

Return type:

AbstractPopulationVertex

bit_field_base_address(placement)[source]

Returns the SDRAM address for the bit-field table data.

Parameters:

placement (Placement) –

Returns:

the SDRAM address for the bitfield address

Return type:

int

property bit_field_size

The amount of bit field data to be generated. This is used to calculate the timeout of the execution.

Return type:

int

property connection_generator_region

The region ID containing the parameters of synaptic expansion.

Return type:

int

gen_on_machine()[source]

True if the synapses of a the slice of this vertex should be generated on the machine.

Note

The typical implementation for this method will be to ask the app_vertex’s synapse_manager

Return type:

bool

get_connections_from_machine(placement, app_edge, synapse_info)[source]

Get the connections from the machine for this vertex.

Parameters:
Return type:

ndarray

property max_gen_data

The maximum amount of synaptic data to be generated. This is used to calculate the timeout of the execution.

Return type:

int

read_generated_connection_holders(placement)[source]

Fill in the connection holders.

Parameters:

placement (Placement) – Where the data is on the machine

regeneratable_sdram_blocks_and_sizes(placement)[source]

Returns the SDRAM addresses and sizes for the cores’ SDRAM that are available (borrowed) for generating bitfield tables.

Parameters:

placement (Placement) –

Returns:

list of tuples containing (the SDRAM address for the cores SDRAM address’s for the core’s SDRAM that can be used to generate bitfield tables loaded, and the size of memory chunks located there)

Return type:

list(tuple(int,int))

abstract set_do_synapse_regeneration()[source]

Indicates that synaptic data regeneration is required.

abstract property vertex_slice

The slice of the application vertex atoms on this machine vertex.

Note

This is likely to be available via the MachineVertex.

Return type:

Slice

spynnaker.pyNN.models.neuron.synapse_io module

class spynnaker.pyNN.models.neuron.synapse_io.MaxRowInfo(undelayed_max_n_synapses, delayed_max_n_synapses, undelayed_max_bytes, delayed_max_bytes, undelayed_max_words, delayed_max_words)[source]

Bases: object

Information about the maximums for rows in a synaptic matrix.

Parameters:
  • undelayed_max_n_synapses (int) – Maximum number of synapses in a row of the undelayed matrix

  • delayed_max_n_synapses (int) – Maximum number of synapses in a row of the delayed matrix

  • undelayed_max_bytes (int) – Maximum number of bytes, including headers, in a row of the undelayed matrix, or 0 if no synapses

  • delayed_max_bytes (int) – Maximum number of bytes, including headers, in a row of the delayed matrix, or 0 if no synapses

  • undelayed_max_words (int) – Maximum number of words, excluding headers, in a row of the undelayed matrix

  • delayed_max_words (int) – Maximum number of words, excluding headers, in a row of the delayed matrix

property delayed_max_bytes

Maximum number of bytes, including headers, in a row of the delayed matrix.

Return type:

int

property delayed_max_n_synapses

Maximum number of synapses in a row of the delayed matrix.

Return type:

int

property delayed_max_words

Maximum number of words, excluding headers, in a row of the undelayed matrix.

Return type:

int

property undelayed_max_bytes

Maximum number of bytes, including headers, in a row of the undelayed matrix.

Return type:

int

property undelayed_max_n_synapses

Maximum number of synapses in a row of the undelayed matrix.

Return type:

int

property undelayed_max_words

Maximum number of words, excluding headers, in a row of the undelayed matrix.

Return type:

int

spynnaker.pyNN.models.neuron.synapse_io.convert_to_connections(synapse_info, post_vertex_slice, n_pre_atoms, max_row_length, n_synapse_types, weight_scales, data, delayed, post_vertex_max_delay_ticks, max_atoms_per_core)[source]

Read the synapses for a given projection synapse information object out of the given data and convert to connection data

Parameters:
  • synapse_info (SynapseInformation) – The synapse information of the synapses

  • n_pre_atoms (int) – The number of atoms in the pre-vertex

  • post_vertex_slice (Slice) – The slice of the target neurons of the synapses in the data

  • max_row_length (int) – The length of each row in the data

  • n_synapse_types (int) – The number of synapse types in total

  • weight_scales (list(float)) – The weight scaling of each synapse type

  • data (bytearray) – The raw data containing the synapses

  • delayed (bool) – True if the data should be considered delayed

  • post_vertex_max_delay_ticks (int) – The maximum delayed ticks supported from post vertex

  • max_atoms_per_core (int) – The maximum number of atoms on a core

Returns:

The connections read from the data; the dtype is NUMPY_CONNECTORS_DTYPE

Return type:

ndarray

spynnaker.pyNN.models.neuron.synapse_io.get_max_row_info(synapse_info, n_post_atoms, n_delay_stages, in_edge)[source]

Get the information about the maximum lengths of delayed and undelayed rows in bytes (including header), words (without header) and number of synapses.

Parameters:
  • synapse_info (SynapseInformation) – The synapse information to get the row data for

  • n_post_atoms (int) – The number of post atoms to get the maximum for

  • n_delay_stages (int) – The number of delay stages on the edge

  • in_edge (ProjectionApplicationEdge) – The incoming edge on which the synapse information is held

Return type:

MaxRowInfo

Raises:

SynapseRowTooBigException – If the synapse information can’t be represented

spynnaker.pyNN.models.neuron.synapse_io.get_maximum_delay_supported_in_ms(post_vertex_max_delay_ticks)[source]

Get the maximum delay supported by the synapse representation before extensions are required, or None if any delay is supported.

Parameters:

post_vertex_max_delay_ticks (int) – post vertex max delay

Return type:

int

spynnaker.pyNN.models.neuron.synapse_io.get_synapses(connections, synapse_info, n_delay_stages, n_synapse_types, weight_scales, app_edge, post_vertex_slice, max_row_info, gen_undelayed, gen_delayed, max_atoms_per_core)[source]

Get the synapses as an array of words for non-delayed synapses and an array of words for delayed synapses. This is used to prepare information for deployment to SpiNNaker.

Parameters:
  • connections (ndarray) – The connections to get the synapses from

  • synapse_info (SynapseInformation) – The synapse information to convert to synapses

  • n_delay_stages (int) – The number of delay stages in total to be represented

  • n_synapse_types (int) – The number of synapse types in total to be represented

  • weight_scales (list(float)) – The scaling of the weights for each synapse type

  • app_edge (ApplicationEdge) – The incoming machine edge that the synapses are on

  • post_vertex_slice (Slice) – The slice of the post-vertex to get the synapses for

  • max_row_info (MaxRowInfo) – The maximum row information for the synapses

  • gen_undelayed (bool) – Whether to generate undelayed data

  • gen_delayed (bool) – Whether to generate delayed data

  • max_atoms_per_core (int) – The maximum number of atoms on a core

Returns:

(row_data, delayed_row_data) where:

  • row_data is the undelayed connectivity data arranged into a

    row per source, each row the same length

  • delayed_row_data is the delayed connectivity data arranged

    into a row per source per delay stage, each row the same length

Return type:

tuple(ndarray, ndarray)

spynnaker.pyNN.models.neuron.synapse_io.read_all_synapses(data, delayed_data, synapse_info, n_synapse_types, weight_scales, post_vertex_slice, n_pre_atoms, post_vertex_max_delay_ticks, max_row_info, max_atoms_per_core)[source]

Read the synapses for a given projection synapse information object out of the given delayed and undelayed data.

Parameters:
  • data (bytearray) – The raw data containing the undelayed synapses

  • delayed_data (bytearray) – The raw data containing the delayed synapses

  • synapse_info (SynapseInformation) – The synapse info that generated the synapses

  • n_synapse_types (int) – The total number of synapse types available

  • weight_scales (list(float)) – A weight scale for each synapse type

  • n_pre_atoms (int) – The number of atoms in the pre-vertex

  • post_vertex_slice (Slice) – The slice of the post-vertex to read the synapses for

  • post_vertex_max_delay_ticks (int) – max delayed ticks supported from post vertex

  • max_row_info (MaxRowInfo) – The maximum information for each of the rows

  • max_atoms_per_core (int) – The maximum number of atoms on a core

Returns:

The connections read from the data; the dtype is NUMPY_CONNECTORS_DTYPE

Return type:

ndarray

spynnaker.pyNN.models.neuron.synaptic_matrices module

class spynnaker.pyNN.models.neuron.synaptic_matrices.AppKeyInfo(app_key, app_mask, core_mask, core_shift, n_neurons, n_colour_bits)[source]

Bases: object

An object which holds an application key and mask along with the other details.

Parameters:
  • app_key (int) – The application-level key

  • app_mask (int) – The application-level mask

  • core_mask (int) – The mask to get the core from the key

  • core_shift (int) – The shift to get the core from the key

  • n_neurons (int) – The neurons in each core (except possibly the last)

  • n_colour_bits (int) – The number of colour bits sent

app_key
app_mask
core_mask
core_shift
property key_and_mask

The key and mask as an object.

Return type:

BaseKeyAndMask

n_colour_bits
n_neurons
class spynnaker.pyNN.models.neuron.synaptic_matrices.SynapseRegions(synapse_params, pop_table, synaptic_matrix, synapse_dynamics, structural_dynamics, bitfield_filter, connection_builder)

Bases: tuple

Create new instance of SynapseRegions(synapse_params, pop_table, synaptic_matrix, synapse_dynamics, structural_dynamics, bitfield_filter, connection_builder)

bitfield_filter

Alias for field number 5

connection_builder

Alias for field number 6

pop_table

Alias for field number 1

structural_dynamics

Alias for field number 4

synapse_dynamics

Alias for field number 3

synapse_params

Alias for field number 0

synaptic_matrix

Alias for field number 2

class spynnaker.pyNN.models.neuron.synaptic_matrices.SynapticMatrices(app_vertex, regions, max_atoms_per_core, weight_scales, all_syn_block_sz)[source]

Bases: object

Handler of synaptic matrices for a core of a population vertex.

Parameters:
property bit_field_size

The size of the bit field data.

Return type:

int

property gen_on_machine

Whether any matrices need to be generated on the machine.

Return type:

bool

generate_data()[source]
get_connections_from_machine(placement, app_edge, synapse_info)[source]

Get the synaptic connections from the machine.

Parameters:
Returns:

A list of arrays of connections, each with dtype NUMPY_CONNECTORS_DTYPE

Return type:

ndarray

get_index(app_edge, synapse_info)[source]

Get the index of an incoming projection in the population table.

Parameters:
property host_generated_block_addr

The address within the synaptic region after the last block written by the on-host synaptic generation, i.e. the start of the space that can be overwritten provided the synapse expander is run again.

Return type:

int

property max_gen_data

The maximum amount of data to be generated for the synapses.

Return type:

int

property on_chip_generated_matrix_size

The size of the space used by the generated matrix, i.e. the space that can be overwritten provided the synapse expander is run again.

Return type:

int

read_generated_connection_holders(placement)[source]

Fill in any pre-run connection holders for data which is generated on the machine, after it has been generated.

Parameters:

placement (Placement) – where the data is to be read from

write_synaptic_data(spec, post_vertex_slice, references)[source]

Write the synaptic data for all incoming projections.

Parameters:
  • spec (DataSpecificationGenerator) – The spec to write to

  • post_vertex_slice (Slice) – The slice of the post-vertex the matrix is for

  • references (SynapseRegions) – Regions which are referenced; each region which is not referenced can be None.

spynnaker.pyNN.models.neuron.synaptic_matrix_app module

class spynnaker.pyNN.models.neuron.synaptic_matrix_app.SynapticMatrixApp(synapse_info, app_edge, n_synapse_types, synaptic_matrix_region, max_atoms_per_core, all_syn_block_sz, app_key_info, delay_app_key_info, weight_scales)[source]

Bases: object

The synaptic matrix (and delay matrix if applicable) for an incoming application edge.

Parameters:
  • synapse_info (SynapseInformation) – The projection synapse information

  • app_edge (ProjectionApplicationEdge) – The projection application edge

  • n_synapse_types (int) – The number of synapse types accepted

  • synaptic_matrix_region (int) – The region where synaptic matrices are stored

  • all_syn_block_sz (int) – The space available for all synaptic matrices on the core

  • app_key_info (AppKeyInfo) – Application-level routing key information for undelayed vertices

  • delay_app_key_info (AppKeyInfo) – Application-level routing key information for delayed vertices

  • weight_scales (list(float)) – Weight scale for each synapse edge

append_matrix(post_vertex_slice, data_to_write, block_addr)[source]

Append a synaptic matrix from be written from host.

Parameters:
  • post_vertex_slice (Slice) – The slice of the post-vertex the matrix is for

  • data_to_write (list) – List to append the data to write to

  • block_addr (int) – The amount of data written so far

Returns:

The amount of data written after this data has been written

Return type:

int

property gen_size
get_connections(placement)[source]

Get the connections for this matrix from the machine.

Parameters:

placement (Placement) – Where the matrix is on the machine

Returns:

A list of arrays of connections, each with dtype NUMPY_CONNECTORS_DTYPE

Return type:

ndarray

get_generator_data()[source]

Prepare to write a matrix using an on-chip generator.

Returns:

The data to generate with

Return type:

GeneratorData

get_index()[source]

Get the index in the master population table of the matrix.

Parameters:

m_vertex (MachineVertex) – The source machine vertex

Return type:

int

read_generated_connection_holders(placement)[source]

Read any pre-run connection holders after data has been generated.

Parameters:

placement (Placement) – Where the matrix is on the machine

reserve_matrices(block_addr, pop_table)[source]

Allocate the master pop table entries for the blocks.

Parameters:
Returns:

Where the next allocation can start from

Return type:

int

Module contents

class spynnaker.pyNN.models.neuron.AbstractPopulationVertex(n_neurons, label, max_atoms_per_core, spikes_per_second, ring_buffer_sigma, incoming_spike_buffer_size, neuron_impl, pynn_model, drop_late_spikes, splitter, seed, n_colour_bits)

Bases: PopulationApplicationVertex, AbstractAcceptsIncomingSynapses, AbstractCanReset, SupportsStructure

Underlying vertex model for Neural Populations. Not actually abstract.

Parameters:
  • n_neurons (int) – The number of neurons in the population

  • label (str) – The label on the population

  • max_atoms_per_core (int) – The maximum number of atoms (neurons) per SpiNNaker core.

  • spikes_per_second (float or None) – Expected spike rate

  • ring_buffer_sigma (float or None) – How many SD above the mean to go for upper bound of ring buffer size; a good starting choice is 5.0. Given length of simulation we can set this for approximate number of saturation events.

  • incoming_spike_buffer_size (int or None) –

  • drop_late_spikes (bool) – control flag for dropping late packets.

  • neuron_impl (AbstractNeuronImpl) – The (Python side of the) implementation of the neurons themselves.

  • pynn_model (AbstractPyNNNeuronModel) – The PyNN neuron model that this vertex is working on behalf of.

  • splitter (AbstractSplitterCommon or None) – splitter object

  • seed – The Population seed, used to ensure the same random generation on each run.

  • n_colour_bits (int) – The number of colour bits to use

CORE_PARAMS_BASE_SIZE = 20
add_incoming_projection(projection)[source]

Add a projection incoming to this vertex.

Parameters:

projection (Projection) – The new projection to add

property atoms_shape

The “shape” of the atoms in the vertex i.e. how the atoms are split between the dimensions of the vertex. By default everything is 1-dimensional, so the value will be a 1-tuple but can be overridden by a vertex that supports multiple dimensions.

Return type:

tuple(int, …)

can_generate_on_machine()[source]

Determine if the parameters of this vertex can be generated on the machine

Return type:

bool

clear_connection_cache()[source]

Flush the cache of connection information; needed for a second run.

property combined_core_capable

Whether the vertex can manage to operate on a combined neuron-synapse core, or if a split synapse-core is more appropriate.

Note

This is currently based only on the ITCM available, not on the incoming synapses, but could be combined with n_synapse_cores_required to determine if, and how-many, synapse cores are needed.

Return type:

bool

property conductance_based

Whether the vertex models post-synaptic inputs as currents or conductance.

By default this is False; override if the model accepts conductance based input.

Return type:

bool

copy_initial_state_variables(vertex_slice)[source]

Copies the state variables into the initial state variables.

Parameters:

vertex_slice (Slice) – The slice to copy now

core_seed(vertex_slice)[source]

The seed to use for a core.

Parameters:

vertex_slice (Slice) – The machine vertex that the seed is for

Returns:

A list of 4 integers

Return type:

list(int)

property current_source_id_list

Current source ID list needed to be available to machine vertex.

Return type:

dict(AbstractCurrentSource,any)

property current_sources

Current sources needed to be available to machine vertex.

Return type:

list(AbstractCurrentSource)

describe()[source]

Get a human-readable description of the cell or synapse type.

The output may be customised by specifying a different template together with an associated template engine (see pyNN.descriptions).

If template is None, then a dictionary containing the template context will be returned.

Return type:

dict(str, any)

property drop_late_spikes

Whether spikes should be dropped if not processed in a timestep.

Return type:

bool

get_buffer_data_type(name)[source]

Get the type of data recorded by the buffer manager.

The buffer data type controls how data returned by the cores is handled in NeoBufferDatabase.

Parameters:

name (str) – The name of the variable recorded

Return type:

BufferDatabase

Raises:

KeyError – if the variable isn’t being recorded

get_common_constant_sdram(n_record, n_provenance, common_regions)[source]

Get the amount of SDRAM used by common parts.

Parameters:
  • n_record (int) – The number of recording regions

  • n_provenance (int) – The number of provenance items

  • common_regions (CommonRegions) – Region IDs

Return type:

int

get_connections_from_machine(app_edge, synapse_info)[source]

Get the connections from the machine post-run.

Parameters:
Return type:

ndarray

get_current_state_values(names, selector=None)[source]

Get the current values of a state variable for the whole Population or a subset if the selector is used.

Parameters:
Return type:

ParameterHolder

Raises:

KeyError – if the variable is not something that can be read

get_data_type(name)[source]

Get the type data returned by a recording of the variable.

This is the type of data the C code is returning. For instance data such as spikes this will be None.

Parameters:

name (str) – The name of the variable to get the type of

Return type:

DataType or None

Raises:

KeyError – If the variable isn’t recordable

get_incoming_projections_from(source_vertex)[source]

The projections that target this population vertex from the given source.

Return type:

iterable(Projection)

get_initial_state_values(names, selector=None)[source]

Get the initial values of a state variable for the whole Population or a subset if the selector is used.

Parameters:
Return type:

ParameterHolder

Raises:

KeyError – if the variable is not something that can be read

get_max_atoms_per_core()[source]

Gets the maximum number of atoms per core, which is either the number of atoms required across the whole application vertex, or a lower value set.

Return type:

int

get_max_atoms_per_dimension_per_core()[source]

Gets the maximum number of atoms per dimension per core. This will return a tuple with a number for each dimension of the vertex, which might be one if this is a single-dimension vertex.

Return type:

tuple(int,…)

get_max_delay(max_ring_buffer_bits)[source]

Get the maximum delay and whether a delay extension is needed for a given maximum number of ring buffer bits.

Parameters:

max_ring_buffer_bits (int) – The maximum number of bits that can be used for the ring buffer identifier (i.e. delay, synapse type, neuron index)

Returns:

Tuple of the maximum delay supported on the core and whether a delay extension is needed to support delays

Return type:

tuple(int, bool)

get_max_neuron_variable_sdram(n_neurons)[source]

Get the amount of SDRAM per timestep used by neuron parts.

Parameters:

vertex_slice (Slice) – The slice of neurons to get the size of

Return type:

int

get_max_row_info(synapse_info, n_post_atoms, app_edge)[source]

Get maximum row length data.

Parameters:
Return type:

MaxRowInfo

get_max_synapse_variable_sdram(n_neurons)[source]

Get the amount of SDRAM per timestep used by synapse parts.

Parameters:

vertex_slice (Slice) – The slice of neurons to get the size of

Return type:

int

get_n_atom_bits()[source]
Return type:

int

get_neuron_constant_sdram(n_atoms, neuron_regions)[source]

Get the amount of fixed SDRAM used by neuron parts.

Parameters:
  • vertex_slice (Slice) – The slice of neurons to get the size of

  • neuron_regions (NeuronRegions) – Region IDs

Return type:

int

get_neuron_variable_sdram(vertex_slice)[source]

Get the amount of SDRAM per timestep used by neuron parts.

Parameters:

vertex_slice (Slice) – The slice of neurons to get the size of

Return type:

int

get_neurons_recording(name, vertex_slice)[source]

Gets the neurons being recorded on the core with this slice.

Typically vertex_slice.get_raster_ids(atoms_shape) but may be a sublist if doing selective recording.

Parameters:
  • name (str) – The name of the variable to get the region of

  • vertex_slice (Slice) –

Returns:

A list of the global raster IDs of the atoms in recording named variable within this slice

Return type:

list(int)

get_parameter_values(names, selector=None)[source]

Get the values of a parameter or parameters for the whole Population or a subset if the selector is used.

Parameters:
Return type:

ParameterHolder

Raises:

KeyError – if the parameter is not something that can be read

get_parameters()[source]

Get the names of all the parameters that can be obtained

Return type:

list(str)

get_recordable_variables()[source]

Get a list of the names and types of things that can be recorded.

This methods list the variable recorded via the Population.

Return type:

list(str)

get_recording_region(name)[source]

Gets the recording region for the named variable.

Parameters:

name (str) – The name of the variable to get the region of

Return type:

int

Raises:

KeyError – If the variable isn’t being recorded

get_recording_variables()[source]

Get a list of variables that are currently being recorded.

Return type:

list(str)

get_ring_buffer_shifts()[source]

Get the shift of the ring buffers for transfer of values into the input buffers for this model.

Parameters:

incoming_projections (list(Projection)) – The projections to consider in the calculations

Return type:

list(int)

get_sampling_interval_ms(name)[source]

Get the sampling interval of the recording for the given variable.

The values is in ms and unless selective recording is used will be SpynnakerDataView.get_simulation_time_step_us()

Return type:

float

Raises:

KeyError – If the variable isn’t being recorded

get_sdram_usage_for_core_neuron_params(n_atoms)[source]
Parameters:

n_atoms (int) – The number of atoms per core

Returns:

The SDRAM required for the core neuron parameters

Return type:

int

get_sdram_usage_for_current_source_params(n_atoms)[source]

Calculate the SDRAM usage for the current source parameters region.

Parameters:

n_atoms (int) – The number of atoms to account for

Returns:

The SDRAM required for the current source region

Return type:

int

get_sdram_usage_for_neuron_generation(n_atoms)[source]

Calculate the SDRAM usage for the neuron generation region.

Parameters:

n_atoms (int) – The number of atoms per core

Returns:

The SDRAM required for the neuron generator region

Return type:

int

get_sdram_usage_for_neuron_params(n_atoms)[source]

Calculate the SDRAM usage for just the neuron parameters region.

Parameters:

n_atoms (int) – The number of atoms per core

Returns:

The SDRAM required for the neuron region

Return type:

int

get_state_variables()[source]

Get a list of supported state variables.

Return type:

list(str)

get_structural_dynamics_size(n_atoms)[source]

Get the size of the structural dynamics region, in bytes.

Parameters:

n_atoms (int) – The number of atoms in the slice

Return type:

int

get_synapse_dynamics_size(n_atoms)[source]

Get the size of the synapse dynamics region, in bytes.

Parameters:

vertex_slice (Slice) – The slice of the vertex to get the usage of

Return type:

int

get_synapse_expander_size()[source]

Get the size of the synapse expander region, in bytes.

Return type:

int

get_synapse_id_by_target(target)[source]

Get the id of synapse using its target name.

Parameters:

target (str) – The synapse to get the id of

Return type:

int

get_synapse_params_size()[source]

Get the size of the synapse parameters, in bytes.

Return type:

int

get_synapse_variable_sdram(vertex_slice)[source]

Get the amount of SDRAM per timestep used by synapse parts.

Parameters:

vertex_slice (Slice) – The slice of neurons to get the size of

Return type:

int

get_synapses_size(n_post_atoms)[source]

Get the maximum SDRAM usage for the synapses on a vertex slice.

Parameters:
  • n_post_atoms (int) – The number of atoms projected to

  • incoming_projections (list(Projection)) – The projections to consider in the calculations

Return type:

int

get_units(name)[source]

Get the units of the given parameter or state variable.

Parameters:

name (str) – the name of the parameter to get the units of

Return type:

str

Raises:

KeyError – if the name isn’t recognised or the units cannot be identified

get_weight_scales(ring_buffer_shifts)[source]

Get the weight scaling to apply to weights in synapses.

Parameters:

ring_buffer_shifts (list(int)) – The shifts to convert to weight scales

Return type:

list(int)

property incoming_poisson_projections

The projections that target this population vertex which originate from a Poisson source.

Return type:

iterable(Projection)

property incoming_projections

The projections that target this population vertex.

Return type:

iterable(Projection)

property incoming_spike_buffer_size

The size of the incoming spike buffer to be used on the cores.

Return type:

int

property initial_state_variables

The initial values of the state variables of the neurons.

Return type:

RangeDictionary

inject(current_source, selector=None)[source]

Inject a current source into this population.

Parameters:
Raises:

ConfigurationException – if the population doesn’t support injection

property n_atoms

The number of atoms in the vertex.

Return type:

int

property n_colour_bits

The number of colour bits sent by this vertex.

Assumed 0 unless overridden

Return type:

int

property n_profile_samples

The maximum number of profile samples to report.

Return type:

int

property n_synapse_cores_required

The estimated number of synapse cores required, when using a split synapse-neuron core model.

Note

This is currently hard-coded but could be updated to work this out based on the number of incoming synapses.

Return type:

int

property neuron_impl

The neuron implementation.

Return type:

AbstractNeuronImpl

property neuron_recordables

The names of variables that can be recorded by the neuron.

Return type:

list(str)

property neuron_recorder

The recorder for neurons.

Return type:

NeuronRecorder

property parameters

The parameters of the neurons in the population.

Return type:

RangeDictionary

property pop_seed

The seed to use for the population overall; a list of four integers.

Return type:

list(int)

property read_initial_values

Whether initial values need to be stored.

Return type:

bool

reset_to_first_timestep()[source]

Reset the object to first time step.

property ring_buffer_sigma
Return type:

float

property self_projection

Any projection from this vertex to itself.

Return type:

Projection or None

set_current_state_values(name, value, selector=None)[source]

Set the current values of a state variable for the whole Population or a subset if the selector is used.

Parameters:
Raises:

KeyError – if the variable is not something that can be changed

set_initial_state_values(name, value, selector=None)[source]

Set the initial values of a state variable for the whole Population or a subset if the selector is used.

Parameters:
Raises:

KeyError – if the variable is not something that can be changed

set_max_atoms_per_dimension_per_core(new_value)[source]

Set the maximum number of atoms per dimension per core.

Can be used to raise or lower the maximum number of atoms per core or per dimension per core.

Parameters:

new_value (None or int or tuple(int,...)) – Value to set. If the vertex is n-dimensional where n > 1, a tuple of n values must be given. If the vertex is 1 dimensional, a 1-tuple or integer can be given. If this is set to None the vertex will have atoms_shape as the maximum.

set_not_recording(name, indices=None)[source]

Set a variable not recording.

Parameters:
  • name (str) – The name of the variable to not record

  • indices (list(int) or None) – The list of neuron indices to not record or None for all

Raises:

KeyError – if the variable cannot be stopped from recording

set_parameter_values(name, value, selector=None)[source]

Set the values of a parameter for the whole Population or a subset if the selector is used.

Parameters:
Raises:

KeyError – if the parameter is not something that can be changed

set_recording(name, sampling_interval=None, indices=None)[source]

Set a variable recording.

Parameters:
  • name (str) – The name of the variable to set the status of

  • sampling_interval (float or None) – How often the variable should be recorded or None for every time step, in milliseconds

  • indices (list(int) or None) – The list of neuron indices to record or None for all

Raises:

KeyError – if the variable cannot be recorded

set_structure(structure)[source]

Set the structure of the object.

Parameters:

structure (BaseStructure) – The structure to set

set_synapse_dynamics(synapse_dynamics)[source]

Set the synapse dynamics of this population.

Parameters:

synapse_dynamics (AbstractSynapseDynamics) – The synapse dynamics to set

property size

The number of neurons in the vertex.

Return type:

int

property spikes_per_second
Return type:

float

property state_variables

The state variables of the neuron in the population.

Return type:

RangeDicationary

property synapse_dynamics

The synapse dynamics used by the synapses e.g. plastic or static. Settable.

Return type:

AbstractSynapseDynamics or None

property synapse_executable_suffix

The suffix of the executable name due to the type of synapses in use.

Return type:

str

property synapse_recordables

The names of variables that can be recorded by the synapses.

Return type:

list(str)

property synapse_recorder

The recorder for synapses.

Return type:

SynapseRecorder

property weight_scale
Return type:

float

class spynnaker.pyNN.models.neuron.AbstractPyNNNeuronModel(model)

Bases: AbstractPyNNModel

Parameters:

model (AbstractNeuronImpl) – The model implementation

create_vertex(n_neurons, label, spikes_per_second, ring_buffer_sigma, incoming_spike_buffer_size, drop_late_spikes, splitter, seed, n_colour_bits)[source]

Create a vertex for a population of the model.

Parameters:
  • n_neurons (int) – The number of neurons in the population

  • label (str) – The label to give to the vertex

  • spikes_per_second (float) –

  • ring_buffer_sigma (float) –

  • incoming_spike_buffer_size (int) –

  • drop_late_spikes (bool) –

  • splitter (AbstractSplitterCommon or None) –

  • seed (float) –

  • n_colour_bits (int) –

Returns:

An application vertex for the population

Return type:

PopulationApplicationVertex

default_population_parameters = {'drop_late_spikes': None, 'incoming_spike_buffer_size': None, 'n_colour_bits': None, 'ring_buffer_sigma': None, 'seed': None, 'spikes_per_second': None, 'splitter': None}
property name

The name of this model.

Return type:

str

class spynnaker.pyNN.models.neuron.AbstractPyNNNeuronModelStandard(model_name, binary, neuron_model, input_type, synapse_type, threshold_type, additional_input_type=None)

Bases: AbstractPyNNNeuronModel

A neuron model that follows the sPyNNaker standard composed model pattern for point neurons.

Parameters:
create_vertex(n_neurons, label, spikes_per_second, ring_buffer_sigma, incoming_spike_buffer_size, n_steps_per_timestep, drop_late_spikes, splitter, seed, n_colour_bits)[source]

Create a vertex for a population of the model.

Parameters:
  • n_neurons (int) – The number of neurons in the population

  • label (str) – The label to give to the vertex

  • spikes_per_second (float) –

  • ring_buffer_sigma (float) –

  • incoming_spike_buffer_size (int) –

  • drop_late_spikes (bool) –

  • splitter (AbstractSplitterCommon or None) –

  • seed (float) –

  • n_colour_bits (int) –

  • n_steps_per_timestep (int) –

Returns:

An application vertex for the population

Return type:

PopulationApplicationVertex

default_population_parameters = {'drop_late_spikes': None, 'incoming_spike_buffer_size': None, 'n_colour_bits': None, 'n_steps_per_timestep': 1, 'ring_buffer_sigma': None, 'seed': None, 'spikes_per_second': None, 'splitter': None}
class spynnaker.pyNN.models.neuron.ConnectionHolder(data_items_to_return, as_list, n_pre_atoms, n_post_atoms, connections=None, fixed_values=None, notify=None)

Bases: object

Holds a set of connections to be returned in a PyNN-specific format.

Parameters:
  • data_items_to_return (list(int) or tuple(int) or None) – A list of data fields to be returned

  • as_list (bool) – True if the data will be returned as a list, False if it is to be returned as a matrix (or series of matrices)

  • n_pre_atoms (int) – The number of atoms in the pre-vertex

  • n_post_atoms (int) – The number of atoms in the post-vertex

  • connections (list(ndarray) or None) – Any initial connections, as a numpy structured array of source, target, weight and delay

  • fixed_values (list(tuple(str,int)) or None) –

    A list of tuples of field names and fixed values to be appended to the other fields per connection, formatted as [(field_name, value), …].

    Note

    If the field is to be returned, the name must also appear in data_items_to_return, which determines the order of items in the result.

  • notify (callable(ConnectionHolder, None) or None) – A callback to call when the connections have all been added. This should accept a single parameter, which will contain the data requested

add_connections(connections)[source]

Add connections to the holder to be returned.

Parameters:

connections (ndarray) – The connection to add, as a numpy structured array of source, target, weight and delay

property connections

The connections stored.

Return type:

list(ndarray)

finish()[source]

Finish adding connections.

class spynnaker.pyNN.models.neuron.LocalOnlyProvenance

Bases: Structure

N_ITEMS = 4
max_size_input_buffer

Structure/Union member

max_spikes_per_timestep

Structure/Union member

n_spikes_dropped

Structure/Union member

n_spikes_lost_from_input

Structure/Union member

class spynnaker.pyNN.models.neuron.NeuronProvenance

Bases: Structure

Provenance items from neuron processing.

N_ITEMS = 4
current_timer_tick

Structure/Union member

earliest_send

Structure/Union member

latest_send

Structure/Union member

n_tdma_misses

Structure/Union member

class spynnaker.pyNN.models.neuron.NeuronRegions(core_params: int, neuron_params: int, current_source_params: int, neuron_recording: int, neuron_builder: int, initial_values: int)

Bases: object

Identifiers for neuron regions.

core_params: int
current_source_params: int
initial_values: int
neuron_builder: int
neuron_params: int
neuron_recording: int
class spynnaker.pyNN.models.neuron.PopulationMachineLocalOnlyCombinedVertex(sdram, label, app_vertex, vertex_slice, slice_index, ring_buffer_shifts, weight_scales, neuron_data, max_atoms_per_core)

Bases: PopulationMachineCommon, PopulationMachineNeurons, AbstractGeneratesDataSpecification, AbstractRewritesDataSpecification

A machine vertex for PyNN Populations.

Parameters:
  • sdram (AbstractSDRAM) – The SDRAM used by the vertex

  • label (str) – The label of the vertex

  • app_vertex (AbstractPopulationVertex) – The associated application vertex

  • vertex_slice (Slice) – The slice of the population that this implements

  • slice_index (int) – The index of the slice in the ordered list of slices

  • ring_buffer_shifts (list(int)) – The shifts to apply to convert ring buffer values to S1615 values

  • weight_scales (list(int)) – The scaling to apply to weights to store them in the synapses

  • all_syn_block_sz (int) – The maximum size of the synapses in bytes

  • structural_sz (int) – The size of the structural data

  • neuron_data (NeuronData) – The handler of neuron data

  • max_atoms_per_core (int) – The maximum number of atoms per core

BACKGROUND_MAX_QUEUED_NAME = 'Max_backgrounds_queued'
BACKGROUND_OVERLOADS_NAME = 'Times_the_background_queue_overloaded'
COMMON_REGIONS = CommonRegions(system=0, provenance=1, profile=2, recording=3)
INPUT_BUFFER_FULL_NAME = 'Times_the_input_buffer_lost_packets'
LOCAL_ONLY_SIZE = 20
MAX_FILLED_SIZE_OF_INPUT_BUFFER_NAME = 'Max_filled_size_input_buffer'
MAX_SPIKES_PER_TIME_STEP_NAME = 'Max_spikes_per_time_step'
NEURON_REGIONS = NeuronRegions(core_params=4, neuron_params=5, current_source_params=6, neuron_recording=7, neuron_builder=10, initial_values=11)
N_LATE_SPIKES_NAME = 'Number_of_late_spikes'
class REGIONS(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Regions for populations.

CORE_PARAMS = 4
CURRENT_SOURCE_PARAMS = 6
INITIAL_VALUES = 11
LOCAL_ONLY = 8
LOCAL_ONLY_PARAMS = 9
NEURON_BUILDER = 10
NEURON_PARAMS = 5
NEURON_RECORDING = 7
PROFILING = 2
PROVENANCE_DATA = 1
RECORDING = 3
SYSTEM = 0
generate_data_specification(spec, placement)[source]

Generate a data specification.

Parameters:
  • spec (DataSpecificationGenerator) – The data specification to write to

  • placement (Placement) – The placement the vertex is located at

get_recorded_region_ids()[source]

Get the recording region IDs that have been recorded using buffering.

Returns:

The region numbers that have active recording

Return type:

iterable(int)

parse_extra_provenance_items(label, x, y, p, provenance_data)[source]

Convert the remaining provenance words (those not in the standard set) into provenance items.

Called by get_provenance_data_from_machine()

Parameters:
  • label (str) – A descriptive label for the vertex (derived from label and placed position) to be used for provenance error reporting to the user.

  • x (int) – x coordinate of the chip where this core

  • y (int) – y coordinate of the core where this core

  • p (int) – virtual id of the core

  • provenance_data (list(int)) – The list of words of raw provenance data.

regenerate_data_specification(spec, placement)[source]

Regenerate the data specification, only generating regions that have changed and need to be reloaded.

Parameters:
  • spec (DataSpecificationGenerator) – Where to write the regenerated spec

  • placement (Placement) – Where are we regenerating for?

reload_required()[source]

Return true if any data region needs to be reloaded.

Return type:

bool

set_do_neuron_regeneration()[source]

Indicate that data re-generation of neuron parameters is required.

set_reload_required(new_value)[source]

Indicate that the regions have been reloaded.

Parameters:

new_value – the new value

class spynnaker.pyNN.models.neuron.PopulationMachineVertex(sdram, label, app_vertex, vertex_slice, slice_index, ring_buffer_shifts, weight_scales, structural_sz, max_atoms_per_core, synaptic_matrices, neuron_data)

Bases: PopulationMachineCommon, PopulationMachineNeurons, PopulationMachineSynapses, AbstractGeneratesDataSpecification, AbstractRewritesDataSpecification

A machine vertex for PyNN Populations.

Parameters:
  • sdram (AbstractSDRAM) – The SDRAM used by the vertex

  • label (str) – The label of the vertex

  • app_vertex (AbstractPopulationVertex) – The associated application vertex

  • vertex_slice (Slice) – The slice of the population that this implements

  • slice_index (int) – The index of the slice in the ordered list of slices

  • ring_buffer_shifts (list(int)) – The shifts to apply to convert ring buffer values to S1615 values

  • weight_scales (list(int)) – The scaling to apply to weights to store them in the synapses

  • structural_sz (int) – The size of the structural data

  • n_neuron_bits (int) – The number of bits to use for neuron IDs

  • synaptic_matrices (SynapticMatrices) – The synaptic matrices

  • neuron_data (NeuronData) – The handler of neuron data

BACKGROUND_MAX_QUEUED_NAME = 'Max_backgrounds_queued'
BACKGROUND_OVERLOADS_NAME = 'Times_the_background_queue_overloaded'
COMMON_REGIONS = CommonRegions(system=0, provenance=10, profile=11, recording=15)
DMA_COMPLETE = "DMA's that were completed"
INPUT_BUFFER_FULL_NAME = 'Times_the_input_buffer_lost_packets'
MAX_FILLED_SIZE_OF_INPUT_BUFFER_NAME = 'Max_filled_size_input_buffer'
NEURON_REGIONS = NeuronRegions(core_params=1, neuron_params=2, current_source_params=3, neuron_recording=9, neuron_builder=13, initial_values=16)
N_LATE_SPIKES_NAME = 'Number_of_late_spikes'
N_REWIRES_NAME = 'Number_of_rewires'
class REGIONS(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Regions for populations.

BIT_FIELD_FILTER = 14
CONNECTOR_BUILDER = 12
CORE_PARAMS = 1
CURRENT_SOURCE_PARAMS = 3
INITIAL_VALUES = 16
NEURON_BUILDER = 13
NEURON_PARAMS = 2
NEURON_RECORDING = 9
POPULATION_TABLE = 5
PROFILING = 11
PROVENANCE_DATA = 10
RECORDING = 15
STRUCTURAL_DYNAMICS = 8
SYNAPSE_DYNAMICS = 7
SYNAPSE_PARAMS = 4
SYNAPTIC_MATRIX = 6
SYSTEM = 0
SPIKES_PROCESSED = 'How many spikes were processed'
SYNAPSE_REGIONS = (4, 5, 6, 7, 8, 14, 12)
generate_data_specification(spec, placement)[source]

Generate a data specification.

Parameters:
  • spec (DataSpecificationGenerator) – The data specification to write to

  • placement (Placement) – The placement the vertex is located at

get_n_keys_for_partition(partition_id)[source]

Get the number of keys required by the given partition of edges.

Parameters:

partition_id (str) – The identifier of the partition; the partition_id param is only used by some MachineVertex subclasses

Returns:

The number of keys required

Return type:

int

get_recorded_region_ids()[source]

Get the recording region IDs that have been recorded using buffering.

Returns:

The region numbers that have active recording

Return type:

iterable(int)

parse_extra_provenance_items(label, x, y, p, provenance_data)[source]

Convert the remaining provenance words (those not in the standard set) into provenance items.

Called by get_provenance_data_from_machine()

Parameters:
  • label (str) – A descriptive label for the vertex (derived from label and placed position) to be used for provenance error reporting to the user.

  • x (int) – x coordinate of the chip where this core

  • y (int) – y coordinate of the core where this core

  • p (int) – virtual id of the core

  • provenance_data (list(int)) – The list of words of raw provenance data.

regenerate_data_specification(spec, placement)[source]

Regenerate the data specification, only generating regions that have changed and need to be reloaded.

Parameters:
  • spec (DataSpecificationGenerator) – Where to write the regenerated spec

  • placement (Placement) – Where are we regenerating for?

reload_required()[source]

Return true if any data region needs to be reloaded.

Return type:

bool

set_do_neuron_regeneration()[source]

Indicate that data re-generation of neuron parameters is required.

set_do_synapse_regeneration()[source]

Indicates that synaptic data regeneration is required.

set_reload_required(new_value)[source]

Indicate that the regions have been reloaded.

Parameters:

new_value – the new value

class spynnaker.pyNN.models.neuron.PopulationNeuronsMachineVertex(sdram, label, app_vertex, vertex_slice, slice_index, ring_buffer_shifts, weight_scales, neuron_data, max_atoms_per_core)

Bases: PopulationMachineCommon, PopulationMachineNeurons, AbstractGeneratesDataSpecification, AbstractRewritesDataSpecification, ReceivesSynapticInputsOverSDRAM

A machine vertex for the Neurons of PyNN Populations.

Parameters:
  • sdram (AbstractSDRAM) – The SDRAM used by the vertex

  • label (str) – The label of the vertex

  • app_vertex (AbstractPopulationVertex) – The associated application vertex

  • vertex_slice (Slice) – The slice of the population that this implements

  • slice_index (int) – The index of the slice in the ordered list of slices

  • ring_buffer_shifts (list(int)) – The shifts to apply to convert ring buffer values to S1615 values

  • weight_scales (list(int)) – The scaling to apply to weights to store them in the synapses

  • neuron_data (NeuronData) – The handler of neuron data

  • max_atoms_per_core (int) – The maximum number of atoms per core

COMMON_REGIONS = CommonRegions(system=0, provenance=2, profile=3, recording=4)
NEURON_REGIONS = NeuronRegions(core_params=1, neuron_params=5, current_source_params=6, neuron_recording=7, neuron_builder=9, initial_values=10)
class REGIONS(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Regions for populations.

CORE_PARAMS = 1
CURRENT_SOURCE_PARAMS = 6
INITIAL_VALUES = 10
NEURON_BUILDER = 9
NEURON_PARAMS = 5
NEURON_RECORDING = 7
PROFILING = 3
PROVENANCE_DATA = 2
RECORDING = 4
SDRAM_EDGE_PARAMS = 8
SYSTEM = 0
generate_data_specification(spec, placement)[source]

Generate a data specification.

Parameters:
  • spec (DataSpecificationGenerator) – The data specification to write to

  • placement (Placement) – The placement the vertex is located at

static get_n_bytes_for_transfer(n_neurons, n_synapse_types)[source]
get_n_keys_for_partition(partition_id)[source]

Get the number of keys required by the given partition of edges.

Parameters:

partition_id (str) – The identifier of the partition; the partition_id param is only used by some MachineVertex subclasses

Returns:

The number of keys required

Return type:

int

get_recorded_region_ids()[source]

Get the recording region IDs that have been recorded using buffering.

Returns:

The region numbers that have active recording

Return type:

iterable(int)

property n_bytes_for_transfer

The number of bytes to be sent over the channel. This will be calculated using the above numbers, but also rounded up to a number of words, and with the number of neurons rounded up to a power of 2.

Return type:

int

parse_extra_provenance_items(label, x, y, p, provenance_data)[source]

Convert the remaining provenance words (those not in the standard set) into provenance items.

Called by get_provenance_data_from_machine()

Parameters:
  • label (str) – A descriptive label for the vertex (derived from label and placed position) to be used for provenance error reporting to the user.

  • x (int) – x coordinate of the chip where this core

  • y (int) – y coordinate of the core where this core

  • p (int) – virtual id of the core

  • provenance_data (list(int)) – The list of words of raw provenance data.

regenerate_data_specification(spec, placement)[source]

Regenerate the data specification, only generating regions that have changed and need to be reloaded.

Parameters:
  • spec (DataSpecificationGenerator) – Where to write the regenerated spec

  • placement (Placement) – Where are we regenerating for?

reload_required()[source]

Return true if any data region needs to be reloaded.

Return type:

bool

sdram_requirement(sdram_machine_edge)[source]

Asks a machine vertex for the SDRAM requirement it needs.

Parameters:

sdram_machine_edge (SDRAMMachineEdge) – The SDRAM edge in question

Returns:

The size in bytes this vertex needs for the SDRAM edge.

Return type:

int (most likely a multiple of 4)

set_do_neuron_regeneration()[source]

Indicate that data re-generation of neuron parameters is required.

set_reload_required(new_value)[source]

Indicate that the regions have been reloaded.

Parameters:

new_value – the new value

set_sdram_partition(sdram_partition)[source]

Set the SDRAM partition. Must only be called once per instance.

Parameters:

sdram_partition (SourceSegmentedSDRAMMachinePartition) – The SDRAM partition to receive synapses from

property weight_scales

A list of scale factors to be applied to weights that get passed over SDRAM, one for each synapse type.

Return type:

list(int)

class spynnaker.pyNN.models.neuron.PopulationSynapsesMachineVertexCommon(sdram, label, app_vertex, vertex_slice)

Bases: PopulationMachineCommon, SendsSynapticInputsOverSDRAM

Common parts of a machine vertex for the synapses of a Population.

Parameters:
  • sdram (AbstractSDRAM) – The SDRAM used by the vertex

  • label (str) – The label of the vertex

  • app_vertex (AbstractPopulationVertex) – The associated application vertex

  • vertex_slice (Slice) – The slice of the population that this implements

COMMON_REGIONS = CommonRegions(system=0, provenance=1, profile=2, recording=3)
DMA_COMPLETE = "DMA's that were completed"
EARLIEST_RECEIVE = 'Earliest_receive_time'
INPUT_BUFFER_FULL_NAME = 'Times_the_input_buffer_lost_packets'
LATEST_RECEIVE = 'Latest_receive_time'
MAX_FILLED_SIZE_OF_INPUT_BUFFER_NAME = 'Max_filled_size_input_buffer'
MAX_SPIKES_PROCESSED = 'Max_spikes_processed_in_time_step'
MAX_SPIKES_RECEIVED = 'Max_spikes_received_in_time_step'
MAX_SPIKE_OVERFLOW = 'Max_spike_overflow_in_time_step'
MAX_TRANSFER_TIMER_OVERRUNS = 'Max_transfer_overrun'
N_LATE_SPIKES_NAME = 'Number_of_late_spikes'
N_REWIRES_NAME = 'Number_of_rewires'
N_SKIPPED_TIME_STEPS = 'Times_a_time_step_was_skipped'
N_TRANSFER_TIMER_OVERRUNS = 'Times_the_transfer_did_not_complete_in_time'
class REGIONS(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Regions for populations.

BIT_FIELD_FILTER = 9
CONNECTOR_BUILDER = 12
KEY_REGION = 11
POPULATION_TABLE = 6
PROFILING = 2
PROVENANCE_DATA = 1
RECORDING = 3
SDRAM_EDGE_PARAMS = 10
STRUCTURAL_DYNAMICS = 8
SYNAPSE_DYNAMICS = 7
SYNAPSE_PARAMS = 4
SYNAPTIC_MATRIX = 5
SYSTEM = 0
SPIKES_PROCESSED = 'How many spikes were processed'
SYNAPSE_REGIONS = (4, 6, 5, 7, 8, 9, 12)
get_recorded_region_ids()[source]

Get the recording region IDs that have been recorded using buffering.

Returns:

The region numbers that have active recording

Return type:

iterable(int)

parse_extra_provenance_items(label, x, y, p, provenance_data)[source]

Convert the remaining provenance words (those not in the standard set) into provenance items.

Called by get_provenance_data_from_machine()

Parameters:
  • label (str) – A descriptive label for the vertex (derived from label and placed position) to be used for provenance error reporting to the user.

  • x (int) – x coordinate of the chip where this core

  • y (int) – y coordinate of the core where this core

  • p (int) – virtual id of the core

  • provenance_data (list(int)) – The list of words of raw provenance data.

sdram_requirement(sdram_machine_edge)[source]

Asks a machine vertex for the SDRAM requirement it needs.

Parameters:

sdram_machine_edge (SDRAMMachineEdge) – The SDRAM edge in question

Returns:

The size in bytes this vertex needs for the SDRAM edge.

Return type:

int (most likely a multiple of 4)

set_neuron_vertex_and_partition_id(neuron_vertex, partition_id)[source]

Set the neuron vertex and partition ID for the case with a self-connection.

Parameters:

neuron_to_synapse_edge (MachineEdge) – The edge that we will receive spikes from

set_sdram_partition(sdram_partition)[source]

Set the SDRAM partition. Must only be called once per instance.

Parameters:

sdram_partition (SourceSegmentedSDRAMMachinePartition) – The SDRAM partition to receive synapses from

class spynnaker.pyNN.models.neuron.PopulationSynapsesMachineVertexLead(sdram, label, app_vertex, vertex_slice, ring_buffer_shifts, weight_scales, structural_sz, synapse_references, max_atoms_per_core, synaptic_matrices)

Bases: PopulationSynapsesMachineVertexCommon, PopulationMachineSynapses, AbstractGeneratesDataSpecification, AbstractRewritesDataSpecification

A synaptic machine vertex that leads other synaptic machine vertices, writing shared areas.

Parameters:
  • sdram (AbstractSDRAM) – The SDRAM used by the vertex

  • label (str) – The label of the vertex

  • app_vertex (AbstractPopulationVertex) – The associated application vertex

  • vertex_slice (Slice) – The slice of the population that this implements

generate_data_specification(spec, placement)[source]

Generate a data specification.

Parameters:
  • spec (DataSpecificationGenerator) – The data specification to write to

  • placement (Placement) – The placement the vertex is located at

get_recorded_region_ids()[source]

Get the recording region IDs that have been recorded using buffering.

Returns:

The region numbers that have active recording

Return type:

iterable(int)

regenerate_data_specification(spec, placement)[source]

Regenerate the data specification, only generating regions that have changed and need to be reloaded.

Parameters:
  • spec (DataSpecificationGenerator) – Where to write the regenerated spec

  • placement (Placement) – Where are we regenerating for?

reload_required()[source]

Return true if any data region needs to be reloaded.

Return type:

bool

set_do_synapse_regeneration()[source]

Indicates that synaptic data regeneration is required.

set_reload_required(new_value)[source]

Indicate that the regions have been reloaded.

Parameters:

new_value – the new value

class spynnaker.pyNN.models.neuron.PopulationSynapsesMachineVertexShared(sdram, label, app_vertex, vertex_slice, synapse_references)

Bases: PopulationSynapsesMachineVertexCommon, PopulationMachineSynapsesProvenance, AbstractGeneratesDataSpecification

A machine vertex for PyNN Populations.

Parameters:
  • sdram (AbstractSDRAM) – The SDRAM used by the vertex

  • label (str) – The label of the vertex

  • app_vertex (AbstractPopulationVertex) – The associated application vertex

  • vertex_slice (Slice) – The slice of the population that this implements

generate_data_specification(spec, placement)[source]

Generate a data specification.

Parameters:
  • spec (DataSpecificationGenerator) – The data specification to write to

  • placement (Placement) – The placement the vertex is located at

class spynnaker.pyNN.models.neuron.SpikeProcessingFastProvenance

Bases: Structure

N_ITEMS = 14
earliest_receive

Structure/Union member

latest_receive

Structure/Union member

max_size_input_buffer

Structure/Union member

max_spikes_overflow

Structure/Union member

max_spikes_processed

Structure/Union member

max_spikes_received

Structure/Union member

max_transfer_timer_overrun

Structure/Union member

n_buffer_overflows

Structure/Union member

n_dmas_complete

Structure/Union member

n_late_packets

Structure/Union member

n_rewires

Structure/Union member

n_skipped_time_steps

Structure/Union member

n_spikes_processed

Structure/Union member

n_transfer_timer_overruns

Structure/Union member

class spynnaker.pyNN.models.neuron.SpikeProcessingProvenance

Bases: Structure

N_ITEMS = 6
max_size_input_buffer

Structure/Union member

n_buffer_overflows

Structure/Union member

n_dmas_complete

Structure/Union member

n_late_packets

Structure/Union member

n_rewires

Structure/Union member

n_spikes_processed

Structure/Union member

class spynnaker.pyNN.models.neuron.SynapseProvenance

Bases: Structure

Provenance items from synapse processing.

N_ITEMS = 10
max_late_spike

Structure/Union member

n_failed_bitfield_reads

Structure/Union member

n_filtered_by_bitfield

Structure/Union member

n_ghost_searches

Structure/Union member

n_invalid_pop_table_hits

Structure/Union member

n_late_spikes

Structure/Union member

n_plastic_saturations

Structure/Union member

n_pre_synaptic_events

Structure/Union member

n_saturations

Structure/Union member

n_skipped_synapses

Structure/Union member