Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into icub_vor_update
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgait committed Jul 28, 2023
2 parents 09b6c94 + 936713a commit 7787aae
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def _place_vertices(app_vertex, placements, chips):

def test_database_interface():
unittest_setup()
set_config("Machine", "version", 5)
set_config("Database", "create_database", "True")
set_config("Database", "create_routing_info_to_neuron_id_mapping", "True")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import unittest
from spinn_utilities.config_holder import set_config
from spinn_machine import virtual_machine
from spinnman.messages.eieio import EIEIOType
from pacman.model.graphs.machine import MachineVertex
Expand All @@ -38,6 +39,7 @@ class TestInsertLPGs(unittest.TestCase):
"""
def setUp(self):
unittest_setup()
set_config("Machine", "version", 5)

def test_that_3_lpgs_are_generated_on_3_board_app_graph(self):
writer = FecDataWriter.mock()
Expand Down
5 changes: 3 additions & 2 deletions spinn_front_end_common/interface/abstract_spinnaker_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from spinn_utilities.log import FormatAdapter

from spinn_machine import __version__ as spinn_machine_version
from spinn_machine import CoreSubsets, Machine
from spinn_machine import CoreSubsets

from spinnman import __version__ as spinnman_version
from spinnman.exceptions import SpiNNManCoresNotInStateException
Expand Down Expand Up @@ -1629,7 +1629,8 @@ def _compression_skipable(self, tables):
if get_config_bool(
"Mapping", "router_table_compress_as_far_as_possible"):
return False
return tables.max_number_of_entries <= Machine.ROUTER_ENTRIES
machine = self._data_writer.get_machine()
return tables.max_number_of_entries <= machine.min_n_router_enteries

def _execute_pre_compression(self, pre_compress):
if pre_compress:
Expand Down
6 changes: 0 additions & 6 deletions spinn_front_end_common/interface/config_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from spinn_utilities.config_holder import (
config_options, load_config, get_config_bool, get_config_int,
get_config_str, get_config_str_list, set_config)
from spinn_machine import Machine
from spinn_front_end_common.interface.provenance import LogStoreDB
from spinn_front_end_common.data.fec_data_writer import FecDataWriter
from spinn_front_end_common.utilities.exceptions import ConfigurationException
Expand Down Expand Up @@ -73,11 +72,6 @@ def __init__(self, data_writer_cls=None):
self._debug_configs()
self._previous_handler()

# Pass max_machine_cores to Machine so if effects everything!
max_machine_core = get_config_int("Machine", "max_machine_core")
if max_machine_core is not None:
Machine.set_max_cores_per_chip(max_machine_core)

def _debug_configs(self):
"""
Adjusts and checks the configuration based on mode and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def _calculate_loading_energy(machine, load_time_ms, n_monitors, n_frames):
energy_cost = (
total_time_ms * n_monitors_active *
MILLIWATTS_PER_CHIP_ACTIVE_OVERHEAD /
machine.DEFAULT_MAX_CORES_PER_CHIP)
FecDataView.get_machine_version().max_cores_per_chip)

# handle all idle cores
energy_cost += _calculate_idle_cost(total_time_ms, machine)
Expand Down Expand Up @@ -410,7 +410,7 @@ def _calculate_data_extraction_energy(machine, n_monitors, n_frames):
total_time_ms *
min(N_MONITORS_ACTIVE_DURING_COMMS, n_monitors) *
MILLIWATTS_PER_CHIP_ACTIVE_OVERHEAD /
machine.DEFAULT_MAX_CORES_PER_CHIP)
FecDataView.get_machine_version().max_cores_per_chip)

