Skip to content

Commit

Permalink
use vertex_slice property
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Oct 24, 2023
1 parent eea3d3d commit bc0668f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion spynnaker/pyNN/models/neuron/population_machine_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,4 @@ def get_binary_file_name(self):
@overrides(MachineVertex.get_n_keys_for_partition)
def get_n_keys_for_partition(self, partition_id):
# Colour each time slot with up to 16 colours to allow for delays
return self._vertex_slice.n_atoms * 16
return self.vertex_slice.n_atoms * 16
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,4 @@ def set_do_neuron_regeneration(self):
@overrides(PopulationMachineCommon.get_n_keys_for_partition)
def get_n_keys_for_partition(self, partition_id):
n_colours = 2 ** self._app_vertex.n_colour_bits
return self._vertex_slice.n_atoms * n_colours
return self.vertex_slice.n_atoms * n_colours
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ def _fill_send_buffer_1d(self, key_base):
if first_time_step == end_time_step:
return
keys = get_field_based_keys(
key_base, self._vertex_slice, self.app_vertex.n_colour_bits)
key_base, self.vertex_slice, self.app_vertex.n_colour_bits)
key_list = numpy.array(
[keys[atom] for atom in range(self._vertex_slice.n_atoms)])
[keys[atom] for atom in range(self.vertex_slice.n_atoms)])
colour_mask = (2 ** self.app_vertex.n_colour_bits) - 1
for tick in sorted(self._send_buffer_times):
if self._is_in_range(tick, first_time_step, end_time_step):
Expand All @@ -54,9 +54,9 @@ def _fill_send_buffer_2d(self, key_base):
if first_time_step == end_time_step:
return
keys = get_field_based_keys(
key_base, self._vertex_slice, self.app_vertex.n_colour_bits)
key_base, self.vertex_slice, self.app_vertex.n_colour_bits)
colour_mask = (2 ** self.app_vertex.n_colour_bits) - 1
for atom in range(self._vertex_slice.n_atoms):
for atom in range(self.vertex_slice.n_atoms):
for tick in sorted(self._send_buffer_times[atom]):
if self._is_in_range(tick, first_time_step, end_time_step):
self._send_buffer.add_key(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ def read_parameters_from_machine(self, placement):
self.__poisson_rate_region_address(placement))

# get size of poisson params
n_atoms = self._vertex_slice.n_atoms
n_atoms = self.vertex_slice.n_atoms
n_rates = n_atoms * self._app_vertex.max_n_rates
size_of_region = get_rates_bytes(n_atoms, n_rates)

Expand All @@ -538,8 +538,8 @@ def read_parameters_from_machine(self, placement):

# For each atom, read the number of rates and the rate parameters
offset = 0
for i in range(self._vertex_slice.lo_atom,
self._vertex_slice.hi_atom + 1):
for i in range(self.vertex_slice.lo_atom,
self.vertex_slice.hi_atom + 1):
n_rates, = _ONE_WORD.unpack_from(byte_array, offset)
# Skip the count and index
offset += PARAMS_WORDS_PER_NEURON * BYTES_PER_WORD
Expand All @@ -562,4 +562,4 @@ def sdram_requirement(self, sdram_machine_edge):
@overrides(MachineVertex.get_n_keys_for_partition)
def get_n_keys_for_partition(self, partition_id):
n_colours = 2 ** self.app_vertex.n_colour_bits
return self._vertex_slice.n_atoms * n_colours
return self.vertex_slice.n_atoms * n_colours
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def generate_data_specification(self, spec, placement):
break

self.write_delay_parameters(
spec, self._vertex_slice, key, incoming_key, incoming_mask)
spec, self.vertex_slice, key, incoming_key, incoming_mask)

# End-of-Spec:
spec.end_specification()
Expand Down

0 comments on commit bc0668f

Please sign in to comment.