Skip to content

Commit 3f8a3c4

Browse files
committed
merge
2 parents 146c93f + f23fda5 commit 3f8a3c4

19 files changed

Lines changed: 186 additions & 272 deletions

File tree

proxy_integration_tests/test_python_debug/check_debug.py

Lines changed: 22 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -16,79 +16,37 @@
1616
from unittest.case import SkipTest
1717
from requests.exceptions import ConnectionError
1818

19-
from spinn_utilities.config_holder import get_config_bool
19+
from spinn_utilities.config_holder import (
20+
config_options, config_sections, get_report_path, get_timestamp_path)
2021

21-
from spinn_front_end_common.interface.interface_functions \
22-
import load_using_advanced_monitors
23-
import spinn_front_end_common.utilities.report_functions.reports as \
24-
reports_names
25-
from spinn_front_end_common.utilities.report_functions.network_specification \
26-
import _FILENAME as network_specification_file_name
27-
from spinn_front_end_common.utilities.report_functions.drift_report import (
28-
CLOCK_DRIFT_REPORT)
29-
from spinn_front_end_common.utilities.report_functions.\
30-
memory_map_on_host_report import _FOLDER_NAME as \
31-
memory_map_on_host_report
32-
# from spinn_front_end_common.utilities.report_functions.energy_report \
33-
# import EnergyReport
34-
from spinn_front_end_common.utilities.report_functions.board_chip_report \
35-
import AREA_CODE_REPORT_NAME
36-
from spinn_front_end_common.utilities.report_functions.\
37-
fixed_route_from_machine_report import REPORT_NAME as fixed_route_report
38-
from spinn_front_end_common.utility_models import \
39-
DataSpeedUpPacketGatherMachineVertex
4022
from spinnaker_testbase import BaseTestCase
41-
from spynnaker.pyNN.data import SpynnakerDataView
42-
from spynnaker.pyNN.extra_algorithms.\
43-
spynnaker_neuron_network_specification_report import (
44-
_GRAPH_NAME)
23+
from spynnaker.pyNN.config_setup import cfg_paths_skipped
4524
import pyNN.spiNNaker as sim
4625

4726

4827
class CheckDebug(BaseTestCase):
4928
"""
5029
that it does not crash in debug mode. All reports on.
5130
"""
52-
def debug(self):
53-
# pylint: disable=protected-access
54-
reports = [
55-
# write_energy_report
56-
# EnergyReport._DETAILED_FILENAME,
57-
# EnergyReport._SUMMARY_FILENAME,
58-
# write_text_specs = False
59-
"data_spec_text_files",
60-
# write_router_reports
61-
reports_names._ROUTING_FILENAME,
62-
# write_partitioner_reports
63-
reports_names._PARTITIONING_FILENAME,
64-
# write_application_graph_placer_report
65-
reports_names._PLACEMENT_VTX_GRAPH_FILENAME,
66-
reports_names._PLACEMENT_CORE_GRAPH_FILENAME,
67-
reports_names._SDRAM_FILENAME,
68-
# repeats reports_names._SDRAM_FILENAME,
69-
# write_router_info_report
70-
reports_names._VIRTKEY_FILENAME,
71-
# write_routing_table_reports
72-
reports_names._ROUTING_TABLE_DIR,
73-
reports_names._C_ROUTING_TABLE_DIR,
74-
reports_names._COMPARED_FILENAME,
75-
# write_memory_map_report
76-
memory_map_on_host_report,
77-
# write_network_specification_report
78-
network_specification_file_name,
79-
"provenance_data",
80-
# write_tag_allocation_reports
81-
reports_names._TAGS_FILENAME,
82-
# write_drift_report_end or start
83-
CLOCK_DRIFT_REPORT,
84-
# write_board_chip_report
85-
AREA_CODE_REPORT_NAME,
86-
_GRAPH_NAME,
87-
# graphviz exe may not be installed so there will be no image file
88-
# _GRAPH_NAME + "." + _GRAPH_FORMAT,
89-
fixed_route_report,
90-
]
9131

32+
def assert_reports(self):
33+
skipped = cfg_paths_skipped()
34+
for section in config_sections():
35+
for option in config_options(section):
36+
if option in skipped:
37+
continue
38+
if option.startswith("path"):
39+
path = get_report_path(section=section, option=option)
40+
elif option.startswith("tpath"):
41+
path = get_timestamp_path(section=section, option=option)
42+
else:
43+
continue
44+
print(f"found {option} at {path}")
45+
if not os.path.exists(path):
46+
raise AssertionError(
47+
f"Unable to find report for {option} {path}")
48+
49+
def debug(self):
9250
sim.setup(1.0)
9351
pop = sim.Population(100, sim.IF_curr_exp, {}, label="pop")
9452
pop.record("v")
@@ -102,23 +60,9 @@ def debug(self):
10260
raise SkipTest("DNS Error Monster!")
10361

