Skip to content

Commit

Permalink
merged in master
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Jun 8, 2021
2 parents 9a74cd1 + c9359e1 commit 63c47f9
Show file tree
Hide file tree
Showing 19 changed files with 46 additions and 176 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ def __init__(self, label, state):
additional_arguments={"data_n_time_steps"})
def generate_machine_data_specification(
self, spec, placement, machine_graph, routing_info, iptags,
reverse_iptags, machine_time_step, time_scale_factor,
data_n_time_steps):
reverse_iptags, data_n_time_steps):
"""
:param ~.DataSpecificationGenerator spec:
:param ~.MachineGraph machine_graph:
Expand All @@ -80,8 +79,7 @@ def generate_machine_data_specification(
# pylint: disable=arguments-differ

# Generate the system data region for simulation .c requirements
generate_system_data_region(spec, DataRegions.SYSTEM,
self, machine_time_step, time_scale_factor)
generate_system_data_region(spec, DataRegions.SYSTEM, self)

# reserve memory regions
spec.reserve_memory_region(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
ConwayBasicCell)

runtime = 50
# machine_time_step = 100
MAX_X_SIZE_OF_FABRIC = 7
MAX_Y_SIZE_OF_FABRIC = 7
n_chips = (MAX_X_SIZE_OF_FABRIC * MAX_Y_SIZE_OF_FABRIC) // 15
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ def __init__(self, label, state):
additional_arguments={"data_n_time_steps"})
def generate_machine_data_specification(
self, spec, placement, machine_graph, routing_info, iptags,
reverse_iptags, machine_time_step, time_scale_factor,
data_n_time_steps):
reverse_iptags, data_n_time_steps):
"""
:param ~.DataSpecificationGenerator spec:
:param ~.MachineGraph machine_graph:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
ConwayBasicCell)

runtime = 50
# machine_time_step = 100
MAX_X_SIZE_OF_FABRIC = 7
MAX_Y_SIZE_OF_FABRIC = 7
n_chips = (MAX_X_SIZE_OF_FABRIC * MAX_Y_SIZE_OF_FABRIC) // 15
Expand Down
2 changes: 1 addition & 1 deletion gfe_examples/hello_world/hello_world_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def resources_required(self):
@overrides(MachineDataSpecableVertex.generate_machine_data_specification)
def generate_machine_data_specification(
self, spec, placement, machine_graph, routing_info, iptags,
reverse_iptags, machine_time_step, time_scale_factor):
reverse_iptags):
# Generate the system data region for simulation .c requirements
self.generate_system_region(spec)

Expand Down
3 changes: 1 addition & 2 deletions gfe_examples/hello_world_untimed/hello_world_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ def generate_data_specification(self, spec, placement, data_n_steps):

# Generate the system data region for simulation .c requirements
# Note that the time step and time scale factor are unused here
generate_steps_system_data_region(
spec, DataRegions.SYSTEM, self)
generate_steps_system_data_region(spec, DataRegions.SYSTEM, self)

