├── doc ├── global │ ├── .nojekyll │ ├── spinnaker.css │ ├── python │ │ └── index.html │ └── index.html ├── source │ ├── _static │ │ └── .gitignore │ ├── modules.rst │ ├── .gitignore │ └── index.rst ├── doc_requirements.txt ├── Makefile └── make.bat ├── c_common ├── .gitignore ├── front_end_common_lib │ ├── build │ │ └── .gitignore │ ├── src │ │ ├── eieio_interface.c │ │ └── profiler.c │ └── include │ │ ├── wfi.h │ │ ├── key_atom_map.h │ │ ├── sdp_no_scp.h │ │ └── buffered_eieio_defs.h ├── .common_template.tag ├── .sllt_template.tag ├── models │ ├── chip_power_monitor │ │ └── Makefile │ ├── live_packet_gather │ │ └── Makefile │ ├── command_sender_multicast_source │ │ └── Makefile │ ├── reverse_iptag_multicast_source │ │ └── Makefile │ ├── system_models │ │ ├── data_speed_up_packet_gatherer.mk │ │ ├── extra_monitor.mk │ │ └── Makefile │ ├── compressors │ │ ├── simple_unordered_compressor.mk │ │ ├── simple_pair_compressor.mk │ │ ├── Makefile │ │ └── src │ │ │ └── common │ │ │ ├── minimise.h │ │ │ └── constants.h │ ├── Makefile │ └── fec_models.mk └── Makefile ├── unittests ├── mock │ ├── spinnaker-exe.jar │ └── SpiNNaker-front-end │ │ └── target │ │ └── spinnaker-exe.jar ├── interface │ ├── interface_functions │ │ ├── .gitignore │ │ ├── test_output │ │ │ └── .gitignore │ │ ├── mock.dict │ │ ├── mockalpha.aplx │ │ ├── mockbar.aplx │ │ ├── mockfoo.aplx │ │ └── __init__.py │ ├── __init__.py │ ├── ds │ │ └── __init__.py │ ├── profile │ │ └── __init__.py │ ├── provenance │ │ └── __init__.py │ └── buffer_management │ │ └── __init__.py ├── .gitignore ├── __init__.py ├── data │ ├── __init__.py │ └── manual_check.py ├── utilities │ ├── test_utilities.py │ └── test_json.py ├── test_doc_checker.py ├── test_import_all_test.py ├── test_cfg_checker.py └── test_version.py ├── spinn_front_end_common ├── common_model_binaries │ ├── .gitignore │ └── __init__.py ├── interface │ ├── provenance │ │ ├── provenance.sqlite3 │ │ ├── .gitignore │ │ ├── abstract_provides_local_provenance_data.py │ │ ├── abstract_provides_provenance_data_from_machine.py │ │ ├── __init__.py │ │ ├── timer_category.py │ │ ├── timer_work.py │ │ └── log_store_db.py │ ├── __init__.py │ ├── buffer_management │ │ ├── __init__.py │ │ ├── storage_objects │ │ │ └── __init__.py │ │ └── buffer_models │ │ │ ├── __init__.py │ │ │ ├── abstract_receive_regions_to_host.py │ │ │ └── abstract_receive_buffers_to_host.py │ ├── splitter_selectors │ │ ├── __init__.py │ │ └── splitter_selector.py │ ├── profiling │ │ ├── __init__.py │ │ └── abstract_has_profile_data.py │ ├── simulation │ │ ├── __init__.py │ │ └── simulation_utilities.py │ ├── ds │ │ └── __init__.py │ ├── interface_functions │ │ ├── chip_iobuf_extractor.py │ │ ├── create_notification_protocol.py │ │ ├── split_lpg_vertices.py │ │ ├── chip_iobuf_clearer.py │ │ ├── load_fixed_routes.py │ │ ├── routing_table_loader.py │ │ ├── graph_provenance_gatherer.py │ │ ├── tags_loader.py │ │ ├── energy_provenance_reporter.py │ │ ├── insert_chip_power_monitors_to_graphs.py │ │ ├── locate_executable_start_type.py │ │ ├── chip_runtime_updater.py │ │ ├── read_routing_tables_from_machine.py │ │ └── placements_provenance_gatherer.py │ ├── spinnaker.cfg.template │ └── spinnaker.py ├── py.typed ├── utilities │ ├── __init__.py │ ├── connections │ │ └── __init__.py │ ├── notification_protocol │ │ └── __init__.py │ ├── database │ │ └── __init__.py │ ├── math_constants.py │ ├── utility_objs │ │ ├── dpri_flags.py │ │ ├── extra_monitor_scp_messages │ │ │ ├── speedup_in_scp_commands.py │ │ │ ├── reinjector_scp_commands.py │ │ │ ├── __init__.py │ │ │ ├── clear_reinjection_queue_message.py │ │ │ ├── reset_counters_message.py │ │ │ ├── load_system_mc_routes_message.py │ │ │ └── load_application_mc_routes_message.py │ │ ├── __init__.py │ │ └── executable_type.py │ ├── scp │ │ ├── __init__.py │ │ └── load_mc_routes_process.py │ └── report_functions │ │ ├── real_tags_report.py │ │ ├── __init__.py │ │ ├── write_json_placements.py │ │ ├── memory_map_on_host_report.py │ │ ├── write_json_routing_tables.py │ │ └── write_json_machine.py ├── data │ └── __init__.py ├── _version.py ├── abstract_models │ ├── impl │ │ └── __init__.py │ ├── abstract_can_reset.py │ ├── abstract_has_associated_binary.py │ ├── live_output_device.py │ ├── abstract_supports_database_injection.py │ ├── __init__.py │ ├── abstract_vertex_with_dependent_vertices.py │ ├── has_custom_atom_key_map.py │ ├── abstract_send_me_multicast_commands_vertex.py │ ├── abstract_supports_bit_field_routing_compression.py │ └── abstract_rewrites_data_specification.py ├── __init__.py └── utility_models │ ├── __init__.py │ └── streaming_context_manager.py ├── MANIFEST.in ├── .gitattributes ├── pypi_to_import ├── .images └── External_P2P_Packets.png ├── diagrams ├── standard_layout_of_memory_by_DSE.dia └── standard_layout_of_memory_by_DSE.png ├── fec_integration_tests ├── file_convertor_tests │ ├── .gitignore │ ├── __init__.py │ └── spinnaker.cfg ├── __init__.py ├── interface │ ├── __init__.py │ └── interface_functions │ │ └── __init__.py └── utilities │ ├── __init__.py │ ├── scp │ └── __init__.py │ └── notification_protocol │ ├── __init__.py │ ├── test_stop_pause_notification_protocol.py │ └── test_start_resume_notification_protocol.py ├── .ratexcludes ├── pyproject.toml ├── .pylint_dict.txt ├── .github ├── dependabot.yml └── workflows │ ├── add_prs_to_project.yml │ ├── python_actions.yml │ └── publish.yml ├── .coveragerc ├── .gitignore ├── LICENSE_POLICY.md ├── mypy.bash ├── mypyd.bash ├── fec_local_tests └── test_java_caller.py ├── .readthedocs.yml ├── import_hook.py ├── setup.py └── pylint.bash /doc/global/.nojekyll: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/source/_static/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /c_common/.gitignore: -------------------------------------------------------------------------------- 1 | /doc/ 2 | *.tag 3 | -------------------------------------------------------------------------------- /unittests/mock/spinnaker-exe.jar: -------------------------------------------------------------------------------- 1 | THIS IS A MOCK! 2 | -------------------------------------------------------------------------------- /c_common/front_end_common_lib/build/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /spinn_front_end_common/common_model_binaries/.gitignore: -------------------------------------------------------------------------------- 1 | *.aplx 2 | -------------------------------------------------------------------------------- /unittests/interface/interface_functions/.gitignore: -------------------------------------------------------------------------------- 1 | temp.sqlite3 2 | 3 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include CITATION.cff LICENSE LICENSE_POLICY.md README.md pypi_to_import -------------------------------------------------------------------------------- /unittests/mock/SpiNNaker-front-end/target/spinnaker-exe.jar: -------------------------------------------------------------------------------- 1 | THIS IS A MOCK! 2 | -------------------------------------------------------------------------------- /unittests/.gitignore: -------------------------------------------------------------------------------- 1 | TEMP 2 | application_generated_data_files 3 | reports 4 | test.md -------------------------------------------------------------------------------- /unittests/interface/interface_functions/test_output/.gitignore: -------------------------------------------------------------------------------- 1 | .json 2 | .xml 3 | .sqlite3 -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.c linguist-language=C 2 | *.h linguist-language=C 3 | *.sql linguist-language=SQL 4 | -------------------------------------------------------------------------------- /pypi_to_import: -------------------------------------------------------------------------------- 1 | SpiNNUtilities:spinn_utilities 2 | SpiNNMachine:spinn_machine 3 | SpiNNMan:spinnman 4 | SpiNNaker_PACMAN:pacman -------------------------------------------------------------------------------- /unittests/interface/interface_functions/mock.dict: -------------------------------------------------------------------------------- 1 | Id,Preface,Original 2 | ,DO NOT EDIT,THIS FILE WAS AUTOGENERATED BY MAKE 3 | -------------------------------------------------------------------------------- /unittests/interface/interface_functions/mockalpha.aplx: -------------------------------------------------------------------------------- 1 | Nothing here! 2 | 3 | Which part of MOCK do you not understand! 4 | 5 | -------------------------------------------------------------------------------- /unittests/interface/interface_functions/mockbar.aplx: -------------------------------------------------------------------------------- 1 | Nothing here! 2 | 3 | Which part of MOCK do you not understand! 4 | 5 | -------------------------------------------------------------------------------- /unittests/interface/interface_functions/mockfoo.aplx: -------------------------------------------------------------------------------- 1 | Nothing here! 2 | 3 | Which part of MOCK do you not understand! 4 | 5 | -------------------------------------------------------------------------------- /.images/External_P2P_Packets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpiNNakerManchester/SpiNNFrontEndCommon/HEAD/.images/External_P2P_Packets.png -------------------------------------------------------------------------------- /doc/source/modules.rst: -------------------------------------------------------------------------------- 1 | spinn_front_end_common 2 | ====================== 3 | 4 | .. toctree:: 5 | :maxdepth: 4 6 | 7 | spinn_front_end_common 8 | -------------------------------------------------------------------------------- /diagrams/standard_layout_of_memory_by_DSE.dia: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpiNNakerManchester/SpiNNFrontEndCommon/HEAD/diagrams/standard_layout_of_memory_by_DSE.dia -------------------------------------------------------------------------------- /diagrams/standard_layout_of_memory_by_DSE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpiNNakerManchester/SpiNNFrontEndCommon/HEAD/diagrams/standard_layout_of_memory_by_DSE.png -------------------------------------------------------------------------------- /fec_integration_tests/file_convertor_tests/.gitignore: -------------------------------------------------------------------------------- 1 | machine.json 2 | # Below may be left over from previous versions of tests 3 | test_spinn2.json 4 | test_spinn4.json 5 | test_spinn4_fiddle.json 6 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/provenance/provenance.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpiNNakerManchester/SpiNNFrontEndCommon/HEAD/spinn_front_end_common/interface/provenance/provenance.sqlite3 -------------------------------------------------------------------------------- /c_common/.common_template.tag: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | index 5 | spinn_common: A support library for SpiNNaker applications 6 | index.html 7 | 8 | 9 | -------------------------------------------------------------------------------- /c_common/.sllt_template.tag: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | index 5 | spinnaker_tools: SpiNNaker API, SARK, SC&MP, and Spin1 API 6 | index.html 7 | 8 | 9 | -------------------------------------------------------------------------------- /.ratexcludes: -------------------------------------------------------------------------------- 1 | **/spinnaker_tools/** 2 | **/spinn_common/** 3 | **/modified_src/** 4 | **/reports/** 5 | **/application_generated_data_files/** 6 | **/*.aplx 7 | **/*.json 8 | **/c_common/models/**/build/*.txt 9 | **/iobuf_for_*.txt 10 | **/compressor_on_*.txt 11 | **/test_output/** 12 | **/.nojekyll 13 | **/*.tag 14 | **/SpiNNUtils/** 15 | **/SpiNNMachine/** 16 | **/SpiNNMan/** 17 | **/PACMAN/** 18 | **/spalloc/** 19 | -------------------------------------------------------------------------------- /unittests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /unittests/data/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /fec_integration_tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /spinn_front_end_common/py.typed: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2023 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /unittests/interface/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /unittests/interface/ds/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /unittests/interface/profile/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /fec_integration_tests/interface/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /fec_integration_tests/utilities/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /unittests/interface/provenance/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /fec_integration_tests/utilities/scp/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /unittests/interface/buffer_management/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /fec_integration_tests/file_convertor_tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /unittests/interface/interface_functions/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /fec_integration_tests/interface/interface_functions/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /fec_integration_tests/utilities/notification_protocol/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/provenance/.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | .sqlite3 16 | -------------------------------------------------------------------------------- /c_common/front_end_common_lib/src/eieio_interface.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 The University of Manchester 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | -------------------------------------------------------------------------------- /doc/source/.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | *.rst 16 | !index.rst 17 | !modules.rst 18 | _build 19 | -------------------------------------------------------------------------------- /spinn_front_end_common/common_model_binaries/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | """ 16 | This module contains no python code 17 | """ 18 | -------------------------------------------------------------------------------- /spinn_front_end_common/data/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .fec_data_view import FecDataView 16 | 17 | __all__ = ("FecDataView", ) 18 | -------------------------------------------------------------------------------- /c_common/models/chip_power_monitor/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | APP = chip_power_monitor 16 | SOURCES = chip_power_monitor.c 17 | 18 | include ../fec_models.mk 19 | -------------------------------------------------------------------------------- /c_common/models/live_packet_gather/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | APP = live_packet_gather 16 | SOURCES = live_packet_gather.c 17 | 18 | include ../fec_models.mk 19 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/buffer_management/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .buffer_manager import BufferManager 16 | 17 | __all__ = ("BufferManager", ) 18 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/connections/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .live_event_connection import LiveEventConnection 16 | 17 | __all__ = ("LiveEventConnection", ) 18 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/notification_protocol/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .notification_protocol import NotificationProtocol 16 | 17 | __all__ = ("NotificationProtocol", ) 18 | -------------------------------------------------------------------------------- /c_common/models/command_sender_multicast_source/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | APP = command_sender_multicast_source 16 | SOURCES = command_sender_multicast_source.c 17 | 18 | include ../fec_models.mk 19 | -------------------------------------------------------------------------------- /c_common/models/reverse_iptag_multicast_source/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | APP = reverse_iptag_multicast_source 16 | SOURCES = reverse_iptag_multicast_source.c 17 | 18 | include ../fec_models.mk 19 | -------------------------------------------------------------------------------- /spinn_front_end_common/_version.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | __version__ = "1!7.4.2" 16 | __version_month__ = "TBD" 17 | __version_year__ = "TBD" 18 | __version_day__ = "TBD" 19 | __version_name__ = "" 20 | -------------------------------------------------------------------------------- /spinn_front_end_common/abstract_models/impl/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .machine_data_specable_vertex import MachineDataSpecableVertex 16 | 17 | __all__ = ("MachineDataSpecableVertex",) 18 | -------------------------------------------------------------------------------- /c_common/models/system_models/data_speed_up_packet_gatherer.mk: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | APP = data_speed_up_packet_gatherer 16 | SOURCES = data_speed_up_packet_gatherer.c 17 | 18 | include ../fec_models.mk 19 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/splitter_selectors/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .splitter_selector import splitter_selector, vertex_selector 16 | 17 | __all__ = ('splitter_selector', 'vertex_selector') 18 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2023 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [build-system] 16 | requires = ["setuptools"] 17 | build-backend = "setuptools.build_meta" 18 | 19 | [[tool.mypy.overrides]] 20 | module = ["scipy"] 21 | ignore_missing_imports = true 22 | -------------------------------------------------------------------------------- /c_common/models/compressors/simple_unordered_compressor.mk: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | APP = simple_unordered_compressor 16 | 17 | SOURCES = simple/simple_compressor.c 18 | 19 | FEC_OPT = $(OSPACE) 20 | 21 | include ../fec_models.mk 22 | -------------------------------------------------------------------------------- /c_common/models/system_models/extra_monitor.mk: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | APP = extra_monitor_support 16 | SOURCES = extra_monitor_support.c 17 | 18 | LFLAGS += -Wl,--wrap=sark_int 19 | LIBS += -lsark 20 | 21 | include ../fec_models.mk 22 | -------------------------------------------------------------------------------- /.pylint_dict.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2023 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | # We use a single exception files for all the main repsitories 17 | # It can be found at: 18 | # https://github.com/SpiNNakerManchester/SupportScripts/blob/master/actions/pylint/default_dict.txt 19 | -------------------------------------------------------------------------------- /c_common/models/compressors/simple_pair_compressor.mk: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | APP = simple_pair_compressor 16 | 17 | SOURCES = simple/simple_compressor.c 18 | 19 | FEC_OPT = $(OSPACE) 20 | 21 | include ../fec_models.mk 22 | 23 | CFLAGS += -DUSE_PAIR -------------------------------------------------------------------------------- /doc/global/spinnaker.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 The University of Manchester 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | body { 18 | font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 'Verdana', sans-serif; 19 | font-size: 14px; 20 | } 21 | h1 { 22 | font-size: 1.5em; 23 | } 24 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/profiling/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .abstract_has_profile_data import AbstractHasProfileData 16 | from .profile_data import ProfileData 17 | 18 | __all__ = ("AbstractHasProfileData", "ProfileData") 19 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | version: 2 16 | updates: 17 | - package-ecosystem: "github-actions" 18 | directory: "/" 19 | schedule: 20 | interval: "weekly" 21 | assignees: 22 | - "dkfellows" 23 | reviewers: 24 | - "rowleya" 25 | -------------------------------------------------------------------------------- /c_common/models/system_models/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | APPS = extra_monitor.mk data_speed_up_packet_gatherer.mk 16 | 17 | all: $(APPS) 18 | for f in $(APPS); do $(MAKE) -f $$f || exit $$?; done 19 | 20 | clean: $(DIRS) 21 | for f in $(APPS); do $(MAKE) -f $$f clean || exit $$?; done -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/database/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .database_connection import DatabaseConnection 16 | from .database_reader import DatabaseReader 17 | from .database_writer import DatabaseWriter 18 | 19 | __all__ = ("DatabaseConnection", "DatabaseReader", "DatabaseWriter") 20 | -------------------------------------------------------------------------------- /c_common/models/compressors/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | APPS = simple_pair_compressor.mk \ 16 | simple_unordered_compressor.mk 17 | 18 | all: $(APPS) 19 | for f in $(APPS); do $(MAKE) -f $$f || exit $$?; done 20 | 21 | clean: $(DIRS) 22 | for f in $(APPS); do $(MAKE) -f $$f clean || exit $$?; done 23 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/simulation/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .simulation_utilities import ( 16 | get_simulation_header_array, 17 | get_simulation_header_array_no_timestep) 18 | 19 | __all__ = ("get_simulation_header_array", 20 | "get_simulation_header_array_no_timestep") 21 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [run] 16 | branch = True 17 | 18 | [report] 19 | # Coverage should ignore overloads; they're not real code 20 | exclude_lines = 21 | @overload 22 | \.\.\.$ 23 | raise\s+NotImplementedError 24 | if\s+TYPE_CHECKING: 25 | #\s*(pragma|PRAGMA)[:\s]?\s*(no|NO)\s*(cover|COVER) 26 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/math_constants.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | """ 16 | random math constants 17 | """ 18 | 19 | # pylint: disable=wrong-spelling-in-comment, invalid-name 20 | # Scaling factors for FP arithmetic, see Xin Jin et al. (2008) 21 | LOG_P1 = 8.0 22 | LOG_P2 = 16.0 23 | P1 = 2.0 ** LOG_P1 24 | P2 = 2.0 ** LOG_P2 25 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/utility_objs/dpri_flags.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from enum import Enum 16 | 17 | 18 | class DPRIFlags(Enum): 19 | """ 20 | SCP Dropped Packet Reinjection (DPRI) packet type flags. 21 | """ 22 | MULTICAST = 1 23 | POINT_TO_POINT = 2 24 | NEAREST_NEIGHBOUR = 4 25 | FIXED_ROUTE = 8 26 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/buffer_management/storage_objects/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .buffered_sending_region import BufferedSendingRegion 16 | from .buffers_sent_deque import BuffersSentDeque 17 | from .buffer_database import BufferDatabase 18 | 19 | __all__ = ("BufferedSendingRegion", "BuffersSentDeque", "BufferDatabase") 20 | -------------------------------------------------------------------------------- /doc/global/python/index.html: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 |

