Skip to content

Commit

Permalink
Replace deprecated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
rowleya committed Oct 10, 2024
1 parent 1d2e066 commit 06da3d7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 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/
9 changes: 4 additions & 5 deletions mcmc/mcmc_coordinator_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ 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_safe_routing_info_from_pre_vertex(
self, self._data_partition_name).mask
return ~mask & 0xFFFFFFFF
return 0
Expand Down Expand Up @@ -239,17 +239,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_safe_routing_info_from_pre_vertex(
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
14 changes: 6 additions & 8 deletions mcmc/mcmc_vertex.py
Original file line number Diff line number Diff line change
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_safe_routing_info_from_pre_vertex(
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_safe_routing_info_from_pre_vertex(
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 06da3d7

Please sign in to comment.