Skip to content

Commit

Permalink
Merge pull request #72 from SpiNNakerManchester/allow_different_parti…
Browse files Browse the repository at this point in the history
…tions

Allow different partitions
  • Loading branch information
rowleya authored Oct 14, 2024
2 parents fdaa873 + fbe0aec commit eb3f99c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
**/results*.npy
c_models/Debug/
c_models/Release/
/.mypy_cache/
/.pytest_cache/
16 changes: 7 additions & 9 deletions mcmc/mcmc_coordinator_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ def get_data_window_size(self, placement):

def get_sequence_mask(self, placement, routing_info):
if self._is_receiver_placement(placement):
mask = routing_info.get_routing_info_from_pre_vertex(
mask = routing_info.get_info_from(
self, self._data_partition_name).mask
return ~mask & 0xFFFFFFFF
return 0

def get_acknowledge_key(self, placement, routing_info):
if self._is_receiver_placement(placement):
key = routing_info.get_first_key_from_pre_vertex(
key = routing_info.get_key_from(
placement.vertex, self._acknowledge_partition_name)
return key
return 0
Expand Down Expand Up @@ -224,10 +224,9 @@ def generate_data_specification(
mcmc_placement = FecDataView.get_placement_of_vertex(vertex)
self._mcmc_placements.append(mcmc_placement)
if self._is_receiver_placement(mcmc_placement):
key = routing_info.get_first_key_from_pre_vertex(
key = routing_info.get_key_from(
vertex, self._acknowledge_partition_name)
if key is not None:
keys.append(key)
keys.append(key)
keys.sort()

# Write the data size in words
Expand All @@ -239,17 +238,16 @@ def generate_data_specification(
spec.write_value(len(keys), data_type=DataType.UINT32)

# Write the key
vertex_routing_info = routing_info.get_routing_info_from_pre_vertex(
vtx_routing_info = routing_info.get_info_from(
self, self._data_partition_name)
assert vertex_routing_info is not None
spec.write_value(vertex_routing_info.key, data_type=DataType.UINT32)
spec.write_value(vtx_routing_info.key, data_type=DataType.UINT32)

# Write the window size
spec.write_value(self._window_size, data_type=DataType.UINT32)

# Write the sequence mask
spec.write_value(
~vertex_routing_info.mask & 0xFFFFFFFF, data_type=DataType.UINT32)
~vtx_routing_info.mask & 0xFFFFFFFF, data_type=DataType.UINT32)

# Write the timer
spec.write_value(self._send_timer, data_type=DataType.UINT32)
Expand Down
18 changes: 8 additions & 10 deletions mcmc/mcmc_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def _get_model_state_array(self):
def get_result_key(self, placement):
if self._is_receiver_placement(placement):
routing_info = FecDataView.get_routing_infos()
key = routing_info.get_first_key_from_pre_vertex(
key = routing_info.get_key_from(
placement.vertex, self._result_partition_name)
return key
return 0
Expand All @@ -163,7 +163,7 @@ def _is_receiver_placement(self, placement):
def get_cholesky_result_key(self, placement):
if self._is_cholesky_receiver_placement(placement):
routing_info = FecDataView.get_routing_infos()
key = routing_info.get_first_key_from_pre_vertex(
key = routing_info.get_key_from(
placement.vertex, self._cholesky_result_partition_name)
return key
return 0
Expand Down Expand Up @@ -259,19 +259,17 @@ def generate_data_specification(
spec.write_value(self._coordinator.acknowledge_timer)

# Write the (first) key for sending parameter data, if needed
if (self._model.root_finder):
routing_info_rf = routing_info.get_routing_info_from_pre_vertex(
if self._model.root_finder:
rinfo_rf = routing_info.get_info_from(
self, self._parameter_partition_name)
assert routing_info_rf is not None
spec.write_value(routing_info_rf.key, data_type=DataType.UINT32)
spec.write_value(rinfo_rf.key, data_type=DataType.UINT32)
else:
spec.write_value(0, data_type=DataType.UINT32)

if (self._model.cholesky):
routing_info_ch = routing_info.get_routing_info_from_pre_vertex(
if self._model.cholesky:
rinfo_ch = routing_info.get_info_from(
self, self._cholesky_partition_name)
assert routing_info_ch is not None
spec.write_value(routing_info_ch.key, data_type=DataType.UINT32)
spec.write_value(rinfo_ch.key, data_type=DataType.UINT32)
else:
spec.write_value(0, data_type=DataType.UINT32)

Expand Down

0 comments on commit eb3f99c

Please sign in to comment.