10462
pop.get_data("v")
105-
run0 = SpynnakerDataView.get_run_dir_path()
106-
found = os.listdir(run0)
107-
if (get_config_bool("Machine", "enable_advanced_monitor_support")
108-
and not get_config_bool("Java", "use_java")):
109-
# write_data_speed_up_report
110-
reports.append(
111-
DataSpeedUpPacketGatherMachineVertex.OUT_REPORT_NAME)
112-
if load_using_advanced_monitors():
113-
reports.append(
114-
DataSpeedUpPacketGatherMachineVertex.IN_REPORT_NAME)
115-
for report in reports:
116-
self.assertIn(report, found)
117-
self.assertIn("data.sqlite3", found)
118-
self.assertIn("ds.sqlite3", found)
63+
self.assert_reports()
11964

12065
sim.run(10) # second run
12166
pop.get_data("v")
122-
self.assertEqual(run0, SpynnakerDataView.get_run_dir_path())
12367

12468
sim.end()

spynnaker/pyNN/config_setup.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,15 @@
1313
# limitations under the License.
1414

1515
import os
16+
from typing import Set
17+
1618
from spinn_utilities.config_holder import (
1719
clear_cfg_files, set_cfg_files)
1820
from spinn_front_end_common.interface.config_setup import (
1921
add_default_cfg, add_spinnaker_cfg)
22+
from spinn_front_end_common.interface.config_setup import (
23+
fec_cfg_paths_skipped)
24+
2025
from spynnaker.pyNN.data.spynnaker_data_writer import SpynnakerDataWriter
2126

2227
CONFIG_FILE_NAME = "spynnaker.cfg"
@@ -62,3 +67,12 @@ def add_spynnaker_cfg() -> None:
6267
"""
6368
add_spinnaker_cfg() # This add its dependencies too
6469
add_default_cfg(os.path.join(os.path.dirname(__file__), CONFIG_FILE_NAME))
70+
71+
72+
def cfg_paths_skipped() -> Set[str]:
73+
"""
74+
Set of cfg path that would not be found based on other cfg settings
75+
76+
Assuming mode = Debug
77+
"""
78+
return fec_cfg_paths_skipped()

spynnaker/pyNN/extra_algorithms/redundant_packet_count_report.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
import os
14+
1515
import logging
1616
from typing import Final, TextIO, Tuple, cast
17+
18+
from spinn_utilities.config_holder import get_report_path
1719
from spinn_utilities.log import FormatAdapter
20+
1821
from spinn_front_end_common.interface.provenance import (
1922
ProvenanceReader, ProvenanceWriter)
20-
from spynnaker.pyNN.data import SpynnakerDataView
23+
2124
from spynnaker.pyNN.models.neuron import PopulationMachineVertex
2225

2326
logger = FormatAdapter(logging.getLogger(__name__))
@@ -70,7 +73,6 @@
7073
"""
7174

7275

73-
_FILE_NAME = "redundant_packet_count.rpt"
7476
_N_PROV_ITEMS_NEEDED = 4
7577
_MAX = 100
7678

@@ -79,7 +81,7 @@ def redundant_packet_count_report() -> None:
7981
"""
8082
Writes a report detailing the redundant packet counts.
8183
"""
82-
file_name = os.path.join(SpynnakerDataView.get_run_dir_path(), _FILE_NAME)
84+
file_name = get_report_path("path_redundant_packet_count_report")
8385

8486
try:
8587
_create_views()

spynnaker/pyNN/extra_algorithms/spynnaker_neuron_network_specification_report.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
# limitations under the License.
1414
from __future__ import annotations
1515
import logging
16-
import os
1716
from typing import Dict, Set, Tuple, Type, TypeVar, TYPE_CHECKING
18-
from spinn_utilities.config_holder import get_config_str_or_none
17+
18+
from spinn_utilities.config_holder import (
19+
get_config_str_or_none, get_report_path)
1920
from spinn_utilities.log import FormatAdapter
2021
from spinn_utilities.progress_bar import ProgressBar
2122
from pacman.model.graphs.application import ApplicationVertex
@@ -30,7 +31,6 @@
3031

3132
CUTOFF = 100
3233
_GRAPH_TITLE = "The graph of the network in graphical form"
33-
_GRAPH_NAME = "network_graph.gv"
3434
_GRAPH_FORMAT = "png"
3535

3636

@@ -82,15 +82,15 @@ def spynnaker_neuron_graph_network_specification_report() -> None:
8282
_generate_edges(dot_diagram, vertex_ids, progress)
8383