The Python documentation is available on readthedocs

23 | 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | .project 16 | .pydevproject 17 | .pytest_cache/ 18 | .idea 19 | *.pyc 20 | *build/ 21 | /dist/ 22 | /SpiNNFrontEndCommon.egg-info/ 23 | .settings 24 | .cproject 25 | Debug 26 | lastfailed 27 | /.cache 28 | .coverage 29 | *.o 30 | *.class 31 | *modified_src/ 32 | *.dict 33 | .dbeaver/ 34 | ._dbeaver/ 35 | test_output 36 | /.mypy_cache/ 37 | -------------------------------------------------------------------------------- /spinn_front_end_common/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from spinn_front_end_common._version import __version__ # NOQA 16 | from spinn_front_end_common._version import __version_name__ # NOQA 17 | from spinn_front_end_common._version import __version_month__ # NOQA 18 | from spinn_front_end_common._version import __version_year__ # NOQA 19 | __author__ = 'stokesa6' 20 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/utility_objs/extra_monitor_scp_messages/speedup_in_scp_commands.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from enum import Enum 16 | 17 | 18 | class SpeedupInSCPCommands(Enum): 19 | """ 20 | SCP Command codes for data speed up in. 21 | """ 22 | SAVE_APPLICATION_MC_ROUTES = 6 23 | LOAD_APPLICATION_MC_ROUTES = 7 24 | LOAD_SYSTEM_MC_ROUTES = 8 25 | -------------------------------------------------------------------------------- /LICENSE_POLICY.md: -------------------------------------------------------------------------------- 1 | # License Agreement 2 | 3 | Up to date information for the whole [SpiNNakerManchester Projects](https://github.com/SpiNNakerManchester) can be found [here](https://spinnakermanchester.github.io/latest/LicenseAgreement.html) 4 | 5 | As shown there the software is currently being released under the Apache License 2.0 listed [here](https://www.apache.org/licenses/LICENSE-2.0) 6 | 7 | 8 | # Paper Authorship 9 | 10 | See: [here](https://spinnakermanchester.github.io/latest/LicenseAgreement.html#paper-authorship) 11 | 12 | # Modifications 13 | 14 | See: [here](https://spinnakermanchester.github.io/latest/LicenseAgreement.html#modifications) 15 | 16 | # Contributors 17 | 18 | For up to date information on Contributors see the graphs/contributors pages on each project. 19 | 20 | For example [https://github.com/SpiNNakerManchester/SpiNNFrontEndCommon/graphs/contributors](https://github.com/SpiNNakerManchester/SpiNNFrontEndCommon/graphs/contributors) 21 | 22 | [Combined list](https://spinnakermanchester.github.io/latest/LicenseAgreement.html#contributors) 23 | 24 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/utility_objs/extra_monitor_scp_messages/reinjector_scp_commands.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from enum import Enum 16 | 17 | 18 | class ReinjectorSCPCommands(Enum): 19 | """ 20 | SCP Command codes for reinjection 21 | """ 22 | SET_ROUTER_WAIT1_TIMEOUT = 0 23 | SET_ROUTER_WAIT2_TIMEOUT = 1 24 | SET_PACKET_TYPES = 2 25 | GET_STATUS = 3 26 | RESET_COUNTERS = 4 27 | EXIT = 5 28 | CLEAR = 6 29 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/utility_objs/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .dpri_flags import DPRIFlags 16 | from .executable_type import ExecutableType 17 | from .live_packet_gather_parameters import LivePacketGatherParameters 18 | from .power_used import PowerUsed 19 | from .reinjection_status import ReInjectionStatus 20 | 21 | __all__ = ( 22 | "DPRIFlags", "ExecutableType", "LivePacketGatherParameters", "PowerUsed", 23 | "ReInjectionStatus") 24 | -------------------------------------------------------------------------------- /c_common/models/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | BUILD_DIRS = compressors \ 16 | live_packet_gather \ 17 | command_sender_multicast_source \ 18 | chip_power_monitor \ 19 | reverse_iptag_multicast_source \ 20 | system_models 21 | 22 | all: $(BUILD_DIRS) 23 | @for d in $(BUILD_DIRS); do $(MAKE) -C $$d || exit $$?; done 24 | 25 | clean: $(BUILD_DIRS) 26 | @for d in $(BUILD_DIRS); do $(MAKE) -C $$d clean || exit $$?; done 27 | -------------------------------------------------------------------------------- /doc/doc_requirements.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | -e git+https://github.com/SpiNNakerManchester/SpiNNUtils.git@master#egg=SpiNNUtilities 16 | -e git+https://github.com/SpiNNakerManchester/SpiNNMachine.git@master#egg=SpiNNMachine 17 | -e git+https://github.com/SpiNNakerManchester/SpiNNMan.git@master#egg=spinnman 18 | -e git+https://github.com/SpiNNakerManchester/PACMAN.git@master#egg=spinnaker-pacman 19 | -e git+https://github.com/SpiNNakerManchester/spalloc.git@master#egg=spalloc 20 | -------------------------------------------------------------------------------- /mypy.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) 2024 The University of Manchester 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # This bash assumes that other repositories are installed in paralled 18 | 19 | # requires the latest mypy 20 | # pip install --upgrade mypy 21 | 22 | utils="../SpiNNUtils/spinn_utilities" 23 | machine="../SpiNNMachine/spinn_machine" 24 | man="../SpiNNMan/spinnman" 25 | pacman="../PACMAN/pacman" 26 | spalloc="../spalloc/spalloc_client" 27 | 28 | mypy $utils $machine $man $pacman $spalloc spinn_front_end_common unittests fec_integration_tests 29 | -------------------------------------------------------------------------------- /doc/source/index.rst: -------------------------------------------------------------------------------- 1 | These pages document the python code for the SpiNNFrontEndCommon_ module 2 | which is part of the SpiNNaker_ Project. 3 | 4 | The c_common_ module contains the documentation of the C code for this module. 5 | 6 | This code depends on SpiNNUtils_, SpiNNMachine_, SpiNNMan_, PACMAN_, 7 | (Combined_documentation_). 8 | 9 | .. _SpiNNaker: https://apt.cs.manchester.ac.uk/projects/SpiNNaker 10 | .. _SpiNNFrontEndCommon: https://github.com/SpiNNakerManchester/SpiNNFrontEndCommon 11 | .. _SpiNNUtils: https://spinnutils.readthedocs.io 12 | .. _SpiNNMachine: https://spinnmachine.readthedocs.io 13 | .. _SpiNNMan: https://spinnman.readthedocs.io 14 | .. _PACMAN: https://pacman.readthedocs.io 15 | .. _Combined_documentation: https://spinnakermanchester.readthedocs.io 16 | .. _c_common: c_common/ 17 | 18 | SpiNNFrontEndCommon 19 | =================== 20 | 21 | .. automodule:: spinn_front_end_common 22 | :noindex: 23 | 24 | Contents: 25 | 26 | .. toctree:: 27 | :maxdepth: 4 28 | 29 | modules 30 | 31 | 32 | Indices and tables 33 | ================== 34 | 35 | * :ref:`genindex` 36 | * :ref:`modindex` 37 | * :ref:`search` 38 | 39 | -------------------------------------------------------------------------------- /mypyd.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) 2024 The University of Manchester 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # This bash assumes that other repositories are installed in paralled 18 | 19 | # requires the latest mypy 20 | # pip install --upgrade mypy 21 | 22 | utils="../SpiNNUtils/spinn_utilities" 23 | machine="../SpiNNMachine/spinn_machine" 24 | man="../SpiNNMan/spinnman" 25 | pacman="../PACMAN/pacman" 26 | spalloc="../spalloc/spalloc_client" 27 | 28 | mypy --disallow-untyped-defs $utils $machine $man $pacman $spalloc spinn_front_end_common unittests fec_integration_tests 29 | 30 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/ds/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .data_specification_base import DataSpecificationBase 16 | from .data_specification_generator import DataSpecificationGenerator 17 | from .data_specification_reloader import DataSpecificationReloader 18 | from .data_type import DataType 19 | from .ds_sqllite_database import DsSqlliteDatabase 20 | 21 | __all__ = ( 22 | "DataSpecificationBase", 23 | "DataSpecificationGenerator", "DataSpecificationReloader", 24 | "DataType", "DsSqlliteDatabase") 25 | -------------------------------------------------------------------------------- /fec_local_tests/test_java_caller.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import unittest 16 | 17 | from spinn_front_end_common.interface.java_caller import JavaCaller 18 | from spinn_front_end_common.interface.config_setup import unittest_setup 19 | 20 | # This test will not run on github actions as there is no Java 21 | 22 | 23 | class TestJavaCaller(unittest.TestCase): 24 | 25 | def setUp(self): 26 | unittest_setup() 27 | 28 | def test_creation(self): 29 | caller = JavaCaller() 30 | assert caller is not None 31 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/interface_functions/chip_iobuf_extractor.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Sequence, Tuple 16 | from spinn_front_end_common.utilities.iobuf_extractor import IOBufExtractor 17 | 18 | 19 | def chip_io_buf_extractor() -> Tuple[Sequence[str], Sequence[str]]: 20 | """ 21 | Extract the logging output buffers from the machine, and separates 22 | lines based on their prefix. 23 | 24 | :return: error_entries, warn_entries 25 | """ 26 | return IOBufExtractor().extract_iobuf() 27 | -------------------------------------------------------------------------------- /.readthedocs.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2023 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | version: 2 16 | build: 17 | os: ubuntu-22.04 18 | tools: 19 | python: "3.11" 20 | jobs: 21 | post_build: 22 | - cd c_common; doxygen ./Doxyfile 23 | - mkdir -p ${READTHEDOCS_OUTPUT}html/c_common/ 24 | - cp -a c_common/doc/html/* ${READTHEDOCS_OUTPUT}html/c_common/ 25 | sphinx: 26 | configuration: doc/source/conf.py 27 | builder: dirhtml 28 | fail_on_warning: false 29 | python: 30 | install: 31 | - requirements: doc/doc_requirements.txt 32 | - method: pip 33 | path: . 34 | -------------------------------------------------------------------------------- /c_common/models/fec_models.mk: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FEC_INSTALL_DIR := $(strip $(if $(FEC_INSTALL_DIR), $(FEC_INSTALL_DIR), $(if $(SPINN_DIRS), $(SPINN_DIRS)/fec_install, $(error FEC_INSTALL_DIR or SPINN_DIRS is not set. Please define FEC_INSTALL_DIR or SPINN_DIRS)))) 16 | 17 | MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) 18 | CURRENT_DIR := $(dir $(MAKEFILE_PATH)) 19 | APP_OUTPUT_DIR := $(abspath $(CURRENT_DIR)../../spinn_front_end_common/common_model_binaries/)/ 20 | 21 | include $(FEC_INSTALL_DIR)/make/fec.mk 22 | 23 | .PRECIOUS: $(MODIFIED_DIR)%.c $(BUILD_DIR)%.o 24 | -------------------------------------------------------------------------------- /import_hook.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | """ 16 | This file is imported by init-hook in the rcfile 17 | https://github.com/SpiNNakerManchester/SupportScripts/blob/master/actions/pylint/strict_rcfile 18 | 19 | It allows you to temporarily add the other spinnaker repositories without making them part of the permemnant python path 20 | 21 | Intended for use when running pylint.bash 22 | """ 23 | import sys 24 | sys.path.append("../SpiNNUtils") 25 | sys.path.append("../SpiNNMachine") 26 | sys.path.append("../SpiNNMan") 27 | sys.path.append("../PACMAN") 28 | sys.path.append("../spalloc") 29 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/interface_functions/create_notification_protocol.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from spinn_front_end_common.utilities.notification_protocol import ( 15 | NotificationProtocol) 16 | 17 | 18 | def create_notification_protocol() -> NotificationProtocol: 19 | """ 20 | Builds the notification protocol for GUI and external device interaction. 21 | 22 | :returns: The newly created protocol. 23 | """ 24 | notification_protocol = NotificationProtocol() 25 | notification_protocol.send_read_notification() 26 | return notification_protocol 27 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/utility_objs/executable_type.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from spinnman.model.enums import ExecutableType as _ExecutableType 16 | 17 | 18 | class ExecutableType(object): 19 | """ 20 | This class is deprecated. Please use spinnman.model.enums.ExecutableType 21 | """ 22 | RUNNING = _ExecutableType.RUNNING 23 | 24 | SYNC = _ExecutableType.SYNC 25 | 26 | USES_SIMULATION_INTERFACE = _ExecutableType.USES_SIMULATION_INTERFACE 27 | 28 | NO_APPLICATION = _ExecutableType.NO_APPLICATION 29 | 30 | SYSTEM = _ExecutableType.SYSTEM 31 | -------------------------------------------------------------------------------- /.github/workflows/add_prs_to_project.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2025 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # This workflow will install Python dependencies, run tests, lint and rat with a variety of Python versions 16 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions 17 | 18 | name: Add PRs to Project 19 | on: 20 | pull_request: 21 | types: 22 | - review_requested 23 | jobs: 24 | call-add-prs-to-project: 25 | uses: SpiNNakerManchester/SupportScripts/.github/workflows/add_prs_to_project.yml@main 26 | secrets: 27 | personal_access_token: ${{ secrets.SPINNAKER_PAT }} 28 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/buffer_management/buffer_models/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .abstract_receive_buffers_to_host import AbstractReceiveBuffersToHost 16 | from .abstract_sends_buffers_from_host import AbstractSendsBuffersFromHost 17 | from .sends_buffers_from_host_pre_buffered_impl import ( 18 | SendsBuffersFromHostPreBufferedImpl) 19 | from .abstract_receive_regions_to_host import AbstractReceiveRegionsToHost 20 | 21 | __all__ = ("AbstractReceiveBuffersToHost", "AbstractSendsBuffersFromHost", 22 | "SendsBuffersFromHostPreBufferedImpl", 23 | "AbstractReceiveRegionsToHost") 24 | -------------------------------------------------------------------------------- /unittests/utilities/test_utilities.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import unittest 16 | from spinn_front_end_common.interface.config_setup import unittest_setup 17 | from spinn_front_end_common.utilities.helpful_functions import ( 18 | get_region_base_address_offset) 19 | 20 | 21 | class TestingUtilities(unittest.TestCase): 22 | 23 | def setUp(self) -> None: 24 | unittest_setup() 25 | 26 | def test_get_region_base_address_offset(self) -> None: 27 | val = get_region_base_address_offset(48, 7) 28 | self.assertEqual(val, 140) 29 | 30 | 31 | if __name__ == '__main__': 32 | unittest.main() 33 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/scp/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .clear_iobuf_process import ClearIOBUFProcess 16 | from .load_mc_routes_process import LoadMCRoutesProcess 17 | from .reinjector_control_process import ReinjectorControlProcess 18 | from .update_runtime_process import UpdateRuntimeProcess 19 | from .get_current_time_process import GetCurrentTimeProcess 20 | from .send_pause_process import SendPauseProcess 21 | 22 | __all__ = ( 23 | "ClearIOBUFProcess", 24 | "LoadMCRoutesProcess", 25 | "ReinjectorControlProcess", 26 | "UpdateRuntimeProcess", 27 | "GetCurrentTimeProcess", 28 | "SendPauseProcess") 29 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # Copyright (c) 2017 The University of Manchester 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | # You can set these variables from the command line. 19 | SPHINXOPTS = 20 | SPHINXBUILD = sphinx-build 21 | SPHINXPROJ = Spinnaker 22 | SOURCEDIR = source 23 | BUILDDIR = build 24 | 25 | # Put it first so that "make" without argument is like "make help". 26 | help: 27 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 28 | 29 | .PHONY: help Makefile 30 | 31 | # Catch-all target: route all unknown targets to Sphinx using the new 32 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 33 | %: Makefile 34 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -------------------------------------------------------------------------------- /spinn_front_end_common/interface/provenance/abstract_provides_local_provenance_data.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from spinn_utilities.abstract_base import AbstractBase, abstractmethod 15 | 16 | 17 | class AbstractProvidesLocalProvenanceData(object, metaclass=AbstractBase): 18 | """ 19 | Indicates an object that provides locally obtained provenance data. 20 | 21 | GraphProvenanceGatherer will check all Vertices and all Edges in 22 | the ApplicationGraph 23 | """ 24 | 25 | __slots__ = () 26 | 27 | @abstractmethod 28 | def get_local_provenance_data(self) -> None: 29 | """ 30 | Get provenance data items and store them in the provenance DB. 31 | """ 32 | raise NotImplementedError 33 | -------------------------------------------------------------------------------- /spinn_front_end_common/abstract_models/abstract_can_reset.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from spinn_utilities.abstract_base import ( 16 | AbstractBase, abstractmethod) 17 | 18 | 19 | class AbstractCanReset(object, metaclass=AbstractBase): 20 | """ 21 | Indicates an object that can be reset to time 0. 22 | 23 | This is used when AbstractSpinnakerBase.reset is called. 24 | All Vertices and all edges in the original graph 25 | (the one added to by the user) will be checked and reset. 26 | """ 27 | __slots__ = () 28 | 29 | @abstractmethod 30 | def reset_to_first_timestep(self) -> None: 31 | """ 32 | Reset the object to first time step. 33 | """ 34 | raise NotImplementedError 35 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/interface_functions/split_lpg_vertices.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import cast 16 | from pacman.model.placements import Placements 17 | from spinn_front_end_common.data import FecDataView 18 | from spinn_front_end_common.utility_models.live_packet_gather import ( 19 | LivePacketGather, _LPGSplitter) 20 | 21 | 22 | def split_lpg_vertices(system_placements: Placements) -> None: 23 | """ 24 | Split any LPG vertices found. 25 | 26 | :param system_placements: existing placements to be added to 27 | """ 28 | for vertex in FecDataView.get_vertices_by_type(LivePacketGather): 29 | cast(_LPGSplitter, vertex.splitter).create_sys_vertices( 30 | system_placements) 31 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/interface_functions/chip_iobuf_clearer.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from spinnman.model.enums import ExecutableType 16 | from spinn_front_end_common.data import FecDataView 17 | from spinn_front_end_common.utilities.scp import ClearIOBUFProcess 18 | 19 | 20 | def chip_io_buf_clearer() -> None: 21 | """ 22 | Clears the logging output buffer of an application running on a 23 | SpiNNaker machine. 24 | """ 25 | core_subsets = FecDataView.get_cores_for_type( 26 | ExecutableType.USES_SIMULATION_INTERFACE) 27 | if core_subsets: 28 | process = ClearIOBUFProcess( 29 | FecDataView.get_scamp_connection_selector()) 30 | process.clear_iobuf(core_subsets, len(core_subsets)) 31 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from setuptools import setup 16 | import shutil 17 | import os 18 | import sys 19 | 20 | 21 | if __name__ == '__main__': 22 | # Repeated installs assume files have not changed 23 | # https://github.com/pypa/setuptools/issues/3236 24 | if len(sys.argv) > 0 and sys.argv[1] == 'egg_info': 25 | # on the first call to setpy.py remove files left by previous install 26 | this_dir = os.path.dirname(os.path.abspath(__file__)) 27 | build_dir = os.path.join(this_dir, "build") 28 | if os.path.isdir(build_dir): 29 | shutil.rmtree(build_dir) 30 | egg_dir = os.path.join(this_dir, "SpiNNFrontEndCommon.egg-info") 31 | if os.path.isdir(egg_dir): 32 | shutil.rmtree(egg_dir) 33 | setup() 34 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/interface_functions/load_fixed_routes.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from spinn_utilities.progress_bar import ProgressBar 16 | from spinn_front_end_common.data import FecDataView 17 | 18 | 19 | def load_fixed_routes() -> None: 20 | """ 21 | Load the set of fixed routes onto a SpiNNaker machine. 22 | """ 23 | fixed_routes = FecDataView.get_fixed_routes() 24 | progress_bar = ProgressBar( 25 | total_number_of_things_to_do=len(fixed_routes), 26 | string_describing_what_being_progressed="loading fixed routes") 27 | app_id = FecDataView.get_app_id() 28 | transceiver = FecDataView.get_transceiver() 29 | for (x, y), route in progress_bar.over(fixed_routes.items()): 30 | transceiver.load_fixed_route(x, y, route, app_id) 31 | -------------------------------------------------------------------------------- /unittests/test_doc_checker.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | import sys 17 | import unittest 18 | 19 | from spinn_utilities.config_setup import unittest_setup 20 | from spinn_utilities.testing.docs_checker import DocsChecker 21 | 22 | 23 | class TestCfgChecker(unittest.TestCase): 24 | 25 | def setUp(self) -> None: 26 | unittest_setup() 27 | 28 | def test_doc_checks(self) -> None: 29 | class_file = sys.modules[self.__module__].__file__ 30 | assert class_file is not None 31 | abs_class_file = os.path.abspath(class_file) 32 | unittest_dir = os.path.dirname(abs_class_file) 33 | repo_dir = os.path.dirname(unittest_dir) 34 | checker = DocsChecker() 35 | checker.check_dir(repo_dir) 36 | checker.check_no_errors() 37 | -------------------------------------------------------------------------------- /unittests/test_import_all_test.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | import unittest 17 | import spinn_utilities.package_loader as package_loader 18 | from spinn_front_end_common.interface.config_setup import unittest_setup 19 | 20 | 21 | class TestImportAllModule(unittest.TestCase): 22 | 23 | def setUp(self) -> None: 24 | unittest_setup() 25 | 26 | def test_import_all(self) -> None: 27 | if os.environ.get('CONTINUOUS_INTEGRATION', 'false').lower() == 'true': 28 | package_loader.load_module( 29 | "spinn_front_end_common", remove_pyc_files=False) 30 | else: 31 | package_loader.load_module( 32 | "spinn_front_end_common", remove_pyc_files=True) 33 | 34 | 35 | if __name__ == "__main__": 36 | unittest.main() 37 | -------------------------------------------------------------------------------- /c_common/front_end_common_lib/include/wfi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 The University of Manchester 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | #include 19 | 20 | //! \file 21 | //! \brief Wait for interrupt. 22 | 23 | /*! \brief Wait for any interrupt to occur. 24 | * \details Code resumes after the wait once the interrupt has been serviced. 25 | * Inline version of code that appears in spin1_api so that we can 26 | * get more compact code. For a description of what this actually does, 27 | * see the relevant ARM documentation 30 | * (it's hardware magic, specific to the ARM968). 31 | */ 32 | static inline void wait_for_interrupt(void) { 33 | asm volatile("mcr p15, 0, r0, c7, c0, 4"); 34 | } 35 | -------------------------------------------------------------------------------- /.github/workflows/python_actions.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # This workflow will install Python dependencies, run tests, lint and rat with a variety of Python versions 16 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions 17 | 18 | name: Python Actions 19 | on: [push] 20 | 21 | jobs: 22 | call: 23 | uses: SpiNNakerManchester/SupportScripts/.github/workflows/python_checks.yml@main 24 | with: 25 | dependencies: SpiNNUtils SpiNNMachine SpiNNMan PACMAN spalloc 26 | test-directories: unittests fec_integration_tests 27 | coverage-package: spinn_front_end_common 28 | flake8-packages: spinn_front_end_common unittests fec_integration_tests 29 | pylint-packages: spinn_front_end_common 30 | mypy-full-packages: spinn_front_end_common unittests fec_integration_tests 31 | secrets: inherit 32 | -------------------------------------------------------------------------------- /doc/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | : Copyright (c) 2017 The University of Manchester 4 | : 5 | : Licensed under the Apache License, Version 2.0 (the "License"); 6 | : you may not use this file except in compliance with the License. 7 | : You may obtain a copy of the License at 8 | : 9 | : https://www.apache.org/licenses/LICENSE-2.0 10 | : 11 | : Unless required by applicable law or agreed to in writing, software 12 | : distributed under the License is distributed on an "AS IS" BASIS, 13 | : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | : See the License for the specific language governing permissions and 15 | : limitations under the License. 16 | 17 | pushd %~dp0 18 | 19 | REM Command file for Sphinx documentation 20 | 21 | if "%SPHINXBUILD%" == "" ( 22 | set SPHINXBUILD=sphinx-build 23 | ) 24 | set SOURCEDIR=source 25 | set BUILDDIR=build 26 | set SPHINXPROJ=Spinnaker 27 | 28 | if "%1" == "" goto help 29 | 30 | %SPHINXBUILD% >NUL 2>NUL 31 | if errorlevel 9009 ( 32 | echo. 33 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 34 | echo.installed, then set the SPHINXBUILD environment variable to point 35 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 36 | echo.may add the Sphinx directory to PATH. 37 | echo. 38 | echo.If you don't have Sphinx installed, grab it from 39 | echo.https://sphinx-doc.org/ 40 | exit /b 1 41 | ) 42 | 43 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 44 | goto end 45 | 46 | :help 47 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 48 | 49 | :end 50 | popd 51 | -------------------------------------------------------------------------------- /fec_integration_tests/file_convertor_tests/spinnaker.cfg: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2025 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # This file is read in after reading an optional .spnnman.cfg from the users home directory 16 | 17 | [Machine] 18 | version = 5 19 | 20 | spalloc_server = https://spinnaker.cs.man.ac.uk/spalloc/ 21 | # User name and password will be read from environment variables 22 | # or use the below format with the user and password set 23 | #spalloc_server = https://user:password@spinnaker.cs.man.ac.uk/spalloc/ 24 | 25 | # Override any settings from .spinnman.cfg in the users home directory 26 | spalloc_height = None 27 | spalloc_width = None 28 | spalloc_triad = None 29 | spalloc_physical = None 30 | spalloc_ip_address = None 31 | spalloc_max_dead_boards = None 32 | spalloc_machine = Test48 33 | virtual_board = False 34 | machine_name = None 35 | 36 | # To avoid a report folder in the test director add a .spinnman cfg to your home directory 37 | # Add at least this option 38 | #[Reports] 39 | #default_report_file_path = -------------------------------------------------------------------------------- /spinn_front_end_common/interface/provenance/abstract_provides_provenance_data_from_machine.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from spinn_utilities.abstract_base import AbstractBase, abstractmethod 15 | from spinn_utilities.require_subclass import require_subclass 16 | from pacman.model.graphs.machine import MachineVertex 17 | from pacman.model.placements import Placement 18 | 19 | 20 | @require_subclass(MachineVertex) 21 | class AbstractProvidesProvenanceDataFromMachine( 22 | object, metaclass=AbstractBase): 23 | """ 24 | Indicates that an object provides provenance data retrieved from the 25 | machine. 26 | """ 27 | 28 | __slots__ = () 29 | 30 | @abstractmethod 31 | def get_provenance_data_from_machine(self, placement: Placement) -> None: 32 | """ 33 | Get provenance data items for a placement and store them in the 34 | provenance DB. 35 | 36 | :param placement: the placement of the object 37 | """ 38 | raise NotImplementedError 39 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/report_functions/real_tags_report.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Any, Iterable 16 | from spinn_utilities.config_holder import get_report_path 17 | from spinn_front_end_common.data import FecDataView 18 | 19 | _REPORT_FILENAME = "tags_on_machine.txt" 20 | 21 | 22 | def tags_from_machine_report() -> None: 23 | """ 24 | Describes what the tags actually present on the machine are. 25 | """ 26 | filename = get_report_path("path_tag_allocation_reports_machine") 27 | tags = _get_tags() 28 | with open(filename, "w", encoding="utf-8") as f: 29 | f.write("Tags actually read off the machine\n") 30 | f.write("==================================\n") 31 | for tag in tags: 32 | f.write(f"{repr(tag)}\n") 33 | 34 | 35 | def _get_tags() -> Iterable[Any]: 36 | try: 37 | return FecDataView.get_transceiver().get_tags() 38 | except Exception as e: # pylint: disable=broad-except 39 | return [e] 40 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/utility_objs/extra_monitor_scp_messages/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .clear_reinjection_queue_message import ClearReinjectionQueueMessage 16 | from .get_reinjection_status_message import ( 17 | GetReinjectionStatusMessage, GetReinjectionStatusMessageResponse) 18 | from .load_application_mc_routes_message import LoadApplicationMCRoutesMessage 19 | from .load_system_mc_routes_message import LoadSystemMCRoutesMessage 20 | from .reset_counters_message import ResetCountersMessage 21 | from .set_reinjection_packet_types_message import ( 22 | SetReinjectionPacketTypesMessage) 23 | from .set_router_timeout_message import SetRouterTimeoutMessage 24 | 25 | __all__ = ( 26 | "ClearReinjectionQueueMessage", 27 | "GetReinjectionStatusMessage", 28 | "GetReinjectionStatusMessageResponse", 29 | "LoadApplicationMCRoutesMessage", 30 | "LoadSystemMCRoutesMessage", 31 | "ResetCountersMessage", 32 | "SetReinjectionPacketTypesMessage", 33 | "SetRouterTimeoutMessage") 34 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/profiling/abstract_has_profile_data.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from spinn_utilities.abstract_base import AbstractBase, abstractmethod 16 | from spinn_utilities.require_subclass import require_subclass 17 | from pacman.model.graphs.machine import MachineVertex 18 | from pacman.model.placements import Placement 19 | from .profile_data import ProfileData 20 | # mypy: disable-error-code=empty-body 21 | 22 | 23 | @require_subclass(MachineVertex) 24 | class AbstractHasProfileData(object, metaclass=AbstractBase): 25 | """ 26 | Indicates a 27 | :py:class:`~pacman.model.graphs.machine.MachineVertex` 28 | that can record a profile. 29 | """ 30 | __slots__ = () 31 | 32 | @abstractmethod 33 | def get_profile_data(self, placement: Placement) -> ProfileData: 34 | """ 35 | Get the profile data recorded during simulation. 36 | 37 | :param placement: 38 | :returns: profile data read from the Machine 39 | """ 40 | raise NotImplementedError 41 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/interface_functions/routing_table_loader.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from spinn_utilities.progress_bar import ProgressBar 16 | from pacman.model.routing_tables import MulticastRoutingTables 17 | from spinn_front_end_common.data import FecDataView 18 | 19 | 20 | def routing_table_loader(router_tables: MulticastRoutingTables) -> None: 21 | """ 22 | Loads routes into initialised routers. 23 | 24 | :param router_tables: 25 | """ 26 | progress = ProgressBar(router_tables.routing_tables, 27 | "Loading routing data onto the machine") 28 | 29 | # load each router table that is needed for the application to run into 30 | # the chips SDRAM 31 | app_id = FecDataView.get_app_id() 32 | transceiver = FecDataView.get_transceiver() 33 | for table in progress.over(router_tables.routing_tables): 34 | if table.number_of_entries: 35 | transceiver.load_multicast_routes( 36 | table.x, table.y, table.multicast_routing_entries, app_id) 37 | -------------------------------------------------------------------------------- /c_common/front_end_common_lib/include/key_atom_map.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 The University of Manchester 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | //! \file 18 | //! \brief Data structures describing a key-to-atom mapping 19 | #ifndef __KEY_ATOM_MAP_H__ 20 | #define __KEY_ATOM_MAP_H__ 21 | 22 | //! \brief A pair containing a multicast key and the number of contiguous 23 | //! atoms (neurons, etc.) to which it applies. 24 | typedef struct key_atom_pair_t { 25 | //! Multicast key. 26 | uint32_t key; 27 | //! Number of atoms for the key. 28 | uint32_t n_atoms; 29 | //! Core shift 30 | uint32_t core_shift: 5; 31 | //! Number of atoms per core 32 | uint32_t n_atoms_per_core: 27; 33 | } key_atom_pair_t; 34 | 35 | //! \brief A mapping from multicast keys to sections of a contiguous range of 36 | //! atoms (neurons, etc.) 37 | typedef struct key_atom_data_t { 38 | //! How many key-atom maps are present? 39 | uint32_t n_pairs; 40 | //! The array of mappings. 41 | key_atom_pair_t pairs[]; 42 | } key_atom_data_t; 43 | 44 | #endif // __KEY_ATOM_MAP_H__ 45 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/provenance/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .abstract_provides_local_provenance_data import ( 16 | AbstractProvidesLocalProvenanceData) 17 | from .abstract_provides_provenance_data_from_machine import ( 18 | AbstractProvidesProvenanceDataFromMachine) 19 | from .fec_timer import FecTimer 20 | from .global_provenance import GlobalProvenance 21 | from .log_store_db import LogStoreDB 22 | from .provenance_reader import ProvenanceReader 23 | from .provides_provenance_data_from_machine_impl import ( 24 | ProvidesProvenanceDataFromMachineImpl) 25 | from .provenance_writer import ProvenanceWriter 26 | from .timer_category import TimerCategory 27 | from .timer_work import TimerWork 28 | 29 | __all__ = ("AbstractProvidesLocalProvenanceData", "FecTimer", 30 | "GlobalProvenance", 31 | "AbstractProvidesProvenanceDataFromMachine", "LogStoreDB", 32 | "ProvenanceReader", "ProvenanceWriter", 33 | "ProvidesProvenanceDataFromMachineImpl", 34 | "TimerCategory", "TimerWork") 35 | -------------------------------------------------------------------------------- /spinn_front_end_common/abstract_models/abstract_has_associated_binary.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from spinn_utilities.abstract_base import AbstractBase, abstractmethod 16 | from spinn_utilities.require_subclass import require_subclass 17 | from pacman.model.graphs.machine import MachineVertex 18 | from spinnman.model.enums import ExecutableType 19 | # mypy: disable-error-code=empty-body 20 | 21 | 22 | @require_subclass(MachineVertex) 23 | class AbstractHasAssociatedBinary(object, metaclass=AbstractBase): 24 | """ 25 | Marks a machine graph vertex that can be launched on a SpiNNaker core. 26 | """ 27 | 28 | __slots__ = () 29 | 30 | @abstractmethod 31 | def get_binary_file_name(self) -> str: 32 | """ 33 | :returns: The binary name to be run for this vertex. 34 | """ 35 | raise NotImplementedError 36 | 37 | @abstractmethod 38 | def get_binary_start_type(self) -> ExecutableType: 39 | """ 40 | :returns: The start type of the binary to be run. 41 | """ 42 | raise NotImplementedError 43 | -------------------------------------------------------------------------------- /spinn_front_end_common/abstract_models/live_output_device.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2023 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Dict, Tuple, List 16 | from spinn_utilities.abstract_base import ( 17 | AbstractBase, abstractmethod) 18 | from pacman.model.graphs.machine.machine_vertex import MachineVertex 19 | 20 | 21 | class LiveOutputDevice(object, metaclass=AbstractBase): 22 | """ 23 | Indicates a device that will live-output other vertices, and so has a 24 | different mapping of keys to atoms. 25 | """ 26 | __slots__ = () 27 | 28 | @abstractmethod 29 | def get_device_output_keys(self) -> Dict[MachineVertex, 30 | List[Tuple[int, int]]]: 31 | """ 32 | Get the atom key mapping to be output for each machine vertex received 33 | by the device to be output. Note that the device may change the keys 34 | as they pass through it, and this needs to be recognised here. 35 | 36 | :returns: Mapping of machine vertex to list of (atom_id, key) 37 | """ 38 | raise NotImplementedError 39 | -------------------------------------------------------------------------------- /doc/global/index.html: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | SpiNNFrontEndCommon Source-Derived Documentation 19 | 20 | 21 | 22 |

