From 886f183b1346506dc88fcae26b7f03d730014f9e Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Thu, 20 Apr 2023 10:56:44 +0100 Subject: [PATCH 1/3] ExecutableType moved to SpiNNMan --- spinnman/model/enums/__init__.py | 5 +- spinnman/model/enums/executable_type.py | 84 +++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 spinnman/model/enums/executable_type.py diff --git a/spinnman/model/enums/__init__.py b/spinnman/model/enums/__init__.py index b449ad0a7..0c39903e0 100644 --- a/spinnman/model/enums/__init__.py +++ b/spinnman/model/enums/__init__.py @@ -21,6 +21,7 @@ from .diagnostic_filter_packet_type import DiagnosticFilterPacketType from .diagnostic_filter_payload_status import DiagnosticFilterPayloadStatus from .diagnostic_filter_source import DiagnosticFilterSource +from .executable_type import ExecutableType from .mailbox_command import MailboxCommand from .p2p_table_route import P2PTableRoute from .run_time_error import RunTimeError @@ -30,5 +31,5 @@ "DiagnosticFilterDestination", "DiagnosticFilterEmergencyRoutingStatus", "DiagnosticFilterPacketType", "DiagnosticFilterPayloadStatus", - "DiagnosticFilterSource", "MailboxCommand", "P2PTableRoute", - "RouterError", "RunTimeError"] + "DiagnosticFilterSource", "ExecutableType", "MailboxCommand", + "P2PTableRoute", "RouterError", "RunTimeError"] diff --git a/spinnman/model/enums/executable_type.py b/spinnman/model/enums/executable_type.py new file mode 100644 index 000000000..0481e237f --- /dev/null +++ b/spinnman/model/enums/executable_type.py @@ -0,0 +1,84 @@ +# Copyright (c) 2017 The University of Manchester +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from enum import Enum +from spinnman.model.enums import CPUState + + +class ExecutableType(Enum): + """ + The different types of executable from the perspective of how they + are started and controlled. + """ + + #: Runs immediately without waiting for barrier and then exits. + RUNNING = ( + 0, + [CPUState.RUNNING], + [CPUState.FINISHED], + False, + "Runs immediately without waiting for barrier and then exits") + #: Calls ``spin1_start(SYNC_WAIT)`` and then eventually ``spin1_exit()``. + SYNC = ( + 1, + [CPUState.SYNC0], + [CPUState.FINISHED], + False, + "Calls spin1_start(SYNC_WAIT) and then eventually spin1_exit()") + #: Calls ``simulation_run()`` and ``simulation_exit()`` / + #: ``simulation_handle_pause_resume()``. + USES_SIMULATION_INTERFACE = ( + 2, + [CPUState.SYNC0, CPUState.SYNC1, CPUState.PAUSED, CPUState.READY], + [CPUState.READY], + True, + "Calls simulation_run() and simulation_exit() / " + "simulation_handle_pause_resume()") + #: Situation where there user has supplied no application but for some + #: reason still wants to run. + NO_APPLICATION = ( + 3, + [], + [], + True, + "Situation where there user has supplied no application but for " + "some reason still wants to run") + #: Runs immediately without waiting for barrier and never ends. + SYSTEM = ( + 4, + [CPUState.RUNNING], + [CPUState.RUNNING], + True, + "Runs immediately without waiting for barrier and never ends") + + def __new__(cls, value, start_state, end_state, + supports_auto_pause_and_resume, doc=""): + # pylint: disable=protected-access, too-many-arguments + obj = object.__new__(cls) + obj._value_ = value + obj.start_state = start_state + obj.end_state = end_state + obj.supports_auto_pause_and_resume = supports_auto_pause_and_resume + obj.__doc__ = doc + return obj + + def __init__(self, value, start_state, end_state, + supports_auto_pause_and_resume, doc=""): + # pylint: disable=too-many-arguments + self._value_ = value + self.__doc__ = doc + self.start_state = start_state + self.end_state = end_state + self.supports_auto_pause_and_resume = supports_auto_pause_and_resume + self.__doc__ = doc From 0f84717fa00d9c146f0b349f529cab11cc410454 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Thu, 20 Apr 2023 11:27:44 +0100 Subject: [PATCH 2/3] move docs to ~spinn_machine.model.enum.ExecutableType --- doc/source/conf.py | 3 --- spinnman/model/executable_targets.py | 15 +++++---------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index c2203b516..09c0ef1f8 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -58,9 +58,6 @@ 'https://spinnutils.readthedocs.io/en/latest/', None), 'spinn_machine': ( 'https://spinnmachine.readthedocs.io/en/latest/', None), - # WARNING! This is a forward reference! - 'spinn_front_end_common': ( - 'https://spinnfrontendcommon.readthedocs.io/en/latest/', None), } # Add any paths that contain templates here, relative to this directory. diff --git a/spinnman/model/executable_targets.py b/spinnman/model/executable_targets.py index e798902c9..ed3b03ef3 100644 --- a/spinnman/model/executable_targets.py +++ b/spinnman/model/executable_targets.py @@ -41,8 +41,7 @@ def add_subsets(self, binary, subsets, executable_type=None): :param str binary: the path to the binary needed to be executed :param ~spinn_machine.CoreSubsets subsets: the subset of cores that the binary needs to be loaded on - :param ~spinn_front_end_common.utilities.utility_objs.ExecutableType \ - executable_type: + :param ~spinn_machine.model.enum.ExecutableType executable_type: The type of this executable. ``None`` means don't record it. """ @@ -67,8 +66,7 @@ def add_processor( :param int chip_y: the coordinate on the machine in terms of y for the chip :param int chip_p: the processor ID to place this executable on - :param ~spinn_front_end_common.utilities.utility_objs.ExecutableType \ - executable_type: + :param ~spinn_machine.model.enum.ExecutableType executable_type: the executable type for locating n cores of """ if self.known(binary, chip_x, chip_y, chip_p): @@ -85,9 +83,7 @@ def get_n_cores_for_executable_type(self, executable_type): """ Get the number of cores that the executable type is using. - :param ~spinn_front_end_common.utilities.utility_objs.ExecutableType \ - executable_type: - the executable type for locating n cores of + :param ~spinn_machine.model.enum.ExecutableType executable_type: :return: the number of cores using this executable type :rtype: int """ @@ -99,8 +95,7 @@ def get_binaries_of_executable_type(self, executable_type): """ Get the binaries of a given a executable type. - :param ~spinn_front_end_common.utilities.utility_objs.ExecutableType \ - executable_type: + :param ~spinn_machine.model.enum.ExecutableType executable_type: the executable type enum value :return: iterable of binaries with that executable type :rtype: iterable(str) @@ -113,7 +108,7 @@ def executable_types_in_binary_set(self): :return: iterable of the executable types in this binary set. :rtype: - iterable(~spinn_front_end_common.utilities.utility_objs.ExecutableType) + iterable(~spinn_machine.model.enum.ExecutableType) """ return self._binary_type_map.keys() From be24f042200f307a8bd284707a3662a93dcdbe87 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Mon, 24 Apr 2023 08:29:37 +0100 Subject: [PATCH 3/3] fix doc reference --- spinnman/model/executable_targets.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spinnman/model/executable_targets.py b/spinnman/model/executable_targets.py index ed3b03ef3..5a3c88182 100644 --- a/spinnman/model/executable_targets.py +++ b/spinnman/model/executable_targets.py @@ -41,7 +41,7 @@ def add_subsets(self, binary, subsets, executable_type=None): :param str binary: the path to the binary needed to be executed :param ~spinn_machine.CoreSubsets subsets: the subset of cores that the binary needs to be loaded on - :param ~spinn_machine.model.enum.ExecutableType executable_type: + :param ~spinnman.model.enum.ExecutableType executable_type: The type of this executable. ``None`` means don't record it. """ @@ -66,7 +66,7 @@ def add_processor( :param int chip_y: the coordinate on the machine in terms of y for the chip :param int chip_p: the processor ID to place this executable on - :param ~spinn_machine.model.enum.ExecutableType executable_type: + :param ~spinnman.model.enum.ExecutableType executable_type: the executable type for locating n cores of """ if self.known(binary, chip_x, chip_y, chip_p): @@ -83,7 +83,7 @@ def get_n_cores_for_executable_type(self, executable_type): """ Get the number of cores that the executable type is using. - :param ~spinn_machine.model.enum.ExecutableType executable_type: + :param ~spinnman.model.enum.ExecutableType executable_type: :return: the number of cores using this executable type :rtype: int """ @@ -95,7 +95,7 @@ def get_binaries_of_executable_type(self, executable_type): """ Get the binaries of a given a executable type. - :param ~spinn_machine.model.enum.ExecutableType executable_type: + :param ~spinnman.model.enum.ExecutableType executable_type: the executable type enum value :return: iterable of binaries with that executable type :rtype: iterable(str) @@ -108,7 +108,7 @@ def executable_types_in_binary_set(self): :return: iterable of the executable types in this binary set. :rtype: - iterable(~spinn_machine.model.enum.ExecutableType) + iterable(~spinnman.model.enum.ExecutableType) """ return self._binary_type_map.keys()