# Create the data regions for hello world
spec.reserve_memory_region(
Expand Down
2 changes: 1 addition & 1 deletion gfe_examples/template/template_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def resources_required(self):
@overrides(MachineDataSpecableVertex.generate_machine_data_specification)
def generate_machine_data_specification(
self, spec, placement, machine_graph, routing_info, iptags,
reverse_iptags, machine_time_step, time_scale_factor):
reverse_iptags):
""" Generate data
:param placement: the placement object for the DSG
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def get_binary_start_type(self):
@overrides(MachineDataSpecableVertex.generate_machine_data_specification)
def generate_machine_data_specification(
self, spec, placement, machine_graph, routing_info, iptags,
reverse_iptags, machine_time_step, time_scale_factor):
reverse_iptags):

# reserve memory regions
spec.reserve_memory_region(
Expand All @@ -88,8 +88,7 @@ def generate_machine_data_specification(
# simulation .c requirements
spec.switch_write_focus(DataRegions.SYSTEM)
spec.write_array(simulation_utilities.get_simulation_header_array(
self.get_binary_file_name(), machine_time_step,
time_scale_factor))
self.get_binary_file_name()))

# get counters
outgoing_partitions = list(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ def get_binary_start_type(self):
additional_arguments={"data_n_time_steps"})
def generate_machine_data_specification(
self, spec, placement, machine_graph, routing_info, iptags,
reverse_iptags, machine_time_step, time_scale_factor,
data_n_time_steps):
reverse_iptags, data_n_time_steps):

# reserve memory regions
spec.reserve_memory_region(
Expand All @@ -111,8 +110,7 @@ def generate_machine_data_specification(
# simulation .c requirements
spec.switch_write_focus(DataRegions.SYSTEM)
spec.write_array(simulation_utilities.get_simulation_header_array(
self.get_binary_file_name(), machine_time_step,
time_scale_factor))
self.get_binary_file_name()))

# TODO use get_sdram_edge_partitions_starting_at_vertex
# get counters
Expand Down
5 changes: 2 additions & 3 deletions gfe_integration_tests/test_extra_monitor/sdram_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,14 @@ def get_binary_start_type(self):

def generate_machine_data_specification(
self, spec, placement, machine_graph, routing_info, iptags,
reverse_iptags, machine_time_step, time_scale_factor):
reverse_iptags):
# Reserve SDRAM space for memory areas:
self._reserve_memory_regions(spec)

# write data for the simulation data item
spec.switch_write_focus(DataRegions.SYSTEM)
spec.write_array(simulation_utilities.get_simulation_header_array(
self.get_binary_file_name(), machine_time_step,
time_scale_factor))
self.get_binary_file_name()))

spec.switch_write_focus(DataRegions.CONFIG)
spec.write_value(self._size)
Expand Down
3 changes: 1 addition & 2 deletions gfe_integration_tests/test_rte/run_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,5 @@ def get_binary_start_type(self):
def generate_data_specification(self, spec, placement):
spec.reserve_memory_region(0, SIMULATION_N_BYTES)
spec.switch_write_focus(0)
spec.write_array(utils.get_simulation_header_array(
self._aplx_file, 1000, time_scale_factor=1))
spec.write_array(utils.get_simulation_header_array(self._aplx_file))
spec.end_specification()
21 changes: 2 additions & 19 deletions spinnaker_graph_front_end/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@
'add_vertex', 'add_machine_vertex', 'add_machine_vertex_instance',
'add_edge', 'add_application_edge_instance', 'add_machine_edge',
'add_machine_edge_instance', 'add_socket_address', 'get_txrx',
'has_ran', 'machine_time_step',
'get_number_of_available_cores_on_machine', 'no_machine_time_steps',
'time_scale_factor', 'machine_graph', 'application_graph',
'has_ran', 'get_number_of_available_cores_on_machine',
'no_machine_time_steps', 'machine_graph', 'application_graph',
'routing_infos', 'placements', 'transceiver',
'buffer_manager', 'machine', 'is_allocated_machine']

Expand Down Expand Up @@ -438,14 +437,6 @@ def has_ran():
return _sim().has_ran


def machine_time_step():
""" Get the size of machine time step, in microseconds.
:rtype: int
"""
return _sim().machine_time_step


def no_machine_time_steps():
""" Get the number of time/simulation steps executed.
Expand All @@ -454,14 +445,6 @@ def no_machine_time_steps():
return _sim().no_machine_time_steps


def time_scale_factor():
""" Get the time scaling factor.
:rtype: int
"""
return _sim().time_scale_factor


