diff --git a/.github/workflows/c_actions.yml b/.github/workflows/c_actions.yml index 061b985..4cc3d5f 100644 --- a/.github/workflows/c_actions.yml +++ b/.github/workflows/c_actions.yml @@ -39,11 +39,6 @@ jobs: with: python-version: 3.12 - - name: Set environment variables - run: | - echo "SPINN_DIRS=$PWD/spinnaker_tools" >> $GITHUB_ENV - echo "NEURAL_MODELLING_DIRS=$PWD/sPyNNaker/neural_modelling" >> $GITHUB_ENV - - name: Checkout SpiNNaker C Dependencies uses: SpiNNakerManchester/SupportScripts/actions/install-spinn-deps@main with: @@ -64,22 +59,41 @@ 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 }}/python_models8/model_binaries/logs.sqlite3 + CFLAGS: -fdiagnostics-color=always 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 + make -C c_models - - 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 }}/python_models8/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 + 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 }}/python_models8/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 f626ec9..78e57f8 100644 --- a/c_models/makefiles/extra.mk +++ b/c_models/makefiles/extra.mk @@ -1,33 +1,24 @@ -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)) -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)))) -# ---------------------------------------------------------------------- -# 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..f5de65c 100644 --- a/c_models/makefiles/extra_neuron.mk +++ b/c_models/makefiles/extra_neuron.mk @@ -1,33 +1,24 @@ -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)) -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)))) -# ---------------------------------------------------------------------- -# 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..c6e5773 100644 --- a/c_models/makefiles/extra_synapse.mk +++ b/c_models/makefiles/extra_synapse.mk @@ -1,33 +1,24 @@ -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)) -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)))) -# ---------------------------------------------------------------------- -# 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