Skip to content

Commit

Permalink
delay safetly check until data is available
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Dec 18, 2024
1 parent e971cff commit 53eb9f4
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions spinn_front_end_common/interface/abstract_spinnaker_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,14 +519,6 @@ def _calc_run_time(self, run_time: Optional[float]) -> Union[
else:
self._data_writer.set_plan_n_timesteps(n_machine_time_steps)

if not get_config_bool("Buffers", "use_auto_pause_and_resume"):
if (self._data_writer.get_max_run_time_steps() <
n_machine_time_steps):
raise ConfigurationException(
"The SDRAM required by one or more vertices is based on "
"the run time, so the run time is limited to "
f"{self._data_writer.get_max_run_time_steps()} time steps")

logger.info(
f"Simulating for {n_machine_time_steps} "
f"{self._data_writer.get_simulation_time_step_ms()} ms timesteps "
Expand Down Expand Up @@ -620,7 +612,7 @@ def __run(self, run_time: Optional[float], sync_time: float):

# build the graphs to modify with system requirements
if self._data_writer.get_requires_mapping():
self._do_mapping(total_run_time)
self._do_mapping(total_run_time, n_machine_time_steps)

if not self._data_writer.is_ran_last():
self._do_write_metadata()
Expand Down Expand Up @@ -689,7 +681,8 @@ def _add_dependent_verts_and_edges_for_application_graph(self) -> None:
ApplicationEdge(v, dpt_vtx), edge_identifier)

@final
def _deduce_data_n_timesteps(self) -> None:
def _deduce_data_n_timesteps(
self, n_machine_time_steps: Optional[int]) -> None:
"""
Operates the auto pause and resume functionality by figuring out
how many timer ticks a simulation can run before SDRAM runs out,
Expand Down Expand Up @@ -724,6 +717,13 @@ def _deduce_data_n_timesteps(self) -> None:
max_this_chip = int((size - sdram.fixed) // sdram.per_timestep)
max_time_steps = min(max_time_steps, max_this_chip)

if not get_config_bool("Buffers", "use_auto_pause_and_resume"):
if (max_time_steps < n_machine_time_steps):
raise ConfigurationException(
"The SDRAM required by one or more vertices is based on "
"the run time, so the run time is limited to "
f"{max_time_steps} time steps")

self._data_writer.set_max_run_time_steps(max_time_steps)

def _generate_steps(self, n_steps: int) -> Sequence[int]:
Expand Down Expand Up @@ -1372,7 +1372,8 @@ def _execute_control_sync(self, do_sync: bool) -> None:
return
self._data_writer.get_transceiver().control_sync(do_sync)

def _do_mapping(self, total_run_time: Optional[float]) -> None:
def _do_mapping(self, total_run_time: Optional[float],
n_machine_time_steps: Optional[int]) -> None:
"""
Runs, times and logs all the algorithms in the mapping stage.
Expand Down Expand Up @@ -1426,7 +1427,7 @@ def _do_mapping(self, total_run_time: Optional[float]) -> None:
self._execute_locate_executable_start_type()
self._execute_buffer_manager_creator()

self._deduce_data_n_timesteps()
self._deduce_data_n_timesteps(n_machine_time_steps)
FecTimer.end_category(TimerCategory.MAPPING)

# Overridden by spy which adds placement_order
Expand Down

0 comments on commit 53eb9f4

Please sign in to comment.