def machine_graph():
""" Get the partitioned graph.
Expand Down
2 changes: 0 additions & 2 deletions spinnaker_graph_front_end/config_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

#: The name of the configuration file
CONFIG_FILE_NAME = "spiNNakerGraphFrontEnd.cfg"
#: The name of the configuration validation configuration file
VALIDATION_CONFIG_NAME = "validation_config.cfg"


def reset_configs():
Expand Down
59 changes: 0 additions & 59 deletions spinnaker_graph_front_end/dead.cfg

This file was deleted.

17 changes: 7 additions & 10 deletions spinnaker_graph_front_end/spinnaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import logging
from spinn_utilities.config_holder import get_config_str
from spinn_utilities.log import FormatAdapter
from spinn_utilities.config_holder import (
get_config_bool, get_config_str, set_config)
from spinn_front_end_common.interface.abstract_spinnaker_base import (
AbstractSpinnakerBase)
from spinnaker_graph_front_end.config_setup import reset_configs
Expand Down Expand Up @@ -100,9 +99,6 @@ def __init__(
self.set_n_boards_required(1)

extra_mapping_inputs = dict()
extra_mapping_inputs["CreateAtomToEventIdMapping"] = get_config_bool(
"Database", "create_routing_info_to_atom_id_mapping")

self.update_extra_mapping_inputs(extra_mapping_inputs)
self.prepend_extra_pre_run_algorithms(extra_pre_run_algorithms)
self.extend_extra_post_run_algorithms(extra_post_run_algorithms)
Expand All @@ -112,11 +108,12 @@ def __init__(

# if not set at all, set to 1 for real time execution.
if self.time_scale_factor is None:
set_config("Machine", "time_scale_factor", 1)
logger.info("Setting time scale factor to {}."
.format(self.time_scale_factor))
logger.info("Setting machine time step to {} micro-seconds."
.format(self.machine_time_step))
self.time_scale_factor = 1
logger.info(f'Setting time scale factor to '
f'{self.time_scale_factor}.')
logger.info(f'Setting machine time step to '
f'{self.machine_time_step} '
f'micro-seconds.')

@property
def is_allocated_machine(self):
Expand Down
23 changes: 11 additions & 12 deletions spinnaker_graph_front_end/utilities/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@

from spinn_front_end_common.utilities.constants import SIMULATION_N_BYTES
from spinn_front_end_common.interface.simulation.simulation_utilities import (
get_simulation_header_array)
get_simulation_header_array, get_simulation_header_array_no_timestep)


def generate_system_data_region(
spec, region_id, machine_vertex, machine_time_step, time_scale_factor):
def generate_system_data_region(spec, region_id, machine_vertex):
""" Generate a system data region for time-based simulations.
:param ~data_specification.DataSpecificationGenerator spec:
Expand All @@ -28,10 +27,6 @@ def generate_system_data_region(
The region to write to
:param ~pacman.model.graphs.machine.MachineVertex machine_vertex:
The machine vertex to write for
:param int machine_time_step:
The time step of the simulation
:param int time_scale_factor:
The time scale of the simulation
"""

# reserve memory regions
Expand All @@ -41,8 +36,7 @@ def generate_system_data_region(
# simulation .c requirements
spec.switch_write_focus(region_id)
spec.write_array(get_simulation_header_array(
machine_vertex.get_binary_file_name(), machine_time_step,
time_scale_factor))
machine_vertex.get_binary_file_name()))


def generate_steps_system_data_region(spec, region_id, machine_vertex):
Expand All @@ -55,6 +49,11 @@ def generate_steps_system_data_region(spec, region_id, machine_vertex):
:param ~pacman.model.graphs.machine.MachineVertex machine_vertex:
The machine vertex to write for
"""
generate_system_data_region(
spec, region_id, machine_vertex, machine_time_step=0,
time_scale_factor=0)
# reserve memory regions
spec.reserve_memory_region(
region=region_id, size=SIMULATION_N_BYTES, label='systemInfo')

# simulation .c requirements
spec.switch_write_focus(region_id)
spec.write_array(get_simulation_header_array_no_timestep(
machine_vertex.get_binary_file_name()))
4 changes: 1 addition & 3 deletions spinnaker_graph_front_end/utilities/simulator_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ def generate_system_region(self, spec, region_id=0):
Which region is the system region.
Defaults to 0 because it is almost always the first one.
"""
generate_system_data_region(
spec, region_id, self, self.__front_end.machine_time_step(),
self.__front_end.time_scale_factor())
generate_system_data_region(spec, region_id, self)

def generate_recording_region(self, spec, region_id, channel_sizes):
"""
Expand Down
32 changes: 0 additions & 32 deletions spinnaker_graph_front_end/validation_config.cfg

This file was deleted.

Loading

0 comments on commit 63c47f9

Please sign in to comment.