SpiNNFrontEndCommon Source-Derived Documentation

23 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /spinn_front_end_common/abstract_models/abstract_supports_database_injection.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from spinn_utilities.abstract_base import AbstractBase, abstractmethod 16 | from spinn_utilities.require_subclass import require_subclass 17 | from pacman.model.graphs.machine import MachineVertex 18 | # mypy: disable-error-code=empty-body 19 | 20 | 21 | @require_subclass(MachineVertex) 22 | class AbstractSupportsDatabaseInjection(object, metaclass=AbstractBase): 23 | """ 24 | Marks a machine vertex as supporting injection of information via a 25 | database running on the controlling host. 26 | """ 27 | 28 | __slots__ = () 29 | 30 | @property 31 | @abstractmethod 32 | def is_in_injection_mode(self) -> bool: 33 | """ 34 | Whether this vertex is actually in injection mode. 35 | """ 36 | raise NotImplementedError 37 | 38 | @property 39 | @abstractmethod 40 | def injection_partition_id(self) -> str: 41 | """ 42 | The partition that packets are being injected with. 43 | """ 44 | raise NotImplementedError 45 | -------------------------------------------------------------------------------- /c_common/models/compressors/src/common/minimise.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 The University of Manchester 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | //! \file 18 | //! \brief API for routing table minimisation 19 | 20 | #ifndef __MINIMISE_H__ 21 | #define __MINIMISE_H__ 22 | 23 | //! \brief Apply the ordered covering algorithm to a routing table 24 | //! \details Minimise the table until either the table is shorter than the 25 | //! target length or no more merges are possible. 26 | //! \param[in] target_length: The length to reach 27 | //! \param[out] failed_by_malloc: Flag stating that it failed due to malloc 28 | //! \param[out] stop_compressing: Variable saying if the compressor should stop 29 | //! and return false; _set by interrupt_ DURING the run of this method! 30 | //! \return Whether successful or not. 31 | bool minimise_run( 32 | int target_length, bool *failed_by_malloc, 33 | volatile bool *stop_compressing); 34 | 35 | //! \brief Whether this is a standalone compressor. 36 | //! \details Mainly used to change logging 37 | //! \return Whether this is a standalone compressor 38 | bool standalone(void); 39 | 40 | #endif // __MINIMISE_H__ 41 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/buffer_management/buffer_models/abstract_receive_regions_to_host.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from typing import Sequence, Tuple 15 | from spinn_utilities.abstract_base import AbstractBase, abstractmethod 16 | from spinn_utilities.require_subclass import require_subclass 17 | from pacman.model.graphs.machine import MachineVertex 18 | from pacman.model.placements import Placement 19 | # mypy: disable-error-code=empty-body 20 | 21 | 22 | @require_subclass(MachineVertex) 23 | class AbstractReceiveRegionsToHost(object, metaclass=AbstractBase): 24 | """ 25 | Indicates that this :py:class:`~pacman.model.graphs.machine.MachineVertex` 26 | has regions that are to be downloaded to the host. 27 | """ 28 | 29 | __slots__ = () 30 | 31 | @abstractmethod 32 | def get_download_regions(self, placement: Placement) -> Sequence[ 33 | Tuple[int, int, int]]: 34 | """ 35 | Get the region IDs that are to be downloaded 36 | 37 | :return: The region number, address and size of the regions to be 38 | downloaded 39 | """ 40 | raise NotImplementedError 41 | -------------------------------------------------------------------------------- /unittests/data/manual_check.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from spinn_utilities.exceptions import NotSetupException, DataNotYetAvialable 16 | from spinn_front_end_common.data import FecDataView 17 | from spinn_front_end_common.data.fec_data_writer import FecDataWriter 18 | from spinn_front_end_common.interface.config_setup import add_spinnaker_cfg 19 | from spinn_utilities.config_holder import clear_cfg_files 20 | 21 | # This can not be a unittest as the unitest suite would use the same 22 | # python console and therefore the same singleton multiple times 23 | 24 | # It can be run multiple time as each run is a new python console 25 | 26 | # reset the configs without mocking the global data 27 | clear_cfg_files(True) 28 | add_spinnaker_cfg() 29 | 30 | view = FecDataView() 31 | try: 32 | a = FecDataView.get_simulation_time_step_us() 33 | raise NotImplementedError("OOPS") 34 | except NotSetupException: 35 | pass 36 | writer = FecDataWriter.setup() 37 | try: 38 | FecDataView.get_simulation_time_step_us() 39 | raise NotImplementedError("OOPS") 40 | except DataNotYetAvialable: 41 | pass 42 | writer.set_up_timings(1, 1) 43 | print(FecDataView.get_simulation_time_step_us()) 44 | -------------------------------------------------------------------------------- /c_common/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | INSTALL_DIRS = front_end_common_lib 16 | BUILD_DIRS = models 17 | 18 | # Locations of tag files 19 | TAGFILES=sllt.tag common.tag 20 | SLLT_TAG=https://spinnakermanchester.github.io/spinnaker_tools/sllt.tag 21 | COMMON_TAG=https://spinnakermanchester.github.io/spinn_common/common.tag 22 | 23 | DOXYGEN ?= doxygen 24 | WGET ?= wget 25 | 26 | all: install build 27 | 28 | build: install $(BUILD_DIRS) 29 | @for d in $(BUILD_DIRS); do $(MAKE) -C $$d || exit $$?; done 30 | 31 | install: $(INSTALL_DIRS) 32 | @for d in $(INSTALL_DIRS); do $(MAKE) -C $$d install || exit $$?; done 33 | 34 | clean: $(BUILD_DIRS) 35 | @for d in $(BUILD_DIRS) $(INSTALL_DIRS); do $(MAKE) -C $$d clean || exit $$?; done 36 | 37 | sllt.tag: .sllt_template.tag 38 | cp .sllt_template.tag sllt.tag 39 | ifneq (, $(shell which $(WGET))) 40 | -$(WGET) -q -O sllt.tag $(SLLT_TAG) 41 | endif 42 | 43 | common.tag: .common_template.tag 44 | cp .common_template.tag common.tag 45 | ifneq (, $(shell which $(WGET))) 46 | -$(WGET) -q -O common.tag $(COMMON_TAG) 47 | endif 48 | 49 | doxygen: $(TAGFILES) 50 | $(DOXYGEN) 51 | doxysetup: $(TAGFILES) 52 | 53 | .PHONY: all build install clean doxygen doxysetup 54 | -------------------------------------------------------------------------------- /spinn_front_end_common/abstract_models/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .abstract_generates_data_specification import ( 16 | AbstractGeneratesDataSpecification) 17 | from .abstract_has_associated_binary import AbstractHasAssociatedBinary 18 | from .abstract_rewrites_data_specification import ( 19 | AbstractRewritesDataSpecification) 20 | from .abstract_send_me_multicast_commands_vertex import ( 21 | AbstractSendMeMulticastCommandsVertex) 22 | from .abstract_vertex_with_dependent_vertices import ( 23 | AbstractVertexWithEdgeToDependentVertices) 24 | from .abstract_supports_database_injection import ( 25 | AbstractSupportsDatabaseInjection) 26 | from .abstract_can_reset import AbstractCanReset 27 | from .has_custom_atom_key_map import HasCustomAtomKeyMap 28 | from .live_output_device import LiveOutputDevice 29 | 30 | __all__ = ("AbstractGeneratesDataSpecification", 31 | "AbstractHasAssociatedBinary", 32 | "AbstractRewritesDataSpecification", 33 | "AbstractSendMeMulticastCommandsVertex", 34 | "AbstractSupportsDatabaseInjection", 35 | "AbstractVertexWithEdgeToDependentVertices", "AbstractCanReset", 36 | "HasCustomAtomKeyMap", "LiveOutputDevice") 37 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/interface_functions/graph_provenance_gatherer.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from spinn_utilities.progress_bar import ProgressBar 16 | from spinn_front_end_common.data import FecDataView 17 | from spinn_front_end_common.interface.provenance import ( 18 | AbstractProvidesLocalProvenanceData) 19 | 20 | 21 | def graph_provenance_gatherer() -> None: 22 | """ 23 | Gets provenance information from the graph. 24 | """ 25 | progress = ProgressBar( 26 | FecDataView.get_n_vertices() + FecDataView.get_n_partitions(), 27 | "Getting provenance data from application graph") 28 | for vertex in progress.over(FecDataView.iterate_vertices(), False): 29 | if isinstance(vertex, AbstractProvidesLocalProvenanceData): 30 | vertex.get_local_provenance_data() 31 | for m_vertex in vertex.machine_vertices: 32 | if isinstance(m_vertex, AbstractProvidesLocalProvenanceData): 33 | m_vertex.get_local_provenance_data() 34 | for partition in progress.over(FecDataView.iterate_partitions()): 35 | for edge in partition.edges: 36 | if isinstance(edge, AbstractProvidesLocalProvenanceData): 37 | edge.get_local_provenance_data() 38 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/spinnaker.cfg.template: -------------------------------------------------------------------------------- 1 | [Machine] 2 | #------- 3 | # Information about the target SpiNNaker board or machine: 4 | # machineName: The name or IP address or the target board 5 | 6 | # One and only one of the three machineName, spalloc_server or virtual_board = True must be set 7 | 8 | # machine name is typically a URL and then version is required 9 | machineName = None 10 | version = None 11 | 12 | # spalloc_server is typically a URL and then port and user are required 13 | spalloc_server = None 14 | spalloc_port = 22244 15 | spalloc_user = None 16 | spalloc_group = None 17 | 18 | # If using virtual_board both width and height must be set 19 | virtual_board = False 20 | # Allowed values pairs are (1,1) (2,2) (8,8) (n*12,m*12) and (n*12+4, m*12+4) 21 | width = None 22 | height = None 23 | 24 | # Time scale factor allows the slowing down of the simulation 25 | time_scale_factor = None 26 | 27 | [Reports] 28 | # options are DEFAULT or a file path 29 | # In all cases oldest folders are automatically deleted to max_reports_kept= 30 | default_report_file_path = DEFAULT 31 | 32 | # If enabled this option will extract the log information from the boards 33 | # iobuf extraction can take a condsiderable time and uses disk space 34 | extract_iobuf = False 35 | 36 | # List the cores to extract iobuf from 37 | # format is x,y,p[:x,y,p]* 38 | # ie comma between x y and p And semicolumn between cores 39 | # ALL extracts from all cores 40 | # None extracts from only those of the requested binary_types 41 | extract_iobuf_from_cores = ALL 42 | 43 | # Comma seperated list of the apply files to extract iobuf for 44 | # include the .aplx but no directory needed 45 | extract_iobuf_from_binary_types = None 46 | 47 | [Mode] 48 | # mode = Production or Debug 49 | # In Debug mode all report boolean config values are automatically overwritten to True 50 | mode = Production 51 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/report_functions/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .board_chip_report import board_chip_report 16 | from .energy_report import EnergyReport 17 | from .fixed_route_from_machine_report import fixed_route_from_machine_report 18 | from .memory_map_on_host_chip_report import memory_map_on_host_chip_report 19 | from .memory_map_on_host_report import memory_map_on_host_report 20 | from .network_specification import network_specification 21 | from .routing_compression_report import ( 22 | generate_routing_compression_checker_report) 23 | from .real_tags_report import tags_from_machine_report 24 | from .write_json_machine import write_json_machine 25 | from .write_json_placements import write_json_placements 26 | from .write_json_routing_tables import write_json_routing_tables 27 | from .drift_report import drift_report 28 | 29 | __all__ = ( 30 | "board_chip_report", 31 | "EnergyReport", 32 | "fixed_route_from_machine_report", 33 | "generate_routing_compression_checker_report", 34 | "network_specification", 35 | "memory_map_on_host_chip_report", 36 | "memory_map_on_host_report", 37 | "tags_from_machine_report", 38 | "write_json_machine", 39 | "write_json_placements", 40 | "write_json_routing_tables", 41 | "drift_report") 42 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/report_functions/write_json_placements.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import logging 16 | import json 17 | 18 | from spinn_utilities.config_holder import get_config_bool, get_report_path 19 | from spinn_utilities.log import FormatAdapter 20 | from spinn_utilities.progress_bar import ProgressBar 21 | from pacman.utilities import file_format_schemas 22 | from pacman.utilities.json_utils import placements_to_json 23 | 24 | _PLACEMENTS_SCHEMA = "placements.json" 25 | logger = FormatAdapter(logging.getLogger(__name__)) 26 | 27 | 28 | def write_json_placements() -> None: 29 | """ 30 | Runs the code to write the placements in JSON. 31 | """ 32 | file_path = get_report_path("path_json_placements") 33 | # Steps are create json object, validate json and write json to a file 34 | with ProgressBar(3, "Converting to JSON Placements") as progress: 35 | json_obj = placements_to_json() 36 | progress.update() 37 | 38 | if get_config_bool("Mapping", "validate_json"): 39 | file_format_schemas.validate(json_obj, _PLACEMENTS_SCHEMA) 40 | progress.update() 41 | 42 | # dump to json file 43 | with open(file_path, "w", encoding="utf-8") as f: 44 | json.dump(json_obj, f) 45 | progress.update() 46 | -------------------------------------------------------------------------------- /spinn_front_end_common/abstract_models/abstract_vertex_with_dependent_vertices.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from typing import Iterable 15 | from spinn_utilities.abstract_base import AbstractBase, abstractmethod 16 | from spinn_utilities.require_subclass import require_subclass 17 | from pacman.model.graphs.application import ApplicationVertex 18 | # mypy: disable-error-code=empty-body 19 | 20 | 21 | @require_subclass(ApplicationVertex) 22 | class AbstractVertexWithEdgeToDependentVertices( 23 | object, metaclass=AbstractBase): 24 | """ 25 | A vertex with a dependent vertices, which should be connected to this 26 | vertex by an edge directly to each of them. 27 | """ 28 | 29 | __slots__ = () 30 | 31 | @abstractmethod 32 | def dependent_vertices(self) -> Iterable[ApplicationVertex]: 33 | """ 34 | :returns: The vertices which this vertex depends upon. 35 | """ 36 | raise NotImplementedError 37 | 38 | @abstractmethod 39 | def edge_partition_identifiers_for_dependent_vertex( 40 | self, vertex: ApplicationVertex) -> Iterable[str]: 41 | """ 42 | :param vertex: 43 | :returns: 44 | The dependent edge identifiers for a particular dependent vertex. 45 | """ 46 | raise NotImplementedError 47 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/interface_functions/tags_loader.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from spinn_utilities.progress_bar import ProgressBar 16 | from spinnman.constants import MAX_TAG_ID 17 | from spinn_front_end_common.data import FecDataView 18 | 19 | 20 | def tags_loader() -> None: 21 | """ 22 | Loads tags onto the machine. 23 | """ 24 | # clear all the tags from the Ethernet connection, as nothing should 25 | # be allowed to use it (no two apps should use the same Ethernet 26 | # connection at the same time) 27 | transceiver = FecDataView.get_transceiver() 28 | progress = ProgressBar(MAX_TAG_ID, "Clearing tags") 29 | for tag_id in progress.over(range(MAX_TAG_ID)): 30 | transceiver.clear_ip_tag(tag_id) 31 | 32 | # Use tags object to supply tag info if it is supplied 33 | tags = FecDataView.get_tags() 34 | iptags = list(tags.ip_tags) 35 | reverse_iptags = list(tags.reverse_ip_tags) 36 | 37 | # Load the IP tags and the Reverse IP tags 38 | progress = ProgressBar( 39 | len(iptags) + len(reverse_iptags), "Loading Tags") 40 | for ip_tag in progress.over(iptags, False): 41 | transceiver.set_ip_tag(ip_tag) 42 | for reverse_ip_tag in progress.over(reverse_iptags): 43 | transceiver.set_reverse_ip_tag(reverse_ip_tag) 44 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/provenance/timer_category.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from enum import auto, Enum 16 | 17 | 18 | class TimerCategory(Enum): 19 | """ 20 | Different Categories a FecTimer can be in 21 | 22 | """ 23 | # Category Constants 24 | WAITING = (auto(), "Waiting") 25 | SETTING_UP = (auto(), "In Setup") 26 | RUN_OTHER = (auto(), "In run other") 27 | GET_MACHINE = (auto(), "Turning on Machine") 28 | LOADING = (auto(), "Loading Stage") 29 | MAPPING = (auto(), "Mapping Stage") 30 | RUN_LOOP = (auto(), "Running Stage") 31 | RESETTING = (auto(), "Resetting") 32 | SHUTTING_DOWN = (auto(), "Shutting down") 33 | 34 | def __new__(cls, value: int, __: str) -> 'TimerCategory': 35 | obj = object.__new__(cls) 36 | obj._value_ = value 37 | return obj 38 | 39 | def __init__(self, value: int, category_name: str) -> None: 40 | """ 41 | :param value: Enum ID 42 | :param category_name: Name to use when describing this category 43 | """ 44 | _ = value 45 | self._category_name = category_name 46 | 47 | @property 48 | def category_name(self) -> str: 49 | """ 50 | The category name as passed into the init. 51 | """ 52 | return self._category_name 53 | -------------------------------------------------------------------------------- /unittests/test_cfg_checker.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | import sys 17 | import unittest 18 | 19 | from spinn_utilities.configs.config_checker import ConfigChecker 20 | from spinn_utilities.configs.config_documentor import ConfigDocumentor 21 | 22 | import spinn_front_end_common 23 | from spinn_front_end_common.interface.config_setup import unittest_setup 24 | 25 | 26 | class TestCfgChecker(unittest.TestCase): 27 | 28 | def setUp(self) -> None: 29 | unittest_setup() 30 | 31 | def test_cfg_checker(self) -> None: 32 | unittests = os.path.dirname(__file__) 33 | parent = os.path.dirname(unittests) 34 | fec_dir = spinn_front_end_common.__path__[0] 35 | local = os.path.join(parent, "fec_local_tests") 36 | fec_it = os.path.join(parent, "fec_integration_tests") 37 | ConfigChecker([fec_dir, local, fec_it, unittests]).check() 38 | 39 | def test_cfg_documentor(self) -> None: 40 | class_file = sys.modules[self.__module__].__file__ 41 | assert class_file is not None 42 | abs_class_file = os.path.abspath(class_file) 43 | class_dir = os.path.dirname(abs_class_file) 44 | test_file = os.path.join(class_dir, 'test.md') 45 | 46 | documentor = ConfigDocumentor() 47 | documentor.md_configs(test_file) 48 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/report_functions/memory_map_on_host_report.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import logging 16 | 17 | from spinn_utilities.config_holder import get_report_path 18 | from spinn_utilities.log import FormatAdapter 19 | 20 | from spinn_front_end_common.interface.ds import DsSqlliteDatabase 21 | 22 | logger = FormatAdapter(logging.getLogger(__name__)) 23 | 24 | 25 | def memory_map_on_host_report() -> None: 26 | """ 27 | Report on memory usage. 28 | """ 29 | file_name = get_report_path("path_memory_map_report_map") 30 | try: 31 | with open(file_name, "w", encoding="utf-8") as f: 32 | f.write("On host data specification executor\n") 33 | with DsSqlliteDatabase() as ds_database: 34 | for xyp, start_address, memory_used, memory_written in \ 35 | ds_database.get_info_for_cores(): 36 | f.write( 37 | f"{xyp}: ('start_address': {start_address}, " 38 | f"hex:{hex(start_address)}), " 39 | f"'memory_used': {memory_used}, " 40 | f"'memory_written': {memory_written}\n") 41 | except IOError: 42 | logger.exception("Generate_placement_reports: Can't open file" 43 | " {} for writing.", file_name) 44 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/spinnaker.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Type 16 | 17 | from spinn_utilities.overrides import overrides 18 | 19 | from spinn_front_end_common.interface.config_setup import ( 20 | add_spinnaker_cfg, add_spinnaker_template) 21 | from spinn_front_end_common.data.fec_data_writer import FecDataWriter 22 | from spinn_front_end_common.interface.abstract_spinnaker_base import ( 23 | AbstractSpinnakerBase) 24 | 25 | 26 | class SpiNNaker(AbstractSpinnakerBase): 27 | """ 28 | The implementation of the SpiNNaker simulation interface. 29 | 30 | .. note:: 31 | You can instantiate this directly from application code. 32 | It is the callers responsibility to only have a single instance. 33 | """ 34 | 35 | @overrides(AbstractSpinnakerBase._add_cfg_defaults_and_template) 36 | def _add_cfg_defaults_and_template(self) -> None: 37 | add_spinnaker_cfg() 38 | add_spinnaker_template() 39 | 40 | @property 41 | @overrides(AbstractSpinnakerBase._user_cfg_file) 42 | def _user_cfg_file(self) -> str: 43 | # Any name can be used here. 44 | return "spinnaker.cfg" 45 | 46 | @property 47 | @overrides(AbstractSpinnakerBase._data_writer_cls) 48 | def _data_writer_cls(self) -> Type[FecDataWriter]: 49 | return FecDataWriter 50 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/provenance/timer_work.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from enum import auto, Enum 16 | 17 | 18 | class TimerWork(Enum): 19 | """ 20 | Different Work types an Algorithm could be doing 21 | """ 22 | 23 | OTHER = (auto(), "Other") 24 | GET_MACHINE = (auto(), "Turning on Machine") 25 | LOADING = (auto(), "Loading Stage") 26 | LOADING_DATA = (auto(), "Loading Data") 27 | # Only for on Machine Compression 28 | COMPRESSING = (auto(), "Compressing") 29 | CONTROL = (auto(), "Control") 30 | SYNAPSE = (auto(), "Expanding Synapse") 31 | RUNNING = (auto(), "Running") 32 | EXTRACTING = (auto(), "Extracting Stage") 33 | EXTRACT_DATA = (auto(), "Extracting Data") 34 | REPORT = (auto(), "Reporting") 35 | 36 | def __new__(cls, value: int, __: str) -> 'TimerWork': 37 | obj = object.__new__(cls) 38 | obj._value_ = value 39 | return obj 40 | 41 | def __init__(self, value: int, work_name: str): 42 | """ 43 | :param value: Enum ID 44 | :param work_name: Descriptor for this Enum 45 | """ 46 | _ = value 47 | self._work_name = work_name 48 | 49 | @property 50 | def work_name(self) -> str: 51 | """ 52 | The name for this timer distinction. 53 | """ 54 | return self._work_name 55 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/interface_functions/energy_provenance_reporter.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import re 16 | from spinn_front_end_common.interface.provenance import ProvenanceWriter 17 | from spinn_front_end_common.utilities.utility_objs import PowerUsed 18 | 19 | #: The simple properties of PowerUsed object to be reported 20 | _BASIC_PROPERTIES = ( 21 | # Counts 22 | "n_chips", "n_cores", "n_boards", "n_frames", 23 | # Times (in seconds) 24 | "exec_time_s", "mapping_time_s", "loading_time_s", 25 | "saving_time_s", "other_time_s", 26 | # Energies (in Joules) 27 | "exec_energy_j", "mapping_energy_j", "loading_energy_j", 28 | "saving_energy_j", "other_energy_j") 29 | #: The main provenance key we use 30 | _PROV_KEY = "power_provenance" 31 | 32 | 33 | def energy_provenance_reporter(power_used: PowerUsed) -> None: 34 | """ 35 | Converts the power usage information into provenance data. 36 | 37 | :param power_used: 38 | The computed basic power consumption information 39 | """ 40 | with ProvenanceWriter() as db: 41 | for prop in _BASIC_PROPERTIES: 42 | db.insert_power( 43 | __prop_name(prop), getattr(power_used, prop)) 44 | 45 | 46 | def __prop_name(name: str) -> str: 47 | name = name.capitalize() 48 | name = re.sub(r"_time_s$", r" time (seconds)", name) 49 | return re.sub(r"_energy_j$", r" energy (Joules)", name) 50 | -------------------------------------------------------------------------------- /c_common/front_end_common_lib/include/sdp_no_scp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 The University of Manchester 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | //! \file 18 | //! \brief Describes a pure SDP message (without SCP payload) 19 | #ifndef _SDP_NO_SCP_H_ 20 | #define _SDP_NO_SCP_H_ 21 | 22 | //! Miscellaneous sizes 23 | enum { 24 | //! How many multicast packets are to be received per SDP packet 25 | ITEMS_PER_DATA_PACKET = 68, 26 | //! Extra length adjustment for the SDP header 27 | LENGTH_OF_SDP_HEADER = 8 28 | }; 29 | 30 | //! An SDP message with purely data, no SCP header 31 | typedef struct sdp_msg_pure_data { // SDP message (=292 bytes) 32 | struct sdp_msg *next; //!< Next in free list 33 | uint16_t length; //!< Length (measured from \p flags field start) 34 | uint16_t checksum; //!< Checksum (if used) 35 | 36 | // next part must match sdp_hdr_t 37 | uint8_t flags; //!< SDP flag byte; first byte actually sent 38 | uint8_t tag; //!< SDP IPtag 39 | uint8_t dest_port; //!< SDP destination port/CPU 40 | uint8_t srce_port; //!< SDP source port/CPU 41 | uint16_t dest_addr; //!< SDP destination address 42 | uint16_t srce_addr; //!< SDP source address 43 | 44 | //! User data (272 bytes when no SCP header) 45 | uint32_t data[ITEMS_PER_DATA_PACKET]; 46 | 47 | uint32_t _PAD; // Private padding 48 | } sdp_msg_pure_data; 49 | 50 | #endif // _SDP_NO_SCP_H_ 51 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/buffer_management/buffer_models/abstract_receive_buffers_to_host.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from typing import Sequence 15 | from spinn_utilities.abstract_base import AbstractBase, abstractmethod 16 | from spinn_utilities.require_subclass import require_subclass 17 | from pacman.model.graphs.machine import MachineVertex 18 | from pacman.model.placements import Placement 19 | # mypy: disable-error-code=empty-body 20 | 21 | 22 | @require_subclass(MachineVertex) 23 | class AbstractReceiveBuffersToHost(object, metaclass=AbstractBase): 24 | """ 25 | Indicates that this :py:class:`~pacman.model.graphs.machine.MachineVertex` 26 | can receive buffers. 27 | """ 28 | 29 | __slots__ = () 30 | 31 | @abstractmethod 32 | def get_recorded_region_ids(self) -> Sequence[int]: 33 | """ 34 | Get the recording region IDs that have been recorded using buffering. 35 | 36 | :return: The region numbers that have active recording 37 | """ 38 | raise NotImplementedError 39 | 40 | @abstractmethod 41 | def get_recording_region_base_address(self, placement: Placement) -> int: 42 | """ 43 | Get the recording region base address. 44 | 45 | :param placement: 46 | the placement object of the core to find the address of 47 | :return: the base address of the recording region 48 | """ 49 | raise NotImplementedError 50 | -------------------------------------------------------------------------------- /c_common/models/compressors/src/common/constants.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 The University of Manchester 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | //! \dir 18 | //! \brief Common files for sorter and compressor 19 | //! \file 20 | //! \brief General constants 21 | #ifndef __CONSTANTS_H__ 22 | #define __CONSTANTS_H__ 23 | 24 | //! max number of processors on chip used for app purposes 25 | #define MAX_PROCESSORS 18 26 | 27 | //! max length of the router table entries 28 | #define TARGET_LENGTH 1023 29 | 30 | //! \brief timeout on attempts to send sdp message 31 | #define _SDP_TIMEOUT 100 32 | 33 | //! random port as 0 is in use by scamp/sark 34 | #define RANDOM_PORT 4 35 | 36 | //! word to byte multiplier 37 | #define WORD_TO_BYTE_MULTIPLIER 4 38 | 39 | //! SDP flag for not requiring a reply 40 | #define REPLY_NOT_EXPECTED 0x07 41 | 42 | //! bits in a word 43 | #define BITS_IN_A_WORD 32 44 | 45 | //! flag saying there is no valid result for a given search ( 46 | //! locate processor, locate midpoint) 47 | #define FAILED_TO_FIND -1 48 | 49 | //! \brief move for processor id in the circular queue 50 | #define CORE_MOVE 16 51 | 52 | //! \brief mask to get the finished state 53 | #define FINISHED_STATE_MASK 0x0000FFFF 54 | 55 | //! how many tables the uncompressed router table entries is 56 | #define N_UNCOMPRESSED_TABLE 1 57 | 58 | //! \brief number of bitfields that no bitfields run needs 59 | #define NO_BIT_FIELDS 0 60 | 61 | #endif // __CONSTANTS_H__ 62 | -------------------------------------------------------------------------------- /spinn_front_end_common/utility_models/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .chip_power_monitor_machine_vertex import ChipPowerMonitorMachineVertex 16 | from .command_sender import CommandSender 17 | from .command_sender_machine_vertex import CommandSenderMachineVertex 18 | from .data_speed_up_packet_gatherer_machine_vertex import ( 19 | DataSpeedUpPacketGatherMachineVertex) 20 | from .eieio_parameters import EIEIOParameters 21 | from .extra_monitor_support_machine_vertex import ( 22 | ExtraMonitorSupportMachineVertex) 23 | from .live_packet_gather import LivePacketGather 24 | from .live_packet_gather_machine_vertex import LivePacketGatherMachineVertex 25 | from .multi_cast_command import MultiCastCommand 26 | from .reverse_ip_tag_multi_cast_source import ReverseIpTagMultiCastSource 27 | from .reverse_ip_tag_multicast_source_machine_vertex import ( 28 | ReverseIPTagMulticastSourceMachineVertex) 29 | from .streaming_context_manager import StreamingContextManager 30 | 31 | __all__ = ("CommandSender", "CommandSenderMachineVertex", 32 | "ChipPowerMonitorMachineVertex", 33 | "DataSpeedUpPacketGatherMachineVertex", 34 | "EIEIOParameters", "ExtraMonitorSupportMachineVertex", 35 | "LivePacketGather", "LivePacketGatherMachineVertex", 36 | "MultiCastCommand", "ReverseIpTagMultiCastSource", 37 | "ReverseIPTagMulticastSourceMachineVertex", 38 | "StreamingContextManager") 39 | -------------------------------------------------------------------------------- /spinn_front_end_common/abstract_models/has_custom_atom_key_map.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from typing import Iterable, Tuple 15 | from spinn_utilities.abstract_base import AbstractBase, abstractmethod 16 | from spinn_utilities.require_subclass import require_subclass 17 | from pacman.model.graphs.application import ApplicationVertex 18 | from pacman.model.graphs.machine.machine_vertex import MachineVertex 19 | from pacman.model.routing_info.routing_info import RoutingInfo 20 | # mypy: disable-error-code=empty-body 21 | 22 | 23 | @require_subclass(ApplicationVertex) 24 | class HasCustomAtomKeyMap(object, metaclass=AbstractBase): 25 | """ 26 | An object that can provide a custom atom-key mapping for a partition. 27 | Useful when there isn't a one-to-one correspondence between atoms 28 | and keys for a given partition. 29 | """ 30 | 31 | @abstractmethod 32 | def get_atom_key_map( 33 | self, pre_vertex: MachineVertex, partition_id: str, 34 | routing_info: RoutingInfo) -> Iterable[Tuple[int, int]]: 35 | """ 36 | Get the mapping between atoms and keys for the given partition id, 37 | and for the given machine pre-vertex. 38 | 39 | :param pre_vertex: 40 | The machine vertex to get the map for 41 | :param partition_id: The partition to get the map for 42 | :param routing_info: 43 | Routing information 44 | :return: A list of (atom_id, key) 45 | """ 46 | raise NotImplementedError 47 | -------------------------------------------------------------------------------- /unittests/utilities/test_json.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2024 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | import unittest 15 | 16 | from spinn_utilities.config_holder import set_config 17 | 18 | from spinn_machine.version.version_strings import VersionStrings 19 | 20 | from pacman.model.graphs.machine import SimpleMachineVertex 21 | from pacman.model.placements import Placement, Placements 22 | 23 | from spinn_front_end_common.data.fec_data_writer import FecDataWriter 24 | from spinn_front_end_common.interface.config_setup import unittest_setup 25 | from spinn_front_end_common.utilities.report_functions import ( 26 | write_json_machine, write_json_placements) 27 | 28 | 29 | class TestJson(unittest.TestCase): 30 | 31 | def setUp(self) -> None: 32 | unittest_setup() 33 | set_config("Mapping", "validate_json", "True") 34 | 35 | def test_placements(self) -> None: 36 | """ 37 | tests the placements iterator functionality. 38 | """ 39 | writer = FecDataWriter.mock() 40 | subv = list() 41 | for i in range(5): 42 | subv.append(SimpleMachineVertex(None, "")) 43 | 44 | pl = list() 45 | for i in range(4): 46 | pl.append(Placement(subv[i], 0, 0, i)) 47 | writer.set_placements(Placements(pl)) 48 | 49 | # write and validate 50 | write_json_placements() 51 | 52 | def test_machine(self) -> None: 53 | set_config("Machine", "versions", VersionStrings.ANY.text) 54 | # write and validate 55 | write_json_machine() 56 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/report_functions/write_json_routing_tables.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import json 16 | 17 | from spinn_utilities.config_holder import get_config_bool, get_report_path 18 | from spinn_utilities.progress_bar import ProgressBar 19 | from pacman.utilities import file_format_schemas 20 | from pacman.model.routing_tables.multicast_routing_tables import ( 21 | to_json, MulticastRoutingTables) 22 | 23 | _ROUTING_TABLES_SCHEMA = "routing_tables.json" 24 | 25 | 26 | def write_json_routing_tables(router_tables: MulticastRoutingTables) -> str: 27 | """ 28 | Runs the code to write the machine in Java readable JSON. 29 | 30 | :param router_tables: 31 | Routing Tables to convert. Could be uncompressed or compressed 32 | :returns: Path to the json file 33 | """ 34 | file_path = get_report_path("path_json_routing_tables") 35 | # Steps are create json object, validate json and write json to a file 36 | with ProgressBar(3, "Converting to JSON RouterTables") as progress: 37 | json_obj = to_json(router_tables) 38 | progress.update() 39 | 40 | if get_config_bool("Mapping", "validate_json"): 41 | # validate the schema 42 | file_format_schemas.validate(json_obj, _ROUTING_TABLES_SCHEMA) 43 | progress.update() 44 | 45 | # dump to json file 46 | with open(file_path, "w", encoding="utf-8") as f: 47 | json.dump(json_obj, f) 48 | progress.update() 49 | 50 | return file_path 51 | -------------------------------------------------------------------------------- /spinn_front_end_common/utility_models/streaming_context_manager.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from __future__ import annotations 15 | from types import TracebackType 16 | from typing import ContextManager, Iterable, Optional, Type, TYPE_CHECKING 17 | from typing_extensions import Literal 18 | if TYPE_CHECKING: 19 | from .data_speed_up_packet_gatherer_machine_vertex import ( 20 | DataSpeedUpPacketGatherMachineVertex) 21 | 22 | 23 | class StreamingContextManager(ContextManager[None]): 24 | """ 25 | The implementation of the context manager object for streaming 26 | configuration control. 27 | """ 28 | __slots__ = ("_gatherers", ) 29 | 30 | def __init__( 31 | self, gatherers: Iterable[DataSpeedUpPacketGatherMachineVertex]): 32 | """ 33 | :param gatherers: 34 | """ 35 | self._gatherers = list(gatherers) 36 | 37 | def __enter__(self) -> None: 38 | for gatherer in self._gatherers: 39 | gatherer.load_system_routing_tables() 40 | for gatherer in self._gatherers: 41 | gatherer.set_cores_for_data_streaming() 42 | 43 | def __exit__(self, exc_type: Optional[Type], 44 | exc_val: Optional[BaseException], 45 | exc_tb: Optional[TracebackType]) -> Literal[False]: 46 | for gatherer in self._gatherers: 47 | gatherer.unset_cores_for_data_streaming() 48 | for gatherer in self._gatherers: 49 | gatherer.load_application_routing_tables() 50 | return False 51 | -------------------------------------------------------------------------------- /c_common/front_end_common_lib/src/profiler.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 The University of Manchester 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | //! \file 18 | //! 19 | //! \brief Implementation of profiler.h 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | //--------------------------------------- 27 | // Globals 28 | //--------------------------------------- 29 | struct profiler_state profiler_state; 30 | 31 | //--------------------------------------- 32 | // Functions 33 | //--------------------------------------- 34 | void profiler_init(uint32_t* data_region) { 35 | log_info("Reading profile setup from 0x%08x", data_region); 36 | profiler_state.samples_remaining = data_region[0]; 37 | profiler_state.count = &data_region[0]; 38 | profiler_state.output = &data_region[1]; 39 | 40 | log_info("Initialising profiler with storage for %u samples starting at 0x%08x", 41 | profiler_state.samples_remaining, profiler_state.output); 42 | 43 | // If profiler is turned on, start timer 2 with no clock divider 44 | if (profiler_state.samples_remaining > 0) { 45 | tc[T2_CONTROL] = 0x82; 46 | tc[T2_LOAD] = 0; 47 | } 48 | } 49 | 50 | //--------------------------------------- 51 | void profiler_finalise(void) { 52 | uint32_t words_written = (profiler_state.output - profiler_state.count) - 1; 53 | *profiler_state.count = words_written; 54 | log_info("Profiler wrote %u bytes to 0x%08x", 55 | (words_written * 4) + 4, profiler_state.count); 56 | } 57 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/interface_functions/insert_chip_power_monitors_to_graphs.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from spinn_utilities.progress_bar import ProgressBar 15 | from pacman.model.placements import Placement, Placements 16 | from spinn_front_end_common.data import FecDataView 17 | from spinn_front_end_common.utility_models import ( 18 | ChipPowerMonitorMachineVertex) 19 | from spinn_front_end_common.utilities.utility_calls import ( 20 | pick_core_for_system_placement) 21 | 22 | 23 | def sample_chip_power_monitor() -> ChipPowerMonitorMachineVertex: 24 | """ 25 | Creates an unplaced sample of the Vertex's used. 26 | 27 | This vertex should only be used for size estimates. 28 | 29 | :returns: An unused power monitor vertex. 30 | """ 31 | return ChipPowerMonitorMachineVertex( 32 | "Sample ChipPowerMonitorMachineVertex") 33 | 34 | 35 | def insert_chip_power_monitors_to_graphs(placements: Placements) -> None: 36 | """ 37 | Adds chip power monitors into a given graph. 38 | 39 | :param placements: 40 | """ 41 | machine = FecDataView.get_machine() 42 | # create progress bar 43 | progress = ProgressBar( 44 | machine.n_chips, "Adding Chip power monitors to Graph") 45 | 46 | for chip in progress.over(machine.chips): 47 | vertex = ChipPowerMonitorMachineVertex( 48 | f"ChipPowerMonitor on {chip.x}, {chip.y}") 49 | p = pick_core_for_system_placement(placements, chip) 50 | placements.add_placement(Placement(vertex, chip.x, chip.y, p)) 51 | -------------------------------------------------------------------------------- /fec_integration_tests/utilities/notification_protocol/test_stop_pause_notification_protocol.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import unittest 16 | from spinn_front_end_common.interface.config_setup import unittest_setup 17 | from spinn_utilities.socket_address import SocketAddress 18 | from spinnman.connections.udp_packet_connections import EIEIOConnection 19 | from spinnman.messages.eieio.command_messages import EIEIOCommandMessage 20 | from spinnman.constants import EIEIO_COMMAND_IDS 21 | from spinn_front_end_common.data.fec_data_writer import FecDataWriter 22 | from spinn_front_end_common.utilities.notification_protocol import ( 23 | NotificationProtocol) 24 | 25 | 26 | class TestStopPauseNotificationProtocol(unittest.TestCase): 27 | 28 | def setUp(self) -> None: 29 | unittest_setup() 30 | 31 | def test_send_stop_pause_notification(self) -> None: 32 | """ Test the sending of the stop/pause message of the notification\ 33 | protocol 34 | """ 35 | listener = EIEIOConnection() 36 | FecDataWriter.mock().add_database_socket_address(SocketAddress( 37 | "127.0.0.1", listener.local_port, None)) 38 | protocol = NotificationProtocol() 39 | protocol.send_stop_pause_notification() 40 | message = listener.receive_eieio_message(timeout=10) 41 | assert isinstance(message, EIEIOCommandMessage) 42 | self.assertEqual( 43 | message.eieio_header.command, 44 | EIEIO_COMMAND_IDS.STOP_PAUSE_NOTIFICATION.value) 45 | 46 | 47 | if __name__ == '__main__': 48 | unittest.main() 49 | -------------------------------------------------------------------------------- /fec_integration_tests/utilities/notification_protocol/test_start_resume_notification_protocol.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import unittest 16 | from spinn_front_end_common.interface.config_setup import unittest_setup 17 | from spinn_utilities.socket_address import SocketAddress 18 | from spinnman.connections.udp_packet_connections import EIEIOConnection 19 | from spinnman.messages.eieio.command_messages import EIEIOCommandMessage 20 | from spinnman.constants import EIEIO_COMMAND_IDS 21 | from spinn_front_end_common.data.fec_data_writer import FecDataWriter 22 | from spinn_front_end_common.utilities.notification_protocol import ( 23 | NotificationProtocol) 24 | 25 | 26 | class TestStartResumeNotificationProtocol(unittest.TestCase): 27 | 28 | def setUp(self) -> None: 29 | unittest_setup() 30 | 31 | def test_send_start_resume_notification(self) -> None: 32 | """ Test the sending of the start/resume message of the notification\ 33 | protocol 34 | """ 35 | listener = EIEIOConnection() 36 | FecDataWriter.mock().add_database_socket_address(SocketAddress( 37 | "127.0.0.1", listener.local_port, None)) 38 | protocol = NotificationProtocol() 39 | protocol.send_start_resume_notification() 40 | message = listener.receive_eieio_message(timeout=10) 41 | assert isinstance(message, EIEIOCommandMessage) 42 | self.assertEqual( 43 | message.eieio_header.command, 44 | EIEIO_COMMAND_IDS.START_RESUME_NOTIFICATION.value) 45 | 46 | 47 | if __name__ == '__main__': 48 | unittest.main() 49 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/utility_objs/extra_monitor_scp_messages/clear_reinjection_queue_message.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from spinn_utilities.overrides import overrides 16 | from spinnman.messages.scp import SCPRequestHeader 17 | from spinnman.messages.scp.abstract_messages import AbstractSCPRequest 18 | from spinnman.messages.sdp import SDPFlag, SDPHeader 19 | from spinnman.messages.scp.impl.check_ok_response import CheckOKResponse 20 | from spinnman.model.enums import SDP_PORTS 21 | from .reinjector_scp_commands import ReinjectorSCPCommands 22 | 23 | 24 | class ClearReinjectionQueueMessage(AbstractSCPRequest[CheckOKResponse]): 25 | """ 26 | An SCP Request to set the dropped packet reinjected packet types. 27 | """ 28 | 29 | __slots__ = () 30 | 31 | def __init__(self, x: int, y: int, p: int): 32 | """ 33 | :param x: The x-coordinate of a chip 34 | :param y: The y-coordinate of a chip 35 | :param p: The processor running the extra monitor vertex 36 | """ 37 | super().__init__( 38 | SDPHeader( 39 | flags=SDPFlag.REPLY_EXPECTED, 40 | destination_port=( 41 | SDP_PORTS.EXTRA_MONITOR_CORE_REINJECTION.value), 42 | destination_cpu=p, destination_chip_x=x, 43 | destination_chip_y=y), 44 | SCPRequestHeader(command=ReinjectorSCPCommands.CLEAR)) 45 | 46 | @overrides(AbstractSCPRequest.get_scp_response) 47 | def get_scp_response(self) -> CheckOKResponse: 48 | return CheckOKResponse( 49 | "Set reinjected packet types", ReinjectorSCPCommands.CLEAR) 50 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: Publish 16 | 17 | on: 18 | push: 19 | branches: [ master ] 20 | 21 | env: 22 | ROOT_DOC_DIR: doc/global 23 | C_DOC_DIR: c_common/doc/html 24 | DEPLOY_DIR: deploy 25 | 26 | jobs: 27 | build: 28 | permissions: 29 | contents: write 30 | runs-on: ubuntu-latest 31 | timeout-minutes: 5 32 | steps: 33 | - name: Checkout 34 | uses: actions/checkout@v4 35 | - name: Checkout SupportScripts 36 | uses: actions/checkout@v4 37 | with: 38 | repository: SpiNNakerManchester/SupportScripts 39 | path: support 40 | - name: Set dynamic environment variables 41 | run: | 42 | echo "SPINN_DIRS=$PWD/spinnaker_tools" >> $GITHUB_ENV 43 | 44 | - name: Checkout SpiNNaker Dependencies 45 | uses: SpiNNakerManchester/SupportScripts/actions/install-spinn-deps@main 46 | with: 47 | repositories: > 48 | spinnaker_tools 49 | install: true 50 | 51 | - name: Read tags 52 | run: make doxysetup 53 | working-directory: c_common 54 | 55 | - name: Build C documentation 56 | uses: mattnotmitt/doxygen-action@v1.12.0 57 | with: 58 | working-directory: c_common 59 | 60 | - name: Merge documentation trees 61 | run: | 62 | cp -vaT $ROOT_DOC_DIR $DEPLOY_DIR 63 | cp -vaT $C_DOC_DIR $DEPLOY_DIR/c 64 | - name: Deploy to GitHub Pages 65 | uses: JamesIves/github-pages-deploy-action@v4.7.2 66 | with: 67 | branch: gh-pages 68 | folder: ${{ env.DEPLOY_DIR }} 69 | -------------------------------------------------------------------------------- /spinn_front_end_common/abstract_models/abstract_send_me_multicast_commands_vertex.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from __future__ import annotations 15 | from typing import Iterable, List, TYPE_CHECKING 16 | from spinn_utilities.abstract_base import AbstractBase, abstractmethod 17 | if TYPE_CHECKING: 18 | from spinn_front_end_common.utility_models import MultiCastCommand 19 | # mypy: disable-error-code=empty-body 20 | 21 | 22 | class AbstractSendMeMulticastCommandsVertex(object, metaclass=AbstractBase): 23 | """ 24 | A device that may be a virtual vertex which wants to commands to be 25 | sent to it as multicast packets at fixed points in the simulation. 26 | 27 | .. note:: 28 | The device might not be a vertex at all. It could instead be 29 | instantiated entirely host side, in which case these methods will 30 | never be called. 31 | """ 32 | 33 | __slots__ = () 34 | 35 | @property 36 | @abstractmethod 37 | def start_resume_commands(self) -> Iterable[MultiCastCommand]: 38 | """ 39 | The commands needed when starting or resuming simulation. 40 | """ 41 | raise NotImplementedError 42 | 43 | @property 44 | @abstractmethod 45 | def pause_stop_commands(self) -> Iterable[MultiCastCommand]: 46 | """ 47 | The commands needed when pausing or stopping simulation. 48 | """ 49 | raise NotImplementedError 50 | 51 | @property 52 | @abstractmethod 53 | def timed_commands(self) -> List[MultiCastCommand]: 54 | """ 55 | The commands to be sent at given times in the simulation. 56 | """ 57 | raise NotImplementedError 58 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/utility_objs/extra_monitor_scp_messages/reset_counters_message.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from spinn_utilities.overrides import overrides 16 | from spinnman.messages.scp import SCPRequestHeader 17 | from spinnman.messages.scp.abstract_messages import AbstractSCPRequest 18 | from spinnman.messages.sdp import SDPFlag, SDPHeader 19 | from spinnman.messages.scp.impl.check_ok_response import CheckOKResponse 20 | from spinnman.model.enums import SDP_PORTS 21 | from .reinjector_scp_commands import ReinjectorSCPCommands 22 | 23 | 24 | class ResetCountersMessage(AbstractSCPRequest[CheckOKResponse]): 25 | """ 26 | An SCP Request to reset the statistics counters of the dropped packet 27 | reinjection. 28 | """ 29 | __slots__ = () 30 | 31 | def __init__(self, x: int, y: int, p: int): 32 | """ 33 | :param x: The x-coordinate of a chip 34 | :param y: The y-coordinate of a chip 35 | :param p: The processor running the extra monitor vertex 36 | """ 37 | super().__init__( 38 | SDPHeader( 39 | flags=SDPFlag.REPLY_NOT_EXPECTED, 40 | destination_port=( 41 | SDP_PORTS.EXTRA_MONITOR_CORE_REINJECTION.value), 42 | destination_cpu=p, destination_chip_x=x, 43 | destination_chip_y=y), 44 | SCPRequestHeader(command=ReinjectorSCPCommands.RESET_COUNTERS)) 45 | 46 | @overrides(AbstractSCPRequest.get_scp_response) 47 | def get_scp_response(self) -> CheckOKResponse: 48 | return CheckOKResponse( 49 | "Reset dropped packet reinjection counters", 50 | ReinjectorSCPCommands.RESET_COUNTERS) 51 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/utility_objs/extra_monitor_scp_messages/load_system_mc_routes_message.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from spinn_utilities.overrides import overrides 16 | from spinnman.messages.scp import SCPRequestHeader 17 | from spinnman.messages.scp.abstract_messages import AbstractSCPRequest 18 | from spinnman.messages.sdp import SDPFlag, SDPHeader 19 | from spinnman.messages.scp.impl.check_ok_response import CheckOKResponse 20 | from spinnman.model.enums import SDP_PORTS 21 | from .speedup_in_scp_commands import SpeedupInSCPCommands 22 | 23 | 24 | class LoadSystemMCRoutesMessage(AbstractSCPRequest[CheckOKResponse]): 25 | """ 26 | An SCP Request to write the system multicast routes into the router. 27 | """ 28 | 29 | __slots__ = () 30 | 31 | def __init__(self, x: int, y: int, p: int): 32 | """ 33 | :param x: The x-coordinate of a chip 34 | :param y: The y-coordinate of a chip 35 | :param p: The processor running the extra monitor vertex 36 | """ 37 | super().__init__( 38 | SDPHeader( 39 | flags=SDPFlag.REPLY_EXPECTED, 40 | destination_port=( 41 | SDP_PORTS.EXTRA_MONITOR_CORE_DATA_IN_SPEED_UP.value), 42 | destination_cpu=p, destination_chip_x=x, 43 | destination_chip_y=y), 44 | SCPRequestHeader( 45 | command=SpeedupInSCPCommands.LOAD_SYSTEM_MC_ROUTES)) 46 | 47 | @overrides(AbstractSCPRequest.get_scp_response) 48 | def get_scp_response(self) -> CheckOKResponse: 49 | return CheckOKResponse( 50 | "load system multicast routes", 51 | SpeedupInSCPCommands.LOAD_SYSTEM_MC_ROUTES) 52 | -------------------------------------------------------------------------------- /spinn_front_end_common/abstract_models/abstract_supports_bit_field_routing_compression.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from typing import List, Tuple 15 | from spinn_utilities.abstract_base import AbstractBase, abstractmethod 16 | from spinn_utilities.require_subclass import require_subclass 17 | from pacman.model.graphs.machine import MachineVertex 18 | from pacman.model.placements import Placement 19 | # mypy: disable-error-code=empty-body 20 | 21 | 22 | @require_subclass(MachineVertex) 23 | class AbstractSupportsBitFieldRoutingCompression( 24 | object, metaclass=AbstractBase): 25 | """ 26 | Marks a machine vertex that can support having the on-chip bitfield 27 | compressor running on its core. 28 | """ 29 | __slots__ = () 30 | 31 | @abstractmethod 32 | def bit_field_base_address(self, placement: Placement) -> int: 33 | """ 34 | Returns the SDRAM address for the bit-field table data. 35 | 36 | :param placement: 37 | :return: the SDRAM address for the bitfield address 38 | """ 39 | raise NotImplementedError 40 | 41 | @abstractmethod 42 | def regeneratable_sdram_blocks_and_sizes( 43 | self, placement: Placement) -> List[Tuple[int, int]]: 44 | """ 45 | Returns the SDRAM addresses and sizes for the cores' SDRAM that 46 | are available (borrowed) for generating bitfield tables. 47 | 48 | :param placement: 49 | :return: list of tuples containing (the SDRAM address for the cores 50 | SDRAM address's for the core's SDRAM that can be used to generate 51 | bitfield tables loaded, and the size of memory chunks located 52 | there) 53 | """ 54 | raise NotImplementedError 55 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/utility_objs/extra_monitor_scp_messages/load_application_mc_routes_message.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from spinn_utilities.overrides import overrides 16 | from spinnman.messages.scp import SCPRequestHeader 17 | from spinnman.messages.scp.abstract_messages import AbstractSCPRequest 18 | from spinnman.messages.sdp import SDPFlag, SDPHeader 19 | from spinnman.messages.scp.impl.check_ok_response import CheckOKResponse 20 | from spinnman.model.enums import SDP_PORTS 21 | from .speedup_in_scp_commands import SpeedupInSCPCommands 22 | 23 | 24 | class LoadApplicationMCRoutesMessage(AbstractSCPRequest[CheckOKResponse]): 25 | """ 26 | An SCP Request to write the application multicast routes into the router. 27 | """ 28 | 29 | __slots__ = () 30 | 31 | def __init__(self, x: int, y: int, p: int): 32 | """ 33 | :param x: The x-coordinate of a chip 34 | :param y: The y-coordinate of a chip 35 | :param p: The processor running the extra monitor vertex 36 | """ 37 | super().__init__( 38 | SDPHeader( 39 | flags=SDPFlag.REPLY_EXPECTED, 40 | destination_port=( 41 | SDP_PORTS.EXTRA_MONITOR_CORE_DATA_IN_SPEED_UP.value), 42 | destination_cpu=p, destination_chip_x=x, 43 | destination_chip_y=y), 44 | SCPRequestHeader( 45 | command=SpeedupInSCPCommands.LOAD_APPLICATION_MC_ROUTES)) 46 | 47 | @overrides(AbstractSCPRequest.get_scp_response) 48 | def get_scp_response(self) -> CheckOKResponse: 49 | return CheckOKResponse( 50 | "load application multicast routes", 51 | SpeedupInSCPCommands.LOAD_APPLICATION_MC_ROUTES) 52 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/scp/load_mc_routes_process.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from spinn_machine import CoreSubsets 16 | from spinnman.processes import AbstractMultiConnectionProcess 17 | from spinnman.messages.scp.impl import CheckOKResponse 18 | from spinn_front_end_common.utilities.utility_objs.\ 19 | extra_monitor_scp_messages import ( 20 | LoadApplicationMCRoutesMessage, LoadSystemMCRoutesMessage) 21 | 22 | 23 | class LoadMCRoutesProcess(AbstractMultiConnectionProcess[CheckOKResponse]): 24 | """ 25 | How to send messages to load the saved multicast routing tables. 26 | """ 27 | __slots__ = () 28 | 29 | def load_application_mc_routes(self, core_subsets: CoreSubsets) -> None: 30 | """ 31 | Load the saved application multicast routes. 32 | 33 | :param core_subsets: sets of cores to send command to 34 | """ 35 | with self._collect_responses(): 36 | for core_subset in core_subsets.core_subsets: 37 | for processor_id in core_subset.processor_ids: 38 | self._send_request(LoadApplicationMCRoutesMessage( 39 | core_subset.x, core_subset.y, processor_id)) 40 | 41 | def load_system_mc_routes(self, core_subsets: CoreSubsets) -> None: 42 | """ 43 | Load the saved system multicast routes. 44 | 45 | :param core_subsets: sets of cores to send command to 46 | """ 47 | with self._collect_responses(): 48 | for core_subset in core_subsets.core_subsets: 49 | for processor_id in core_subset.processor_ids: 50 | self._send_request(LoadSystemMCRoutesMessage( 51 | core_subset.x, core_subset.y, processor_id)) 52 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/interface_functions/locate_executable_start_type.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Dict, cast 16 | from spinn_machine import CoreSubsets 17 | from spinnman.model.enums import ExecutableType 18 | from pacman.model.placements import Placement 19 | from spinn_front_end_common.abstract_models import AbstractHasAssociatedBinary 20 | from spinn_front_end_common.data import FecDataView 21 | 22 | 23 | def locate_executable_start_type() -> Dict[ExecutableType, CoreSubsets]: 24 | """ 25 | Discovers where applications of particular types need to be launched. 26 | 27 | :returns: Mapping of type to the cores which have that type 28 | """ 29 | binary_start_types: Dict[ExecutableType, CoreSubsets] = dict() 30 | 31 | for placement in FecDataView.iterate_placements_by_vertex_type( 32 | AbstractHasAssociatedBinary): 33 | vertex = cast(AbstractHasAssociatedBinary, placement.vertex) 34 | bin_type = vertex.get_binary_start_type() 35 | # update core subset with location of the vertex on the 36 | # machine 37 | if bin_type not in binary_start_types: 38 | binary_start_types[bin_type] = CoreSubsets() 39 | 40 | __add_vertex_to_subset( 41 | placement, binary_start_types[bin_type]) 42 | 43 | # only got apps with no binary, such as external devices. 44 | # return no app 45 | if not binary_start_types: 46 | return {ExecutableType.NO_APPLICATION: CoreSubsets()} 47 | 48 | return binary_start_types 49 | 50 | 51 | def __add_vertex_to_subset( 52 | placement: Placement, core_subsets: CoreSubsets) -> None: 53 | core_subsets.add_processor( 54 | x=placement.x, y=placement.y, processor_id=placement.p) 55 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/interface_functions/chip_runtime_updater.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from spinn_utilities.progress_bar import ProgressBar 15 | from spinnman.model.enums import CPUState, ExecutableType 16 | from spinn_front_end_common.data import FecDataView 17 | from spinn_front_end_common.utilities.scp import UpdateRuntimeProcess 18 | 19 | 20 | def chip_runtime_updater(n_sync_steps: int) -> None: 21 | """ 22 | Updates the runtime of an application running on a SpiNNaker machine. 23 | 24 | :param n_sync_steps: 25 | """ 26 | core_subsets = FecDataView.get_cores_for_type( 27 | ExecutableType.USES_SIMULATION_INTERFACE) 28 | n_cores = len(core_subsets) 29 | with ProgressBar( 30 | n_cores, "Waiting for cores to be either in " 31 | "PAUSED or READY state") as progress: 32 | FecDataView.get_transceiver().wait_for_cores_to_be_in_state( 33 | core_subsets, FecDataView.get_app_id(), 34 | frozenset([CPUState.PAUSED, CPUState.READY]), 35 | error_states=frozenset({ 36 | CPUState.RUN_TIME_EXCEPTION, CPUState.WATCHDOG, 37 | CPUState.FINISHED}), progress_bar=progress, 38 | timeout=n_cores) 39 | 40 | run_until_timesteps = FecDataView.get_current_run_timesteps() 41 | first_timestep = FecDataView.get_first_machine_time_step() 42 | if run_until_timesteps is None: 43 | infinite_run = True 44 | run_until_timesteps = 0 45 | else: 46 | infinite_run = False 47 | 48 | process = UpdateRuntimeProcess(FecDataView.get_scamp_connection_selector()) 49 | process.update_runtime( 50 | first_timestep, run_until_timesteps, infinite_run, core_subsets, 51 | len(core_subsets), n_sync_steps) 52 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/interface_functions/read_routing_tables_from_machine.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from spinn_utilities.progress_bar import ProgressBar 15 | from spinnman.transceiver import Transceiver 16 | from pacman.model.routing_tables import ( 17 | AbstractMulticastRoutingTable, CompressedMulticastRoutingTable, 18 | MulticastRoutingTables) 19 | from spinn_front_end_common.data import FecDataView 20 | 21 | 22 | def read_routing_tables_from_machine() -> MulticastRoutingTables: 23 | """ 24 | Reads compressed routing tables from a SpiNNaker machine. 25 | 26 | :returns: Routing tables after any compression on the machine 27 | """ 28 | routing_tables = FecDataView.get_uncompressed() 29 | progress = ProgressBar( 30 | routing_tables, "Reading Routing Tables from Machine") 31 | app_id = FecDataView.get_app_id() 32 | transceiver = FecDataView.get_transceiver() 33 | 34 | machine_routing_tables = MulticastRoutingTables() 35 | for table in progress.over(routing_tables): 36 | # get multicast entries from machine 37 | machine_routing_table = _read_routing_table( 38 | transceiver, table, app_id) 39 | machine_routing_tables.add_routing_table(machine_routing_table) 40 | return machine_routing_tables 41 | 42 | 43 | def _read_routing_table( 44 | transceiver: Transceiver, table: AbstractMulticastRoutingTable, 45 | app_id: int) -> CompressedMulticastRoutingTable: 46 | machine_routing_table = CompressedMulticastRoutingTable(table.x, table.y) 47 | for routing_entry in transceiver.get_multicast_routes( 48 | table.x, table.y, app_id): 49 | machine_routing_table.add_multicast_routing_entry(routing_entry) 50 | return machine_routing_table 51 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/provenance/log_store_db.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from datetime import datetime 16 | import sqlite3 17 | from typing import List, Optional 18 | 19 | from spinn_utilities.config_holder import configs_loaded 20 | from spinn_utilities.log_store import LogStore 21 | from spinn_utilities.overrides import overrides 22 | from .global_provenance import GlobalProvenance 23 | 24 | 25 | class LogStoreDB(LogStore): 26 | """ 27 | Log message storage mechanism that uses a database. 28 | """ 29 | __slots__ = () 30 | 31 | @overrides(LogStore.store_log) 32 | def store_log( 33 | self, level: int, message: str, 34 | timestamp: Optional[datetime] = None) -> None: 35 | if configs_loaded(): 36 | try: 37 | with GlobalProvenance() as db: 38 | db.store_log(level, message, timestamp) 39 | except sqlite3.OperationalError as ex: 40 | if "database is locked" in ex.args: 41 | # OK ignore this one 42 | # DO NOT log this error here or you will loop forever! 43 | return 44 | # all others are bad 45 | raise 46 | else: 47 | # Only expected to happen when running parallel tests 48 | print("store logs skipped as configs not loaded.") 49 | 50 | @overrides(LogStore.retreive_log_messages) 51 | def retreive_log_messages( 52 | self, min_level: int = 0) -> List[str]: 53 | with GlobalProvenance() as db: 54 | return db.retreive_log_messages(min_level) 55 | 56 | @overrides(LogStore.get_location) 57 | def get_location(self) -> str: 58 | return GlobalProvenance.get_global_provenace_path() 59 | -------------------------------------------------------------------------------- /c_common/front_end_common_lib/include/buffered_eieio_defs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 The University of Manchester 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | //! \file 18 | //! 19 | //! \brief Definitions for the streaming-over-EIEIO buffering protocol. 20 | //! 21 | //! Note that this protocol is now mostly deprecated in favour of the 22 | //! substantially-faster automatic pause-and-resume protocol. 23 | 24 | #ifndef BUFFERED_EIEIO_DEFS_H 25 | #define BUFFERED_EIEIO_DEFS_H 26 | 27 | //! The different command message IDs 28 | typedef enum eieio_command_messages { 29 | //! Fill in buffer area with padding 30 | EVENT_PADDING = 2, 31 | //! End of all buffers, stop execution 32 | EVENT_STOP_COMMANDS, 33 | //! Stop complaining that there is SDRAM free space for buffers 34 | STOP_SENDING_REQUESTS, 35 | //! Start complaining that there is SDRAM free space for buffers 36 | START_SENDING_REQUESTS, 37 | //! SpiNNaker requesting new buffers for spike source population 38 | SPINNAKER_REQUEST_BUFFERS, 39 | //! Buffers being sent from host to SpiNNaker 40 | HOST_SEND_SEQUENCED_DATA, 41 | //! Buffers available to be read from a buffered out vertex 42 | SPINNAKER_REQUEST_READ_DATA, 43 | //! Host confirming data being read form SpiNNaker memory 44 | HOST_DATA_READ, 45 | //! Host confirming message received to read data 46 | HOST_DATA_READ_ACK = 12, 47 | } eieio_command_messages; 48 | 49 | //! The different buffer operations 50 | typedef enum buffered_operations { 51 | //! The last operation was a read 52 | BUFFER_OPERATION_READ, 53 | //! The last operation was a write 54 | BUFFER_OPERATION_WRITE 55 | } buffered_operations; 56 | 57 | //! pointer to an EIEIO message 58 | typedef uint16_t* eieio_msg_t; 59 | 60 | //! The maximum sequence number 61 | #define MAX_SEQUENCE_NO 0xFF 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /unittests/test_version.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import unittest 16 | import spinn_utilities 17 | import spinn_machine 18 | import pacman 19 | import spinnman 20 | import spinn_front_end_common 21 | from spinn_front_end_common.interface.config_setup import unittest_setup 22 | 23 | 24 | class Test(unittest.TestCase): 25 | """ Tests for the SCAMP version comparison 26 | """ 27 | 28 | def setUp(self) -> None: 29 | unittest_setup() 30 | 31 | def test_compare_versions(self) -> None: 32 | spinn_utilities_parts = spinn_utilities.__version__.split('.') 33 | spinn_machine_parts = spinn_machine.__version__.split('.') 34 | pacman_parts = pacman.__version__.split('.') 35 | spinnman_parts = spinnman.__version__.split('.') 36 | spinn_front_end_common_parts = spinn_front_end_common.\ 37 | __version__.split('.') 38 | 39 | self.assertEqual(spinn_utilities_parts[0], 40 | spinn_front_end_common_parts[0]) 41 | self.assertLessEqual(spinn_utilities_parts[1], 42 | spinn_front_end_common_parts[1]) 43 | 44 | self.assertEqual(spinn_machine_parts[0], 45 | spinn_front_end_common_parts[0]) 46 | self.assertLessEqual(spinn_machine_parts[1], 47 | spinn_front_end_common_parts[1]) 48 | 49 | self.assertEqual(pacman_parts[0], 50 | spinn_front_end_common_parts[0]) 51 | self.assertLessEqual(pacman_parts[1], 52 | spinn_front_end_common_parts[1]) 53 | 54 | self.assertEqual(spinnman_parts[0], 55 | spinn_front_end_common_parts[0]) 56 | self.assertLessEqual(spinnman_parts[1], 57 | spinn_front_end_common_parts[1]) 58 | -------------------------------------------------------------------------------- /spinn_front_end_common/utilities/report_functions/write_json_machine.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import json 16 | import os 17 | 18 | from spinn_utilities.config_holder import ( 19 | get_config_bool, get_report_path) 20 | from spinn_utilities.progress_bar import ProgressBar, DummyProgressBar 21 | from spinn_machine.json_machine import to_json 22 | from pacman.utilities import file_format_schemas 23 | 24 | #: The name of the schema that we validate against. 25 | MACHINE_SCHEMA = "machine.json" 26 | 27 | 28 | def write_json_machine(progress_bar: bool = True) -> str: 29 | """ 30 | Runs the code to write the machine in Java readable JSON. 31 | 32 | .. warning:: 33 | The file in this folder will be overwritten! 34 | 35 | :param progress_bar: Flag if Progress Bar should be shown 36 | :return: the name of the generated file 37 | """ 38 | file_path = get_report_path("path_json_machine") 39 | if not os.path.exists(file_path): 40 | with _progress(progress_bar) as progress: 41 | # Step 1: generate 42 | json_obj = to_json() 43 | progress.update() 44 | # Step 2: validate against the schema 45 | if get_config_bool("Mapping", "validate_json"): 46 | file_format_schemas.validate(json_obj, MACHINE_SCHEMA) 47 | progress.update() 48 | # Step 3: dump to json file 49 | with open(file_path, "w", encoding="utf-8") as f: 50 | json.dump(json_obj, f) 51 | return file_path 52 | 53 | 54 | def _progress(progress_bar: bool) -> ProgressBar: 55 | # Steps are create json object, validate json and write json to a file 56 | if progress_bar: 57 | return ProgressBar(3, "Converting to JSON machine") 58 | else: 59 | return DummyProgressBar(3, "Converting to JSON machine") 60 | -------------------------------------------------------------------------------- /pylint.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) 2024 The University of Manchester 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # This bash assumes that SupportScripts has been installed in parallel 18 | 19 | # requires the latest pylint and pyenchant 20 | # pip install --upgrade pylint pyenchant 21 | 22 | # requires the spelling dicts 23 | # sudo apt-get -o Dpkg::Use-Pty=0 install --fix-missing enchant-2 hunspell hunspell-en-gb 24 | 25 | # check all 26 | pylint --output-format=colorized --disable=R --persistent=no --jobs=1 --rcfile=../SupportScripts/actions/pylint/strict_rcfile --spelling-dict=en_GB --spelling-private-dict-file="../SupportScripts/actions/pylint/default_dict.txt" --disable=import-error spinn_front_end_common 27 | 28 | # 29 | # check one test 30 | # pylint --enable=consider-iterating-dictionary --output-format=colorized --disable=R --persistent=no --jobs=1 --rcfile=../SupportScripts/actions/pylint/strict_rcfile --spelling-dict=en_GB --spelling-private-dict-file="../SupportScripts/actions/pylint/default_dict.txt" --disable=all spinn_front_end_common 31 | 32 | # check spelling 33 | # pylint --enable=invalid-characters-in-docstring,wrong-spelling-in-comment,wrong-spelling-in-docstring --output-format=colorized --disable=R --persistent=no --jobs=1 --rcfile=../SupportScripts/actions/pylint/strict_rcfile --spelling-dict=en_GB --spelling-private-dict-file="../SupportScripts/actions/pylint/default_dict.txt" --disable=all spinn_front_end_common 34 | 35 | # check docs including spelling 36 | # pylint --enable=missing-function-docstring,missing-class-docstring,invalid-characters-in-docstring,wrong-spelling-in-comment,wrong-spelling-in-docstring --output-format=colorized --disable=R --persistent=no --jobs=1 --rcfile=../SupportScripts/actions/pylint/strict_rcfile --spelling-dict=en_GB --spelling-private-dict-file="../SupportScripts/actions/pylint/default_dict.txt" --disable=all spinn_front_end_common 37 | 38 | -------------------------------------------------------------------------------- /spinn_front_end_common/abstract_models/abstract_rewrites_data_specification.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from __future__ import annotations 15 | from typing import TYPE_CHECKING 16 | from spinn_utilities.abstract_base import AbstractBase, abstractmethod 17 | from spinn_utilities.require_subclass import require_subclass 18 | from pacman.model.placements import Placement 19 | from .abstract_generates_data_specification import ( 20 | AbstractGeneratesDataSpecification) 21 | if TYPE_CHECKING: 22 | from spinn_front_end_common.interface.ds import DataSpecificationReloader 23 | 24 | 25 | @require_subclass(AbstractGeneratesDataSpecification) 26 | class AbstractRewritesDataSpecification(object, metaclass=AbstractBase): 27 | """ 28 | Indicates an object that allows data to be changed after run, 29 | and so can rewrite the data specification. 30 | """ 31 | 32 | __slots__ = () 33 | 34 | @abstractmethod 35 | def regenerate_data_specification(self, spec: DataSpecificationReloader, 36 | placement: Placement) -> None: 37 | """ 38 | Regenerate the data specification, only generating regions that 39 | have changed and need to be reloaded. 40 | 41 | :param spec: Where to write the regenerated spec 42 | :param placement: Where are we regenerating for? 43 | """ 44 | raise NotImplementedError 45 | 46 | @abstractmethod 47 | def reload_required(self) -> bool: 48 | """ 49 | :returns: True if any data region needs to be reloaded. 50 | """ 51 | raise NotImplementedError 52 | 53 | @abstractmethod 54 | def set_reload_required(self, new_value: bool) -> None: 55 | """ 56 | Indicate that the regions have been reloaded. 57 | 58 | :param new_value: the new value 59 | """ 60 | raise NotImplementedError 61 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/splitter_selectors/splitter_selector.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | import logging 15 | 16 | from spinn_utilities.log import FormatAdapter 17 | from pacman.data import PacmanDataView 18 | from pacman.model.partitioner_splitters import ( 19 | SplitterOneAppOneMachine, SplitterFixedLegacy) 20 | from pacman.model.graphs.application.abstract import ( 21 | AbstractOneAppOneMachineVertex) 22 | from pacman.model.graphs.application import ApplicationVertex 23 | from spinn_front_end_common.utility_models import ReverseIpTagMultiCastSource 24 | 25 | logger = FormatAdapter(logging.getLogger(__name__)) 26 | 27 | 28 | def splitter_selector() -> None: 29 | """ 30 | Basic selector which puts the legacy splitter object on 31 | everything without a splitter object. 32 | """ 33 | for app_vertex in PacmanDataView.iterate_vertices(): 34 | if not app_vertex.has_splitter: 35 | vertex_selector(app_vertex) 36 | 37 | 38 | def vertex_selector(app_vertex: ApplicationVertex) -> None: 39 | """ 40 | Main point for selecting a splitter object for a given app vertex. 41 | 42 | Will assume the SplitterFixedLegacy if no heuristic is known for the 43 | app vertex. 44 | 45 | :param app_vertex: app vertex to give a splitter object to 46 | """ 47 | if isinstance(app_vertex, AbstractOneAppOneMachineVertex): 48 | app_vertex.splitter = SplitterOneAppOneMachine() 49 | elif isinstance(app_vertex, ReverseIpTagMultiCastSource): 50 | app_vertex.splitter = SplitterFixedLegacy() 51 | else: 52 | logger.warning( 53 | f"The SplitterSelector has not seen the {app_vertex} vertex " 54 | f"before. Therefore there is no known splitter to allocate to " 55 | f"this app vertex and so will use the SplitterFixedLegacy.") 56 | app_vertex.splitter = SplitterFixedLegacy() 57 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/interface_functions/placements_provenance_gatherer.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import logging 16 | import traceback 17 | from typing import Iterable, List 18 | from spinn_utilities.log import FormatAdapter 19 | from spinn_utilities.progress_bar import ProgressBar 20 | from pacman.model.placements import Placement 21 | from spinn_front_end_common.interface.provenance import ( 22 | AbstractProvidesProvenanceDataFromMachine) 23 | 24 | logger = FormatAdapter(logging.getLogger(__name__)) 25 | 26 | 27 | def placements_provenance_gatherer( 28 | n_placements: int, placements: Iterable[Placement]) -> None: 29 | """ 30 | Gets provenance information from the specified placements. 31 | 32 | :param n_placements: Number of placements to gather 33 | :param placements: 34 | The placements of the vertices to gather data form. 35 | May not be all placements so don't use View 36 | """ 37 | errors: List[str] = list() 38 | 39 | progress = ProgressBar(n_placements, "Getting provenance data") 40 | 41 | # retrieve provenance data from any cores that provide data 42 | for placement in progress.over(placements): 43 | _add_placement_provenance(placement, errors) 44 | if errors: 45 | logger.warning("Errors found during provenance gathering:") 46 | for error in errors: 47 | logger.warning("{}", error) 48 | 49 | 50 | def _add_placement_provenance(placement: Placement, errors: List[str]) -> None: 51 | # retrieve provenance data from any cores that provide data 52 | if isinstance( 53 | placement.vertex, AbstractProvidesProvenanceDataFromMachine): 54 | # get data 55 | try: 56 | placement.vertex.get_provenance_data_from_machine(placement) 57 | except Exception: # pylint: disable=broad-except 58 | errors.append(traceback.format_exc()) 59 | -------------------------------------------------------------------------------- /spinn_front_end_common/interface/simulation/simulation_utilities.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 The University of Manchester 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | from typing import List 17 | from pacman.utilities.utility_calls import md5 18 | from spinnman.model.enums import SDP_PORTS 19 | from spinn_front_end_common.data import FecDataView 20 | 21 | 22 | def get_simulation_header_array(binary_file_name: str) -> List[int]: 23 | """ 24 | Get data to be written to the simulation header. 25 | 26 | :param binary_file_name: The name of the binary of the application 27 | :return: An array of values to be written as the simulation header 28 | """ 29 | # Get first 32-bits of the md5 hash of the application name 30 | application_name_hash = md5(os.path.splitext(binary_file_name)[0])[:8] 31 | 32 | # Write this to the system region (to be picked up by the simulation): 33 | return [ 34 | int(application_name_hash, 16), 35 | FecDataView.get_hardware_time_step_us(), 36 | # SDP port number for receiving synchronisations and new run times 37 | SDP_PORTS.RUNNING_COMMAND_SDP_PORT.value] 38 | 39 | 40 | def get_simulation_header_array_no_timestep( 41 | binary_file_name: str) -> List[int]: 42 | """ 43 | Get data to be written to the simulation header. 44 | Use for binaries that do not want to know the system timestep. 45 | 46 | :param binary_file_name: The name of the binary of the application 47 | :return: An array of values to be written as the simulation header 48 | """ 49 | # Get first 32-bits of the md5 hash of the application name 50 | application_name_hash = md5(os.path.splitext(binary_file_name)[0])[:8] 51 | 52 | # Write this to the system region (to be picked up by the simulation): 53 | return [ 54 | int(application_name_hash, 16), 55 | 0, 56 | # SDP port number for receiving synchronisations and new run times 57 | SDP_PORTS.RUNNING_COMMAND_SDP_PORT.value] 58 | --------------------------------------------------------------------------------