Skip to content

Commit

Permalink
Rename functions
Browse files Browse the repository at this point in the history
  • Loading branch information
rowleya committed Oct 14, 2024
1 parent d585f9a commit f43a306
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def generate_data_specification(

# Get the key
routing_info = SpynnakerDataView.get_routing_infos()
edge_key = routing_info.get_safe_first_key_from_pre_vertex(
edge_key = routing_info.get_key_from(
placement.vertex, self.MOTOR_PARTITION_ID)

# write params to memory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def new_key_command_payload(self):
:rtype: int
"""
routing_info = SpynnakerDataView.get_routing_infos()
key = routing_info.get_safe_first_key_from_pre_vertex(
key = routing_info.get_key_from(
self, SPIKE_PARTITION_ID)
return key

Expand Down
8 changes: 4 additions & 4 deletions spynnaker/pyNN/external_devices_models/spif_output_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def _get_set_key_payload(self, index):
:rtype: int
"""
r_infos = SpynnakerDataView.get_routing_infos()
return r_infos.get_safe_first_key_from_pre_vertex(
return r_infos.get_key_from(
self.__incoming_partitions[index].pre_vertex,
self.__incoming_partitions[index].identifier)

Expand All @@ -182,15 +182,15 @@ def _get_set_mask_payload(self, index):
:rtype: int
"""
r_infos = SpynnakerDataView.get_routing_infos()
return r_infos.get_safe_routing_info_from_pre_vertex(
return r_infos.get_info_from(
self.__incoming_partitions[index].pre_vertex,
self.__incoming_partitions[index].identifier).mask

def _get_set_dist_mask_payload(self, index):
""" Get the payload for the command to set the distiller mask
"""
r_infos = SpynnakerDataView.get_routing_infos()
return ~r_infos.get_safe_routing_info_from_pre_vertex(
return ~r_infos.get_info_from(
self.__incoming_partitions[index].pre_vertex,
self.__incoming_partitions[index].identifier).mask & 0xFFFFFFFF

Expand Down Expand Up @@ -246,7 +246,7 @@ def get_device_output_keys(self) -> Dict[MachineVertex,
m_vertex, part.identifier, routing_infos)
else:
r_info = \
routing_infos.get_safe_routing_info_from_pre_vertex(
routing_infos.get_info_from(
m_vertex, part.identifier)
vertex_slice = m_vertex.vertex_slice
keys = get_keys(r_info.key, vertex_slice)
Expand Down
2 changes: 1 addition & 1 deletion spynnaker/pyNN/models/common/local_only_2d_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def get_rinfo_for_spike_source(pre_vertex, partition_id):
routing_info = SpynnakerDataView.get_routing_infos()

# Find the routing information
r_info = routing_info.get_safe_routing_info_from_pre_vertex(
r_info = routing_info.get_info_from(
pre_vertex, partition_id)

n_cores = len(r_info.vertex.splitter.get_out_going_vertices(partition_id))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ def n_colour_bits(self) -> int:
def get_atom_key_map(
self, pre_vertex: MachineVertex, partition_id: str,
routing_info: RoutingInfo) -> Iterable[Tuple[int, int]]:
base_key = routing_info.get_safe_first_key_from_pre_vertex(
base_key = routing_info.get_key_from(
pre_vertex, partition_id)
vertex_slice = pre_vertex.vertex_slice
keys = get_keys(base_key, vertex_slice, self.n_colour_bits)
Expand Down
6 changes: 3 additions & 3 deletions spynnaker/pyNN/models/neuron/population_machine_neurons.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,18 +235,18 @@ def _write_neuron_data_spec(
def __find_default_key(self) -> Optional[int]:
routing_info = SpynnakerDataView.get_routing_infos()
if not self._pop_vertex.extra_partitions:
return routing_info.get_single_first_key_from_pre_vertex(
return routing_info.get_single_key_from(
cast(AbstractVertex, self))
partition_ids = set(
routing_info.get_partitions_outgoing_from_vertex(
routing_info.get_partitions_from(
cast(AbstractVertex, self)))
partition_ids = partition_ids - set(self._pop_vertex.extra_partitions)
if len(partition_ids) > 1:
raise ValueError(
"Multiple outgoing partitions found, cannot determine key")
if len(partition_ids) == 0:
return None
return routing_info.get_safe_first_key_from_pre_vertex(
return routing_info.get_key_from(
cast(AbstractVertex, self), next(iter(partition_ids)))

def _rewrite_neuron_data_spec(self, spec: DataSpecificationReloader):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def _write_key_spec(self, spec: DataSpecificationGenerator):
else:
assert self.__partition_id is not None
routing_info = SpynnakerDataView.get_routing_infos()
r_info = routing_info.get_safe_routing_info_from_pre_vertex(
r_info = routing_info.get_info_from(
self.__neuron_vertex, self.__partition_id)
spec.write_value(r_info.key)
spec.write_value(r_info.mask)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def __write_prepopulation_info(
spec.write_value(app_edge.pre_vertex.n_atoms)
# Machine edge information
for sub, m_vertex in enumerate(out_verts):
r_info = routing_info.get_safe_routing_info_from_pre_vertex(
r_info = routing_info.get_info_from(
m_vertex, synapse_info.partition_id)
vertex_slice = m_vertex.vertex_slice
spec.write_value(r_info.key)
Expand Down
4 changes: 2 additions & 2 deletions spynnaker/pyNN/models/neuron/synaptic_matrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def __app_key_and_mask(
The synapse information of the projection
"""
routing_info = SpynnakerDataView.get_routing_infos()
r_info = routing_info.get_safe_routing_info_from_pre_vertex(
r_info = routing_info.get_info_from(
app_edge.pre_vertex, s_info.partition_id)
assert isinstance(r_info, AppVertexRoutingInfo)
return self.__get_app_key_and_mask(
Expand All @@ -513,7 +513,7 @@ def __delay_app_key_and_mask(
if delay_edge is None:
return None
routing_info = SpynnakerDataView.get_routing_infos()
r_info = routing_info.get_safe_routing_info_from_pre_vertex(
r_info = routing_info.get_info_from(
delay_edge.pre_vertex, s_info.partition_id)
assert isinstance(r_info, AppVertexRoutingInfo)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def _write_poisson_parameters(self, spec: DataSpecificationBase):

# Write Key info for this core:
routing_info = SpynnakerDataView.get_routing_infos()
key = routing_info.get_single_first_key_from_pre_vertex(self)
key = routing_info.get_single_key_from(self)
keys: Union[Sequence[int], numpy.ndarray]
if key is None:
spec.write_value(0)
Expand All @@ -520,7 +520,7 @@ def _write_poisson_parameters(self, spec: DataSpecificationBase):
incoming_mask = 0
if self._pop_vertex.incoming_control_edge is not None:
routing_info = SpynnakerDataView.get_routing_infos()
r_info = routing_info.get_safe_routing_info_from_pre_vertex(
r_info = routing_info.get_info_from(
self._pop_vertex.incoming_control_edge.pre_vertex,
LIVE_POISSON_CONTROL_PARTITION_ID)
incoming_mask = ~r_info.mask & 0xFFFFFFFF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,13 @@ def generate_data_specification(
spec.comment("\n*** Spec for Delay Extension Instance ***\n\n")

routing_infos = SpynnakerDataView.get_routing_infos()
key = routing_infos.get_single_first_key_from_pre_vertex(vertex)
key = routing_infos.get_single_key_from(vertex)

srcs = self.app_vertex.source_vertex.splitter.get_out_going_vertices(
self.app_vertex.partition.identifier)
for source_vertex in srcs:
if source_vertex.vertex_slice == self.vertex_slice:
r_info = routing_infos.get_safe_routing_info_from_pre_vertex(
r_info = routing_infos.get_info_from(
source_vertex, self.app_vertex.partition.identifier)
incoming_key = r_info.key
incoming_mask = r_info.mask
Expand Down
4 changes: 2 additions & 2 deletions spynnaker/pyNN/utilities/bit_field_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ def get_bitfield_key_map_data(
routing_infos = SpynnakerDataView.get_routing_infos()
sources = []
for in_edge, part_id in _unique_edges(incoming_projections):
key = routing_infos.get_safe_first_key_from_pre_vertex(
key = routing_infos.get_key_from(
in_edge.pre_vertex, part_id)
sources.append([key, in_edge.pre_vertex.n_atoms])
if in_edge.delay_edge is not None:
delay_key = routing_infos.get_safe_first_key_from_pre_vertex(
delay_key = routing_infos.get_key_from(
in_edge.delay_edge.pre_vertex, part_id)
n_delay_atoms = (
in_edge.pre_vertex.n_atoms * in_edge.n_delay_stages)
Expand Down

0 comments on commit f43a306

Please sign in to comment.