# add idle chip cost
energy_cost += _calculate_idle_cost(total_time_ms, machine)
Expand All @@ -434,7 +434,7 @@ def _calculate_idle_cost(time, machine):
"""
return (time * machine.total_available_user_cores *
MILLIWATTS_PER_IDLE_CHIP /
machine.DEFAULT_MAX_CORES_PER_CHIP)
FecDataView.get_machine_version().max_cores_per_chip)


def _calculate_power_down_energy(time, machine, n_frames):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from spinn_utilities.config_holder import get_config_bool
from spinn_utilities.find_max_success import find_max_success
from spinn_utilities.progress_bar import ProgressBar
from spinn_machine import Machine, MulticastRoutingEntry
from spinn_machine import MulticastRoutingEntry
from pacman.exceptions import (
PacmanAlgorithmFailedToGenerateOutputsException,
PacmanElementAllocationException, MinimisationFailedError)
Expand Down Expand Up @@ -603,7 +603,8 @@ def _run_algorithm(self, router_table):
"""
compressor = _PairCompressor(ordered=True)
compressed_entries = compressor.compress_table(router_table)
if len(compressed_entries) > Machine.ROUTER_ENTRIES:
chip = FecDataView.get_chip_at(router_table.x, router_table.y)
if len(compressed_entries) > chip.n_user_processors:
raise MinimisationFailedError(
f"Compression failed as {len(compressed_entries)} "
f"entires found")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from spalloc_client.states import JobState
from spinn_utilities.abstract_context_manager import AbstractContextManager
from spinn_utilities.config_holder import get_config_int, get_config_str
from spinn_machine import Machine
from spinnman.constants import SCP_SCAMP_PORT
from spinnman.spalloc import (
is_server_address, SpallocClient, SpallocJob, SpallocState)
Expand All @@ -37,11 +36,6 @@
logger = FormatAdapter(logging.getLogger(__name__))
_MACHINE_VERSION = 5 # Spalloc only ever works with v5 boards

#: The number of chips per board to use in calculations to ensure that
#: the number of boards allocated is enough. This is 2 less than the maximum
#: as there are a few boards with 2 down chips in the big machine.
CALC_CHIPS_PER_BOARD = Machine.MAX_CHIPS_PER_48_BOARD - 2


