From 4cb2af4511f5cbfadcf5eb943fdee9a2021999de Mon Sep 17 00:00:00 2001 From: Andrew Rowley Date: Thu, 10 Oct 2024 11:19:11 +0100 Subject: [PATCH 1/2] Replace deprecated function calls --- spinn_pdp2/input_vertex.py | 6 ++---- spinn_pdp2/sum_vertex.py | 12 ++++-------- spinn_pdp2/threshold_vertex.py | 9 +++------ spinn_pdp2/weight_vertex.py | 12 ++++-------- 4 files changed, 13 insertions(+), 26 deletions(-) diff --git a/spinn_pdp2/input_vertex.py b/spinn_pdp2/input_vertex.py index 1ad1184..8a54236 100644 --- a/spinn_pdp2/input_vertex.py +++ b/spinn_pdp2/input_vertex.py @@ -294,15 +294,13 @@ def generate_machine_data_specification( spec.switch_write_focus (MLPRegions.ROUTING.value) # write link keys: fwd - key = routing_info.get_first_key_from_pre_vertex( + key = routing_info.get_safe_first_key_from_pre_vertex( self, self.fwd_link) - assert key is not None spec.write_value(key, data_type=DataType.UINT32) # write link keys: bkp - key = routing_info.get_first_key_from_pre_vertex( + key = routing_info.get_safe_first_key_from_pre_vertex( self, self.bkp_link) - assert key is not None spec.write_value (key, data_type = DataType.UINT32) # write link keys: bps (padding) diff --git a/spinn_pdp2/sum_vertex.py b/spinn_pdp2/sum_vertex.py index 9158283..6c6a02a 100644 --- a/spinn_pdp2/sum_vertex.py +++ b/spinn_pdp2/sum_vertex.py @@ -319,15 +319,13 @@ def generate_machine_data_specification( spec.switch_write_focus (MLPRegions.ROUTING.value) # write link keys: fwd - key = routing_info.get_first_key_from_pre_vertex( + key = routing_info.get_safe_first_key_from_pre_vertex( self, self.fwd_link) - assert key is not None spec.write_value(key, data_type=DataType.UINT32) # write link keys: bkp - key = routing_info.get_first_key_from_pre_vertex( + key = routing_info.get_safe_first_key_from_pre_vertex( self, self.bkp_link) - assert key is not None spec.write_value(key, data_type=DataType.UINT32) # write link keys: bps (padding) @@ -337,15 +335,13 @@ def generate_machine_data_specification( spec.write_value (0, data_type = DataType.UINT32) # write link keys: lds - key = routing_info.get_first_key_from_pre_vertex( + key = routing_info.get_safe_first_key_from_pre_vertex( self, self.lds_link) - assert key is not None spec.write_value(key, data_type=DataType.UINT32) # write link keys: fsg - key = routing_info.get_first_key_from_pre_vertex ( + key = routing_info.get_safe_first_key_from_pre_vertex ( self, self.fsg_link) - assert key is not None spec.write_value(key, data_type=DataType.UINT32) # Reserve and write the stage configuration region diff --git a/spinn_pdp2/threshold_vertex.py b/spinn_pdp2/threshold_vertex.py index 2932203..159c633 100644 --- a/spinn_pdp2/threshold_vertex.py +++ b/spinn_pdp2/threshold_vertex.py @@ -483,24 +483,21 @@ def generate_machine_data_specification( spec.switch_write_focus (MLPRegions.ROUTING.value) # write link keys: fwd - key = routing_info.get_first_key_from_pre_vertex( + key = routing_info.get_safe_first_key_from_pre_vertex( self, self.fwd_link) - assert key is not None spec.write_value(key, data_type=DataType.UINT32) # write link keys: bkp - key = routing_info.get_first_key_from_pre_vertex( + key = routing_info.get_safe_first_key_from_pre_vertex( self, self.bkp_link) - assert key is not None spec.write_value (key, data_type = DataType.UINT32) # write link keys: bps (padding) spec.write_value (0, data_type = DataType.UINT32) # write link keys: stp - key = routing_info.get_first_key_from_pre_vertex( + key = routing_info.get_safe_first_key_from_pre_vertex( self, self.stp_link) - assert key is not None spec.write_value(key, data_type=DataType.UINT32) # write link keys: lds (padding) diff --git a/spinn_pdp2/weight_vertex.py b/spinn_pdp2/weight_vertex.py index f7598dd..3df59cd 100644 --- a/spinn_pdp2/weight_vertex.py +++ b/spinn_pdp2/weight_vertex.py @@ -353,15 +353,13 @@ def generate_machine_data_specification( spec.switch_write_focus (MLPRegions.ROUTING.value) # write link keys: fwd - key = routing_info.get_first_key_from_pre_vertex( + key = routing_info.get_safe_first_key_from_pre_vertex( self, self.fwd_link) - assert key is not None spec.write_value(key, data_type=DataType.UINT32) # write link keys: bkp - key = routing_info.get_first_key_from_pre_vertex( + key = routing_info.get_safe_first_key_from_pre_vertex( self, self.bkp_link) - assert key is not None spec.write_value(key, data_type=DataType.UINT32) # write link keys: bps (padding) @@ -371,15 +369,13 @@ def generate_machine_data_specification( spec.write_value (0, data_type = DataType.UINT32) # write link keys: lds - key = routing_info.get_first_key_from_pre_vertex( + key = routing_info.get_safe_first_key_from_pre_vertex( self, self.lds_link) - assert key is not None spec.write_value(key, data_type=DataType.UINT32) # write link keys: fsg - key = routing_info.get_first_key_from_pre_vertex( + key = routing_info.get_safe_first_key_from_pre_vertex( self, self.fsg_link) - assert key is not None spec.write_value(key, data_type=DataType.UINT32) # Reserve and write the stage configuration region From d90bcbf0f5e8eae709ed2f896399951448e7adab Mon Sep 17 00:00:00 2001 From: Andrew Rowley Date: Mon, 14 Oct 2024 14:00:57 +0100 Subject: [PATCH 2/2] Rename functions --- spinn_pdp2/input_vertex.py | 4 ++-- spinn_pdp2/sum_vertex.py | 8 ++++---- spinn_pdp2/threshold_vertex.py | 6 +++--- spinn_pdp2/weight_vertex.py | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/spinn_pdp2/input_vertex.py b/spinn_pdp2/input_vertex.py index 8a54236..1503e23 100644 --- a/spinn_pdp2/input_vertex.py +++ b/spinn_pdp2/input_vertex.py @@ -294,12 +294,12 @@ def generate_machine_data_specification( spec.switch_write_focus (MLPRegions.ROUTING.value) # write link keys: fwd - key = routing_info.get_safe_first_key_from_pre_vertex( + key = routing_info.get_key_from( self, self.fwd_link) spec.write_value(key, data_type=DataType.UINT32) # write link keys: bkp - key = routing_info.get_safe_first_key_from_pre_vertex( + key = routing_info.get_key_from( self, self.bkp_link) spec.write_value (key, data_type = DataType.UINT32) diff --git a/spinn_pdp2/sum_vertex.py b/spinn_pdp2/sum_vertex.py index 6c6a02a..6d72b5b 100644 --- a/spinn_pdp2/sum_vertex.py +++ b/spinn_pdp2/sum_vertex.py @@ -319,12 +319,12 @@ def generate_machine_data_specification( spec.switch_write_focus (MLPRegions.ROUTING.value) # write link keys: fwd - key = routing_info.get_safe_first_key_from_pre_vertex( + key = routing_info.get_key_from( self, self.fwd_link) spec.write_value(key, data_type=DataType.UINT32) # write link keys: bkp - key = routing_info.get_safe_first_key_from_pre_vertex( + key = routing_info.get_key_from( self, self.bkp_link) spec.write_value(key, data_type=DataType.UINT32) @@ -335,12 +335,12 @@ def generate_machine_data_specification( spec.write_value (0, data_type = DataType.UINT32) # write link keys: lds - key = routing_info.get_safe_first_key_from_pre_vertex( + key = routing_info.get_key_from( self, self.lds_link) spec.write_value(key, data_type=DataType.UINT32) # write link keys: fsg - key = routing_info.get_safe_first_key_from_pre_vertex ( + key = routing_info.get_key_from ( self, self.fsg_link) spec.write_value(key, data_type=DataType.UINT32) diff --git a/spinn_pdp2/threshold_vertex.py b/spinn_pdp2/threshold_vertex.py index 159c633..b01c0e1 100644 --- a/spinn_pdp2/threshold_vertex.py +++ b/spinn_pdp2/threshold_vertex.py @@ -483,12 +483,12 @@ def generate_machine_data_specification( spec.switch_write_focus (MLPRegions.ROUTING.value) # write link keys: fwd - key = routing_info.get_safe_first_key_from_pre_vertex( + key = routing_info.get_key_from( self, self.fwd_link) spec.write_value(key, data_type=DataType.UINT32) # write link keys: bkp - key = routing_info.get_safe_first_key_from_pre_vertex( + key = routing_info.get_key_from( self, self.bkp_link) spec.write_value (key, data_type = DataType.UINT32) @@ -496,7 +496,7 @@ def generate_machine_data_specification( spec.write_value (0, data_type = DataType.UINT32) # write link keys: stp - key = routing_info.get_safe_first_key_from_pre_vertex( + key = routing_info.get_key_from( self, self.stp_link) spec.write_value(key, data_type=DataType.UINT32) diff --git a/spinn_pdp2/weight_vertex.py b/spinn_pdp2/weight_vertex.py index 3df59cd..f3bb8eb 100644 --- a/spinn_pdp2/weight_vertex.py +++ b/spinn_pdp2/weight_vertex.py @@ -353,12 +353,12 @@ def generate_machine_data_specification( spec.switch_write_focus (MLPRegions.ROUTING.value) # write link keys: fwd - key = routing_info.get_safe_first_key_from_pre_vertex( + key = routing_info.get_key_from( self, self.fwd_link) spec.write_value(key, data_type=DataType.UINT32) # write link keys: bkp - key = routing_info.get_safe_first_key_from_pre_vertex( + key = routing_info.get_key_from( self, self.bkp_link) spec.write_value(key, data_type=DataType.UINT32) @@ -369,12 +369,12 @@ def generate_machine_data_specification( spec.write_value (0, data_type = DataType.UINT32) # write link keys: lds - key = routing_info.get_safe_first_key_from_pre_vertex( + key = routing_info.get_key_from( self, self.lds_link) spec.write_value(key, data_type=DataType.UINT32) # write link keys: fsg - key = routing_info.get_safe_first_key_from_pre_vertex( + key = routing_info.get_key_from( self, self.fsg_link) spec.write_value(key, data_type=DataType.UINT32)