From 201299fed4e8ff633ac8b04ab033b9a867ae3fc0 Mon Sep 17 00:00:00 2001 From: Andrew Rowley Date: Tue, 25 Nov 2025 10:10:41 +0000 Subject: [PATCH 1/3] Update to match other repos --- .github/workflows/c_actions.yml | 14 ++++++--- c_models/makefiles/extra.mk | 45 ++++++++++++----------------- c_models/makefiles/extra_neuron.mk | 45 ++++++++++++----------------- c_models/makefiles/extra_synapse.mk | 45 ++++++++++++----------------- 4 files changed, 67 insertions(+), 82 deletions(-) diff --git a/.github/workflows/c_actions.yml b/.github/workflows/c_actions.yml index 061b985..2ffdb16 100644 --- a/.github/workflows/c_actions.yml +++ b/.github/workflows/c_actions.yml @@ -41,8 +41,12 @@ jobs: - name: Set environment variables run: | - echo "SPINN_DIRS=$PWD/spinnaker_tools" >> $GITHUB_ENV - echo "NEURAL_MODELLING_DIRS=$PWD/sPyNNaker/neural_modelling" >> $GITHUB_ENV + echo "SPINN_INSTALL_DIR=$PWD/spinnaker_tools_install" >> $GITHUB_ENV + echo "SPINN_COMMON_INSTALL_DIR=$PWD/spinn_common_install" >> $GITHUB_ENV + echo "FEC_INSTALL_DIR=$PWD/fec_install" >> $GITHUB_ENV + echo "SPYNNAKER_INSTALL_DIR=$PWD/spynnaker_install" >> $GITHUB_ENV + echo "C_LOGS_DICT=$PWD/spynnaker/pyNN/model_binaries/logs.sqlite3" >> $GITHUB_ENV + - name: Checkout SpiNNaker C Dependencies uses: SpiNNakerManchester/SupportScripts/actions/install-spinn-deps@main @@ -66,9 +70,11 @@ jobs: - name: Build SpiNNaker C dependencies run: | - make -C $SPINN_DIRS + make -C spinnaker_tools install make -C spinn_common install - make -C SpiNNFrontEndCommon/c_common install + make -C SpiNNFrontEndCommon/c_common + make -C sPyNNaker/neural_modelling + make -C sPyNNaker/neural_modelling install - name: Build C code run: make diff --git a/c_models/makefiles/extra.mk b/c_models/makefiles/extra.mk index f626ec9..57bda89 100644 --- a/c_models/makefiles/extra.mk +++ b/c_models/makefiles/extra.mk @@ -1,33 +1,26 @@ -ifndef NEURAL_MODELLING_DIRS - $(error NEURAL_MODELLING_DIRS is not set. Please define NEURAL_MODELLING_DIRS (possibly by running "source setup" in the neural_modelling folder within the sPyNNaker source folder)) +ifndef SPYNNAKER_INSTALL_DIR + $(error SPYNNAKER_INSTALL_DIR is not set. Please define SPYNNAKER_INSTALL_DIR (possibly by running "source setup" in the neural_modelling folder within the sPyNNaker source folder)) endif -# ---------------------------------------------------------------------- -# Compute the absolute path to the directory containing this file. -# -EXTRA_MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +# Work out the top-level project folder +MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +EXTRA_MODELS_DIR := $(abspath $(dir $(MAKEFILE_PATH))/../../)/ -# ---------------------------------------------------------------------- -# Make sure that APP_OUTPUT_DIR points to where you want the .aplx files to go. -# -APP_OUTPUT_DIR := $(abspath $(dir $(EXTRA_MAKEFILE_PATH))../../python_models8/model_binaries/) +# This is where the building will happen +BUILD_DIR := $(EXTRA_MODELS_DIR)c_models/build/$(APP)/ -# ---------------------------------------------------------------------- -# Make sure EXTRA_SRC_DIR points to the source directory where your unmodified -# files are found. -# -EXTRA_SRC_DIR := $(abspath $(dir $(EXTRA_MAKEFILE_PATH))/../src/) +# This is where the output .aplx files will go +APP_OUTPUT_DIR := $(EXTRA_MODELS_DIR)python_models8/model_binaries/ -# ---------------------------------------------------------------------- -# Add EXTRA_SRC_DIR to the SOURCE_DIRS to ensure that it gets used correctly -SOURCE_DIRS += $(EXTRA_SRC_DIR) -CFLAGS += -I$(EXTRA_SRC_DIR) +# This is where the extra source files are located +EXTRA_SRC_DIR := $(EXTRA_MODELS_DIR)c_models/src -# ---------------------------------------------------------------------- -# Make sure each neuron model has a unique build directory. -# -BUILD_DIR := $(abspath $(dir $(EXTRA_MAKEFILE_PATH))/../build/$(APP))/ +# This location will be used to hold source files after log conversion +# which saves instruction space on the SpiNNaker machine +EXTRA_MODIFIED_DIR := $(EXTRA_MODELS_DIR)c_models/modified_src/ -# ---------------------------------------------------------------------- -# Import the main Makefile -include $(NEURAL_MODELLING_DIRS)/makefiles/neuron/neural_build.mk +# This simply maps the source directory to the modified source directory +SOURCE_DIRS += $(EXTRA_SRC_DIR):$(EXTRA_MODIFIED_DIR) + +# Import the main neural build Makefile +include $(SPYNNAKER_INSTALL_DIR)/make/neural_build.mk diff --git a/c_models/makefiles/extra_neuron.mk b/c_models/makefiles/extra_neuron.mk index 54f4ad9..e1ff251 100644 --- a/c_models/makefiles/extra_neuron.mk +++ b/c_models/makefiles/extra_neuron.mk @@ -1,33 +1,26 @@ -ifndef NEURAL_MODELLING_DIRS - $(error NEURAL_MODELLING_DIRS is not set. Please define NEURAL_MODELLING_DIRS (possibly by running "source setup" in the neural_modelling folder within the sPyNNaker source folder)) +ifndef SPYNNAKER_INSTALL_DIR + $(error SPYNNAKER_INSTALL_DIR is not set. Please define SPYNNAKER_INSTALL_DIR (possibly by running "source setup" in the neural_modelling folder within the sPyNNaker source folder)) endif -# ---------------------------------------------------------------------- -# Compute the absolute path to the directory containing this file. -# -EXTRA_MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +# Work out the top-level project folder +MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +EXTRA_MODELS_DIR := $(abspath $(dir $(MAKEFILE_PATH))/../../)/ -# ---------------------------------------------------------------------- -# Make sure that APP_OUTPUT_DIR points to where you want the .aplx files to go. -# -APP_OUTPUT_DIR := $(abspath $(dir $(EXTRA_MAKEFILE_PATH))../../python_models8/model_binaries/) +# This is where the building will happen +BUILD_DIR := $(EXTRA_MODELS_DIR)c_models/build/$(APP)/ -# ---------------------------------------------------------------------- -# Make sure EXTRA_SRC_DIR points to the source directory where your unmodified -# files are found. -# -EXTRA_SRC_DIR := $(abspath $(dir $(EXTRA_MAKEFILE_PATH))/../src/) +# This is where the output .aplx files will go +APP_OUTPUT_DIR := $(EXTRA_MODELS_DIR)python_models8/model_binaries/ -# ---------------------------------------------------------------------- -# Add EXTRA_SRC_DIR to the SOURCE_DIRS to ensure that it gets used correctly -SOURCE_DIRS += $(EXTRA_SRC_DIR) -CFLAGS += -I$(EXTRA_SRC_DIR) +# This is where the extra source files are located +EXTRA_SRC_DIR := $(EXTRA_MODELS_DIR)c_models/src -# ---------------------------------------------------------------------- -# Make sure each neuron model has a unique build directory. -# -BUILD_DIR := $(abspath $(dir $(EXTRA_MAKEFILE_PATH))/../build/$(APP))/ +# This location will be used to hold source files after log conversion +# which saves instruction space on the SpiNNaker machine +EXTRA_MODIFIED_DIR := $(EXTRA_MODELS_DIR)c_models/modified_src/ -# ---------------------------------------------------------------------- -# Import the main Makefile -include $(NEURAL_MODELLING_DIRS)/makefiles/neuron_only/neuron_build.mk +# This simply maps the source directory to the modified source directory +SOURCE_DIRS += $(EXTRA_SRC_DIR):$(EXTRA_MODIFIED_DIR) + +# Import the main neural build Makefile +include $(SPYNNAKER_INSTALL_DIR)/make/neuron_only_build.mk diff --git a/c_models/makefiles/extra_synapse.mk b/c_models/makefiles/extra_synapse.mk index 2991e25..2c010a3 100644 --- a/c_models/makefiles/extra_synapse.mk +++ b/c_models/makefiles/extra_synapse.mk @@ -1,33 +1,26 @@ -ifndef NEURAL_MODELLING_DIRS - $(error NEURAL_MODELLING_DIRS is not set. Please define NEURAL_MODELLING_DIRS (possibly by running "source setup" in the neural_modelling folder within the sPyNNaker source folder)) +ifndef SPYNNAKER_INSTALL_DIR + $(error SPYNNAKER_INSTALL_DIR is not set. Please define SPYNNAKER_INSTALL_DIR (possibly by running "source setup" in the neural_modelling folder within the sPyNNaker source folder)) endif -# ---------------------------------------------------------------------- -# Compute the absolute path to the directory containing this file. -# -EXTRA_MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +# Work out the top-level project folder +MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +EXTRA_MODELS_DIR := $(abspath $(dir $(MAKEFILE_PATH))/../../)/ -# ---------------------------------------------------------------------- -# Make sure that APP_OUTPUT_DIR points to where you want the .aplx files to go. -# -APP_OUTPUT_DIR := $(abspath $(dir $(EXTRA_MAKEFILE_PATH))../../python_models8/model_binaries/) +# This is where the building will happen +BUILD_DIR := $(EXTRA_MODELS_DIR)c_models/build/$(APP)/ -# ---------------------------------------------------------------------- -# Make sure EXTRA_SRC_DIR points to the source directory where your unmodified -# files are found. -# -EXTRA_SRC_DIR := $(abspath $(dir $(EXTRA_MAKEFILE_PATH))/../src/) +# This is where the output .aplx files will go +APP_OUTPUT_DIR := $(EXTRA_MODELS_DIR)python_models8/model_binaries/ -# ---------------------------------------------------------------------- -# Add EXTRA_SRC_DIR to the SOURCE_DIRS to ensure that it gets used correctly -SOURCE_DIRS += $(EXTRA_SRC_DIR) -CFLAGS += -I$(EXTRA_SRC_DIR) +# This is where the extra source files are located +EXTRA_SRC_DIR := $(EXTRA_MODELS_DIR)c_models/src -# ---------------------------------------------------------------------- -# Make sure each neuron model has a unique build directory. -# -BUILD_DIR := $(abspath $(dir $(EXTRA_MAKEFILE_PATH))/../build/$(APP))/ +# This location will be used to hold source files after log conversion +# which saves instruction space on the SpiNNaker machine +EXTRA_MODIFIED_DIR := $(EXTRA_MODELS_DIR)c_models/modified_src/ -# ---------------------------------------------------------------------- -# Import the main Makefile -include $(NEURAL_MODELLING_DIRS)/makefiles/synapse_only/synapse_build.mk +# This simply maps the source directory to the modified source directory +SOURCE_DIRS += $(EXTRA_SRC_DIR):$(EXTRA_MODIFIED_DIR) + +# Import the main neural build Makefile +include $(SPYNNAKER_INSTALL_DIR)/make/synapse_build.mk From d139d5f3ad7d60a5f445a5a6c825eb4847fd3e65 Mon Sep 17 00:00:00 2001 From: Andrew Rowley Date: Thu, 27 Nov 2025 16:50:15 +0000 Subject: [PATCH 2/3] Try global install here too --- .github/workflows/c_actions.yml | 32 +++++++++++++++++------------ c_models/makefiles/Makefile.common | 4 ---- c_models/makefiles/extra.mk | 4 +--- c_models/makefiles/extra_neuron.mk | 4 +--- c_models/makefiles/extra_synapse.mk | 4 +--- 5 files changed, 22 insertions(+), 26 deletions(-) delete mode 100644 c_models/makefiles/Makefile.common diff --git a/.github/workflows/c_actions.yml b/.github/workflows/c_actions.yml index 2ffdb16..5936dde 100644 --- a/.github/workflows/c_actions.yml +++ b/.github/workflows/c_actions.yml @@ -39,15 +39,6 @@ jobs: with: python-version: 3.12 - - name: Set environment variables - run: | - echo "SPINN_INSTALL_DIR=$PWD/spinnaker_tools_install" >> $GITHUB_ENV - echo "SPINN_COMMON_INSTALL_DIR=$PWD/spinn_common_install" >> $GITHUB_ENV - echo "FEC_INSTALL_DIR=$PWD/fec_install" >> $GITHUB_ENV - echo "SPYNNAKER_INSTALL_DIR=$PWD/spynnaker_install" >> $GITHUB_ENV - echo "C_LOGS_DICT=$PWD/spynnaker/pyNN/model_binaries/logs.sqlite3" >> $GITHUB_ENV - - - name: Checkout SpiNNaker C Dependencies uses: SpiNNakerManchester/SupportScripts/actions/install-spinn-deps@main with: @@ -68,7 +59,14 @@ jobs: with: base-dir: c_models/src - - name: Build SpiNNaker C dependencies + - name: Build SpiNNaker C code + env: + SPINN_INSTALL_DIR: ${{ github.workspace }}/spinnaker_tools_install + SPINN_COMMON_INSTALL_DIR: ${{ github.workspace }}/spinn_common_install + FEC_INSTALL_DIR: ${{ github.workspace }}/fec_install + SPYNNAKER_INSTALL_DIR: ${{ github.workspace }}/spynnaker_install + C_LOGS_DICT: ${{ github.workspace }}/spynnaker/pyNN/model_binaries/logs.sqlite3 + CFLAGS: -fdiagnostics-color=always run: | make -C spinnaker_tools install make -C spinn_common install @@ -76,16 +74,24 @@ jobs: make -C sPyNNaker/neural_modelling make -C sPyNNaker/neural_modelling install - - name: Build C code - run: make - working-directory: c_models + - name: Build SpiNNaker C code globally env: + SPINN_DIRS: ${{ github.workspace }}/spinn_dirs + C_LOGS_DICT: ${{ github.workspace }}/spynnaker/pyNN/model_binaries/logs.sqlite3 CFLAGS: -fdiagnostics-color=always + run: | + make -C spinnaker_tools install + make -C spinn_common install + make -C SpiNNFrontEndCommon/c_common + make -C sPyNNaker/neural_modelling + make -C sPyNNaker/neural_modelling install - name: Build C code in DEBUG mode run: make clean; make SPYNNAKER_DEBUG=DEBUG working-directory: c_models env: + SPINN_DIRS: ${{ github.workspace }}/spinn_dirs + C_LOGS_DICT: ${{ github.workspace }}/spynnaker/pyNN/model_binaries/logs.sqlite3 CFLAGS: -fdiagnostics-color=always # To be added: Documentation building diff --git a/c_models/makefiles/Makefile.common b/c_models/makefiles/Makefile.common deleted file mode 100644 index d1243c2..0000000 --- a/c_models/makefiles/Makefile.common +++ /dev/null @@ -1,4 +0,0 @@ -# THIS FILE WAS USED IN AN OLDER MAKE STYLE -# Make now has to convert c files before building -# SEE https://spinnakermanchester.github.io/latest/Makefiles.html -$(error inclusion of sPyNNakerNewModelTemplate/c_models/makefiles/Makefile.common) diff --git a/c_models/makefiles/extra.mk b/c_models/makefiles/extra.mk index 57bda89..78e57f8 100644 --- a/c_models/makefiles/extra.mk +++ b/c_models/makefiles/extra.mk @@ -1,6 +1,4 @@ -ifndef SPYNNAKER_INSTALL_DIR - $(error SPYNNAKER_INSTALL_DIR is not set. Please define SPYNNAKER_INSTALL_DIR (possibly by running "source setup" in the neural_modelling folder within the sPyNNaker source folder)) -endif +SPYNNAKER_INSTALL_DIR := $(strip $(if $(SPYNNAKER_INSTALL_DIR), $(SPYNNAKER_INSTALL_DIR), $(if $(SPINN_DIRS), $(SPINN_DIRS)/spynnaker_install, $(error SPYNNAKER_INSTALL_DIR or SPINN_DIRS is not set. Please define SPYNNAKER_INSTALL_DIR or SPINN_DIRS)))) # Work out the top-level project folder MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) diff --git a/c_models/makefiles/extra_neuron.mk b/c_models/makefiles/extra_neuron.mk index e1ff251..f5de65c 100644 --- a/c_models/makefiles/extra_neuron.mk +++ b/c_models/makefiles/extra_neuron.mk @@ -1,6 +1,4 @@ -ifndef SPYNNAKER_INSTALL_DIR - $(error SPYNNAKER_INSTALL_DIR is not set. Please define SPYNNAKER_INSTALL_DIR (possibly by running "source setup" in the neural_modelling folder within the sPyNNaker source folder)) -endif +SPYNNAKER_INSTALL_DIR := $(strip $(if $(SPYNNAKER_INSTALL_DIR), $(SPYNNAKER_INSTALL_DIR), $(if $(SPINN_DIRS), $(SPINN_DIRS)/spynnaker_install, $(error SPYNNAKER_INSTALL_DIR or SPINN_DIRS is not set. Please define SPYNNAKER_INSTALL_DIR or SPINN_DIRS)))) # Work out the top-level project folder MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) diff --git a/c_models/makefiles/extra_synapse.mk b/c_models/makefiles/extra_synapse.mk index 2c010a3..c6e5773 100644 --- a/c_models/makefiles/extra_synapse.mk +++ b/c_models/makefiles/extra_synapse.mk @@ -1,6 +1,4 @@ -ifndef SPYNNAKER_INSTALL_DIR - $(error SPYNNAKER_INSTALL_DIR is not set. Please define SPYNNAKER_INSTALL_DIR (possibly by running "source setup" in the neural_modelling folder within the sPyNNaker source folder)) -endif +SPYNNAKER_INSTALL_DIR := $(strip $(if $(SPYNNAKER_INSTALL_DIR), $(SPYNNAKER_INSTALL_DIR), $(if $(SPINN_DIRS), $(SPINN_DIRS)/spynnaker_install, $(error SPYNNAKER_INSTALL_DIR or SPINN_DIRS is not set. Please define SPYNNAKER_INSTALL_DIR or SPINN_DIRS)))) # Work out the top-level project folder MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) From b564c8c071937217d2f3dde6390ffde23ced66d8 Mon Sep 17 00:00:00 2001 From: Andrew Rowley Date: Fri, 28 Nov 2025 07:50:58 +0000 Subject: [PATCH 3/3] Update the C_LOGS_DICT path for c_models build --- .github/workflows/c_actions.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/c_actions.yml b/.github/workflows/c_actions.yml index 5936dde..4cc3d5f 100644 --- a/.github/workflows/c_actions.yml +++ b/.github/workflows/c_actions.yml @@ -65,7 +65,7 @@ jobs: SPINN_COMMON_INSTALL_DIR: ${{ github.workspace }}/spinn_common_install FEC_INSTALL_DIR: ${{ github.workspace }}/fec_install SPYNNAKER_INSTALL_DIR: ${{ github.workspace }}/spynnaker_install - C_LOGS_DICT: ${{ github.workspace }}/spynnaker/pyNN/model_binaries/logs.sqlite3 + C_LOGS_DICT: ${{ github.workspace }}/python_models8/model_binaries/logs.sqlite3 CFLAGS: -fdiagnostics-color=always run: | make -C spinnaker_tools install @@ -73,11 +73,12 @@ jobs: make -C SpiNNFrontEndCommon/c_common make -C sPyNNaker/neural_modelling make -C sPyNNaker/neural_modelling install + make -C c_models - name: Build SpiNNaker C code globally env: SPINN_DIRS: ${{ github.workspace }}/spinn_dirs - C_LOGS_DICT: ${{ github.workspace }}/spynnaker/pyNN/model_binaries/logs.sqlite3 + C_LOGS_DICT: ${{ github.workspace }}/python_models8/model_binaries/logs.sqlite3 CFLAGS: -fdiagnostics-color=always run: | make -C spinnaker_tools install @@ -85,13 +86,14 @@ jobs: make -C SpiNNFrontEndCommon/c_common make -C sPyNNaker/neural_modelling make -C sPyNNaker/neural_modelling install + make -C c_models - name: Build C code in DEBUG mode run: make clean; make SPYNNAKER_DEBUG=DEBUG working-directory: c_models env: SPINN_DIRS: ${{ github.workspace }}/spinn_dirs - C_LOGS_DICT: ${{ github.workspace }}/spynnaker/pyNN/model_binaries/logs.sqlite3 + C_LOGS_DICT: ${{ github.workspace }}/python_models8/model_binaries/logs.sqlite3 CFLAGS: -fdiagnostics-color=always # To be added: Documentation building