Skip to content

Commit

Permalink
Merge branch 'master' into use_build
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Jun 24, 2024
2 parents 7d8a726 + f843794 commit 0a5247e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 17 deletions.
19 changes: 13 additions & 6 deletions gfe_examples/sync_test/sync_test_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,27 @@

from enum import IntEnum
import logging

from spinn_utilities.log import FormatAdapter
from spinn_utilities.overrides import overrides

from spinnman.model.enums import ExecutableType

from pacman.model.graphs.application.abstract import (
AbstractOneAppOneMachineVertex)
from pacman.model.graphs.machine import MachineVertex
from pacman.model.placements import Placement
from pacman.model.resources import ConstantSDRAM

from spinn_front_end_common.data import FecDataView
from spinn_front_end_common.interface.ds import DataSpecificationGenerator
from spinn_front_end_common.utilities.constants import (
SYSTEM_BYTES_REQUIREMENT, BYTES_PER_WORD)
from spinn_front_end_common.abstract_models import (
AbstractGeneratesDataSpecification, AbstractHasAssociatedBinary)

from spinnaker_graph_front_end.utilities.data_utils import (
generate_system_data_region)
from pacman.model.graphs.application.abstract import (
AbstractOneAppOneMachineVertex)
generate_system_data_region, SimulatorVertex)

logger = FormatAdapter(logging.getLogger(__name__))

Expand All @@ -49,7 +54,7 @@ def __init__(self, lead, label=None):
label, n_atoms=1)


class SyncTestMachineVertex(MachineVertex, AbstractHasAssociatedBinary,
class SyncTestMachineVertex(SimulatorVertex,
AbstractGeneratesDataSpecification):
def __init__(self, lead, app_vertex, label=None):
super().__init__(label, app_vertex)
Expand Down Expand Up @@ -82,8 +87,10 @@ def generate_data_specification(
spec.write_value(0)
else:
routing_info = FecDataView.get_routing_infos()
spec.write_value(routing_info.get_first_key_from_pre_vertex(
self, SEND_PARTITION))
key = routing_info.get_first_key_from_pre_vertex(
self, SEND_PARTITION)
assert(key is not None)
spec.write_value(key)

# End-of-Spec:
spec.end_specification()
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SDRAMSplitter(AbstractSplitterCommon):
"_post_vertices",
"_partition"]

def __init__(self):
def __init__(self) -> 'SDRAMSplitter':
super().__init__()
self.__pre_vertex = None
self._post_vertices: list[SDRAMMachineVertex] = list()
Expand All @@ -51,7 +51,7 @@ def get_out_going_vertices(self, partition_id: str) -> List[SDRAMMachineVertex]:
return self._post_vertices

@overrides(AbstractSplitterCommon.get_in_coming_vertices)
def get_in_coming_vertices(self, partition_id: str) -> SDRAMMachineVertex:
def get_in_coming_vertices(self, partition_id: str) -> List[SDRAMMachineVertex]:
return [self._pre_vertex]

def create_machine_vertices(self, chip_counter):
Expand Down Expand Up @@ -102,7 +102,9 @@ def get_in_coming_slices(self) -> List[Slice]:
@overrides(AbstractSplitterCommon.machine_vertices_for_recording)
def machine_vertices_for_recording(
self, variable_to_record: str) -> List[SDRAMMachineVertex]:
return [self._pre_vertex].extend(self._post_vertices)
mv = [self._pre_vertex]
mv.extend(self._post_vertices)
return mv

@overrides(AbstractSplitterCommon.reset_called)
def reset_called(self) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ class SDRAMSplitter(AbstractSplitterCommon):

__slots__ = [
"_pre_vertices",
"__post_vertex",
"_partition"]

def __init__(self):
def __init__(self) -> 'SDRAMSplitter':
super().__init__()
self._pre_vertices: List[SourceSegmentedSDRAMMachinePartition] = list()
self.__post_vertex = None

@property
def _post_vertex(self):
Expand All @@ -43,14 +41,15 @@ def _post_vertex(self):

@overrides(AbstractSplitterCommon.get_out_going_vertices)
def get_out_going_vertices(
self, partition_id: str) -> SourceSegmentedSDRAMMachinePartition:
return [self._post_vertex]
self, partition_id: str) -> List[SourceSegmentedSDRAMMachinePartition]:
return []

@overrides(AbstractSplitterCommon.get_in_coming_vertices)
def get_in_coming_vertices(
self, partition_id: str) -> List[SourceSegmentedSDRAMMachinePartition]:
return self._pre_vertices


def create_machine_vertices(self, chip_counter):
# slices
post_slice = Slice(
Expand Down Expand Up @@ -97,15 +96,18 @@ def get_in_coming_slices(self) -> List[Slice]:
@overrides(AbstractSplitterCommon.machine_vertices_for_recording)
def machine_vertices_for_recording(
self, variable_to_record: str) -> List[SourceSegmentedSDRAMMachinePartition]:
return [self._post_vertex].extend(self._pre_vertices)
mv = [self._post_vertex]
mv.extend(self._pre_vertices)
return mv


@overrides(AbstractSplitterCommon.reset_called)
def reset_called(self) -> None:
pass

@overrides(AbstractSplitterCommon.get_internal_sdram_partitions)
def get_internal_sdram_partitions(
self) -> SourceSegmentedSDRAMMachinePartition:
self) -> List[SourceSegmentedSDRAMMachinePartition]:
assert isinstance(
self._partition, SourceSegmentedSDRAMMachinePartition)
return [self._partition]
2 changes: 1 addition & 1 deletion gfe_integration_tests/test_hello_world_untimed.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from testfixtures import LogCapture
from testfixtures import LogCapture # type: ignore
from spinnaker_testbase import ScriptChecker


Expand Down

0 comments on commit 0a5247e

Please sign in to comment.