8484
# write dot file and generate PDF
85-
file_to_output = os.path.join(
86-
SpynnakerDataView.get_run_dir_path(), _GRAPH_NAME)
87-
progress.end()
85+
file_to_output = get_report_path("path_network_graph")
8886

8987
logger.info(f"rendering dot diagram {file_to_output}")
9088
try:
9189
dot_diagram.render(file_to_output, view=False, format=graph_format)
9290
except exe_not_found_exn:
9391
logger.exception("could not render diagram in {}", file_to_output)
92+
finally:
93+
progress.end()
9494

9595

9696
def _generate_vertices(

spynnaker/pyNN/spynnaker.cfg

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,48 +9,68 @@
99
# and SpiNNMachine/spinn_machine/spinn_machine.cfg
1010

1111
[Reports]
12+
1213
# Note: graphviz is required to draw the graph
1314
write_network_graph = Debug
14-
# Unless specified write_network_graph is ignored for large graphs
15-
# For small graph the default format is used
15+
@write_network_graph = Draws a grpah of the network using graphviz (Which most be installed)
16+
path_network_graph = network_graph.gv
17+
1618
network_graph_format = None
17-
# Set to > 0 to allow profiler to gather samples (assuming enabled in the compiled aplx)
19+
@network_graph_format = Format to use to [draw](write_network_graph) a large graph
20+
Unless specified [draw](write_network_graph) is disabled for large graphs
21+
For small graph the [default format](path_network_graph) is used
22+
1823
n_profile_samples = 0
24+
@n_profile_samples = Set to > 0 to allow profiler to gather samples (assuming enabled in the compiled aplx)
25+
1926
write_expander_iobuf = Debug
27+
@write_expander_iobuf = Reads and writes the iobuff from the onchip synapse expander.
28+
Will be written with [System iobuff](path_iobuf_system)
29+
2030
write_redundant_packet_count_report = Info
31+
@write_redundant_packet_count_report = Writes a report showing how many redundant packets where recorded.
32+
path_redundant_packet_count_report = redundant_packet_count.rpt
2133

2234
[Simulation]
23-
# Maximum spikes per second of any neuron (spike rate in Hertz)
35+
@ = The section covers settings which control how the models behave.
36+
2437
spikes_per_second = 30
38+
@spikes_per_second = Maximum spikes per second of any neuron (spike rate in Hertz)
39+
Used by all neurons that need this for planning, unless a different value is provided.
2540

26-
# The number of standard deviations from the mean to account for in
27-
# the ring buffer in terms of how much safety in precision vs overflowing the
28-
# end user is willing to risk
2941
ring_buffer_sigma = 5
42+
@ring_buffer_sigma = The number of standard deviations from the mean to account for in
43+
the ring buffer in terms of how much safety in precision vs overflowing the
44+
end user is willing to risk
3045

31-
# The amount of space to reserve for incoming spikes
3246
incoming_spike_buffer_size = 256
47+
@incoming_spike_buffer_size = The amount of space to reserve for incoming spikes
3348

34-
# performance limiter to throw away packets not processed in a given time step
3549
drop_late_spikes = False
50+
@drop_late_spikes = performance limiter to throw away packets not processed in a given time step
3651

37-
# The overhead to add to the transfer clocks
38-
# when using a split synapse neuron model
3952
transfer_overhead_clocks = 200
53+
@transfer_overhead_clocks = The overhead to add to the transfer clocks
54+
when using a split synapse neuron model
4055

41-
# The number of "colour" bits to use by default. This is used to account for
42-
# delays over the network that are bigger than 1 time step
4356
n_colour_bits = 4
57+
@n_colour_bits = The number of "colour" bits to use by default. This is used to account for
58+
delays over the network that are bigger than 1 time step
4459

45-
# Whether to error or just warn on non-spynnaker-compatible PyNN
4660
error_on_non_spynnaker_pynn = True
61+
@error_on_non_spynnaker_pynn = Whether to error or just warn on non-spynnaker-compatible PyNN
4762

4863
[Mapping]
49-
# Setting delay_support_adder to None will skip the adder
5064
delay_support_adder = DelaySupportAdder
51-
65+
@delay_support_adder = Algorthm for adding Delay verteices.</br>
66+
Currently supported options:
67+
* DelaySupportAdder: Adds the standard Delays Vertcies if needed
68+
* None: will skip the adder (Not Recommended) </br></br>
5269

5370
[Recording]
54-
# Uncomment the following to change from the defaults
71+
@ = Section for the sending of live spikes.
72+
5573
live_spike_port = 17895
74+
@live_spike_port = Port for the Live Packet Gather
5675
live_spike_host = 0.0.0.0
76+
@live_spike_host = Host for the Live Packet Gather
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[Machine]
2-
timeScaleFactor = 1
2+
time_scale_factor = 1

0 commit comments

Comments
 (0)