class SpallocJobController(MachineAllocationController):
__slots__ = (
Expand Down Expand Up @@ -261,7 +255,9 @@ def spalloc_allocator(
n_boards = FecDataView.get_n_boards_required()
else:
n_chips = FecDataView.get_n_chips_needed()
n_boards_float = float(n_chips) / CALC_CHIPS_PER_BOARD
# reduce max chips by 2 in case you get a bad board(s)
chips_div = FecDataView.get_machine_version().n_chips_per_board - 2
n_boards_float = float(n_chips) / chips_div
logger.info("{:.2f} Boards Required for {} chips",
n_boards_float, n_chips)
# If the number of boards rounded up is less than 50% of a board
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
import logging
from spinn_utilities.config_holder import get_config_int, get_config_str
from spinn_utilities.log import FormatAdapter
from spinn_machine import json_machine, virtual_machine, Machine
from spinn_machine import json_machine, virtual_machine
from spinn_front_end_common.data import FecDataView
logger = FormatAdapter(logging.getLogger(__name__))


Expand Down Expand Up @@ -60,9 +61,10 @@ def virtual_machine_generator():
raise ValueError(f"Unknown version {version}")

if json_path is None:
n_cores = FecDataView.get_machine_version().max_cores_per_chip
machine = virtual_machine(
width=width, height=height,
n_cpus_per_chip=Machine.max_cores_per_chip(),
n_cpus_per_chip=n_cores,
validate=True)
else:
if (height is not None or width is not None or
Expand All @@ -78,8 +80,6 @@ def virtual_machine_generator():
machine.add_spinnaker_links()
machine.add_fpga_links()

logger.info(
"Created a virtual machine which has {}",
machine.cores_and_link_output_string())
logger.info("Created {}", machine.summary_string())

return machine
6 changes: 0 additions & 6 deletions spinn_front_end_common/interface/spinnaker.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ drift_report_ethernet_only = True
# appID: Used by sark to identify the user's application.
machine_spec_file = None

remote_spinnaker_url = None

spalloc_server = None
spalloc_port = 22244
spalloc_user = None
spalloc_group = None
Expand All @@ -126,9 +123,6 @@ MaxSDRAMSize = 134217728
simulation_time_step = 1000
time_scale_factor = None

# Allows the setting of max number of cores per chip
# Set to None to use the default value.
max_machine_core = None
# For the max virtual machine this can be reduced by
max_machine_core_reduction = 1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import os
from spinn_utilities.progress_bar import ProgressBar
from spinn_front_end_common.data import FecDataView
from spinn_machine import Machine, Router
from spinn_machine import Router

AREA_CODE_REPORT_NAME = "board_chip_report.txt"

Expand Down Expand Up @@ -55,7 +55,8 @@ def _write_report(writer, machine, progress_bar):
chip = machine.get_chip_at(x, y)
existing_chips.append(
f"({x}, {y}, P: {chip.get_physical_core_id(0)})")
down_procs = set(range(Machine.DEFAULT_MAX_CORES_PER_CHIP))
n_cores = FecDataView.get_machine_version().max_cores_per_chip
down_procs = set(range(n_cores))
for proc in chip.processors:
down_procs.remove(proc.processor_id)
for p in down_procs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import (JOULES_PER_SPIKE, MILLIWATTS_PER_CHIP_ACTIVE_OVERHEAD,
MILLIWATTS_PER_FRAME_ACTIVE_COST, MILLIWATTS_PER_FPGA,
MILLIWATTS_PER_IDLE_CHIP)
from spinn_machine.machine import Machine

logger = FormatAdapter(logging.getLogger(__name__))

Expand Down Expand Up @@ -272,7 +271,8 @@ def _write_chips_active_cost(
f.write("\n")

# detailed report print out
for core in range(Machine.DEFAULT_MAX_CORES_PER_CHIP):
n_cores = FecDataView.get_machine_version().max_cores_per_chip
for core in range(n_cores):
if core in labels:
label = f" (running {labels[core]})"
else:
Expand Down
1 change: 1 addition & 0 deletions unittests/data/test_simulator_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ def test_executable_targets(self):

def test_ds_database(self):
writer = FecDataWriter.mock()
set_config("Machine", "version", 5)
with self.assertRaises(DataNotYetAvialable):
FecDataView.get_ds_database()
targets = DsSqlliteDatabase()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import unittest
import os
from spinn_utilities.config_holder import set_config
from pacman.model.graphs.machine import SimpleMachineVertex
from pacman.model.placements import Placement, Placements
from spinn_front_end_common.data.fec_data_writer import FecDataWriter
Expand All @@ -26,6 +27,7 @@ class TestBufferedDatabase(unittest.TestCase):

def setUp(self):
unittest_setup()
set_config("Machine", "version", 5)

def test_use_database(self):
f = BufferDatabase.default_database_file()
Expand Down
7 changes: 5 additions & 2 deletions unittests/interface/ds/test_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@

from sqlite3 import IntegrityError
import unittest
from spinn_utilities.config_holder import set_config
from spinn_utilities.overrides import overrides
from spinn_machine import Chip
from spinn_machine import Chip, Router
from spinn_machine.virtual_machine import virtual_machine
from spinnman.model.enums import ExecutableType
from pacman.model.graphs.machine import SimpleMachineVertex
Expand Down Expand Up @@ -51,6 +52,7 @@ class TestDataSpecification(unittest.TestCase):

def setUp(self):
unittest_setup()
set_config("Machine", "version", 5)

def test_init(self):
db = DsSqlliteDatabase()
Expand Down Expand Up @@ -105,7 +107,8 @@ def test_core_infos(self):
self.assertEqual(app_infos, db.get_core_infos(False))

def test_bad_ethernet(self):
bad = Chip(10, 10, 15, None, 100, 8, 8)
router = Router([], 123)
bad = Chip(10, 10, 15, router, 100, 8, 8)
FecDataView.get_machine().add_chip(bad)
db = DsSqlliteDatabase()
vertex = _TestVertexWithBinary(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class TestLoadDataSpecification(unittest.TestCase):
def setUp(cls):
unittest_setup()
set_config("Machine", "enable_advanced_monitor_support", "False")
set_config("Machine", "version", 5)

def test_call(self):
writer = FecDataWriter.mock()
Expand Down

0 comments on commit 7787aae

Please sign in to comment.