Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExecutableType moved to SpiNNMan #323

Merged
merged 4 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions spinnman/model/enums/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -30,5 +31,5 @@
"DiagnosticFilterDestination",
"DiagnosticFilterEmergencyRoutingStatus",
"DiagnosticFilterPacketType", "DiagnosticFilterPayloadStatus",
"DiagnosticFilterSource", "MailboxCommand", "P2PTableRoute",
"RouterError", "RunTimeError"]
"DiagnosticFilterSource", "ExecutableType", "MailboxCommand",
"P2PTableRoute", "RouterError", "RunTimeError"]
84 changes: 84 additions & 0 deletions spinnman/model/enums/executable_type.py
Original file line number Diff line number Diff line change
@@ -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
15 changes: 5 additions & 10 deletions spinnman/model/executable_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ~spinnman.model.enum.ExecutableType executable_type:
The type of this executable.
``None`` means don't record it.
"""
Expand All @@ -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 ~spinnman.model.enum.ExecutableType executable_type:
the executable type for locating n cores of
"""
if self.known(binary, chip_x, chip_y, chip_p):
Expand All @@ -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 ~spinnman.model.enum.ExecutableType executable_type:
:return: the number of cores using this executable type
:rtype: int
"""
Expand All @@ -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 ~spinnman.model.enum.ExecutableType executable_type:
the executable type enum value
:return: iterable of binaries with that executable type
:rtype: iterable(str)
Expand All @@ -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(~spinnman.model.enum.ExecutableType)
"""
return self._binary_type_map.keys()

Expand Down