Skip to content

Commit 142fd2a

Browse files
authored
Merge branch 'master' into compress_in_loading
2 parents 8797da6 + a18e827 commit 142fd2a

File tree

22 files changed

+962
-1008
lines changed

22 files changed

+962
-1008
lines changed

.github/workflows/c_actions.yml

Lines changed: 23 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -31,38 +31,33 @@ jobs:
3131
install-check-tools: false
3232
ubuntu-packages: doxygen gcc-arm-none-eabi
3333

34-
- name: Set environment variables
35-
run: |
36-
echo "SPINN_DIRS=$PWD/spinnaker_tools" >> $GITHUB_ENV
37-
echo "NEURAL_MODELLING_DIRS=$PWD/neural_modelling" >> $GITHUB_ENV
38-
echo "C_LOGS_DICT=$PWD/logs.sqlite3" >> $GITHUB_ENV
39-
4034
- name: Lint C code using Vera++
4135
uses: SpiNNakerManchester/SupportScripts/actions/vera@main
4236
with:
4337
base-dir: neural_modelling/src
4438

45-
- name: Build C dependencies
46-
run: |
47-
make -C $SPINN_DIRS
48-
make -C spinn_common install
49-
50-
- name: Build FEC C code
51-
run: make
52-
working-directory: SpiNNFrontEndCommon/c_common
53-
env:
54-
CFLAGS: -fdiagnostics-color=always
55-
56-
- name: Build PYNN C code
57-
run: make
58-
working-directory: neural_modelling
39+
- name: Build C and install code
5940
env:
41+
SPINN_INSTALL_DIR: ${{ github.workspace }}/spinnaker_tools_install
42+
SPINN_COMMON_INSTALL_DIR: ${{ github.workspace }}/spinn_common_install
43+
FEC_INSTALL_DIR: ${{ github.workspace }}/fec_install
44+
SPYNNAKER_INSTALL_DIR: ${{ github.workspace }}/spynnaker_install
6045
CFLAGS: -fdiagnostics-color=always
46+
run: |
47+
make -C spinnaker_tools install
48+
make -C spinn_common install
49+
make -C SpiNNFrontEndCommon/c_common/front_end_common_lib install
50+
make -C SpiNNFrontEndCommon/c_common
51+
make -C neural_modelling
6152
6253
- name: Build C code in DEBUG mode
6354
run: make clean; make SPYNNAKER_DEBUG=DEBUG
6455
working-directory: neural_modelling
6556
env:
57+
SPINN_INSTALL_DIR: ${{ github.workspace }}/spinnaker_tools_install
58+
SPINN_COMMON_INSTALL_DIR: ${{ github.workspace }}/spinn_common_install
59+
FEC_INSTALL_DIR: ${{ github.workspace }}/fec_install
60+
SPYNNAKER_INSTALL_DIR: ${{ github.workspace }}/spynnaker_install
6661
CFLAGS: -fdiagnostics-color=always
6762

6863
- name: Build documentation using doxygen
@@ -73,21 +68,18 @@ jobs:
7368
uses: actions/upload-artifact@v4
7469
with:
7570
name: fec_binaries
76-
path: SpiNNFrontEndCommon/spinn_front_end_common/common_model_binaries/*.aplx
71+
path: |
72+
SpiNNFrontEndCommon/spinn_front_end_common/common_model_binaries/*.aplx
73+
SpiNNFrontEndCommon/spinn_front_end_common/common_model_binaries/logs*.sqlite3
7774
retention-days: 5
7875

7976
- name: Upload PyNN binaries
8077
uses: actions/upload-artifact@v4
8178
with:
8279
name: pynn_binaries
83-
path: spynnaker/pyNN/model_binaries/*.aplx
84-
retention-days: 5
85-
86-
- name: Upload log.sqlite3s
87-
uses: actions/upload-artifact@v4
88-
with:
89-
name: logs.sqlite3
90-
path: logs.sqlite3
80+
path: |
81+
spynnaker/pyNN/model_binaries/*.aplx
82+
spynnaker/pyNN/model_binaries/logs*.sqlite3
9183
retention-days: 5
9284

9385
test:
@@ -103,7 +95,7 @@ jobs:
10395
- name: Prepare
10496
uses: SpiNNakerManchester/SupportScripts/actions/prepare@main
10597
with:
106-
install-dependencies: >
98+
install-dependencies: >
10799
SpiNNUtils SpiNNMachine SpiNNMan PACMAN spalloc
108100
SpiNNFrontEndCommon TestBase
109101
install-module: true
@@ -124,15 +116,9 @@ jobs:
124116
name: pynn_binaries
125117
path: external_binaries
126118

127-
- name: Download logs.sqlite3
128-
uses: actions/download-artifact@v4
129-
with:
130-
name: logs.sqlite3
131-
path: external_binaries
132-
133119
- name: Append cfg
134120
# Doing this in the prepare action ended with a different path
135-
run: |
121+
run: |
136122
echo '[Mapping]' >> ~/.spynnaker.cfg
137123
echo "external_binaries=$PWD/external_binaries" >> ~/.spynnaker.cfg
138124
cat ~/.spynnaker.cfg

.github/workflows/publish.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ jobs:
3636
with:
3737
repository: SpiNNakerManchester/SupportScripts
3838
path: support
39-
- name: Set dynamic environment variables
40-
run: |
41-
echo "SPINN_DIRS=$PWD/spinnaker_tools" >> $GITHUB_ENV
42-
echo "NEURAL_MODELLING_DIRS=$PWD/neural_modelling" >> $GITHUB_ENV
4339

4440
- name: Checkout SpiNNaker Dependencies
4541
uses: SpiNNakerManchester/SupportScripts/actions/install-spinn-deps@main

neural_modelling/Makefile

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
16+
NEURAL_MODELLING_DIRS := $(abspath $(dir $(MAKEFILE_PATH)))
17+
APP_OUTPUT_DIR := $(NEURAL_MODELLING_DIRS)/../spynnaker/pyNN/model_binaries/
18+
1519
BUILDS = synapse_expander \
1620
spike_source/poisson \
1721
delay_extension \
@@ -31,33 +35,59 @@ FEC_TAG=https://spinnakermanchester.github.io/SpiNNFrontEndCommon/c/fec.tag
3135

3236
DOXYGEN ?= doxygen
3337
WGET ?= wget
38+
INSTALL ?= install
39+
MKDIR ?= mkdir -p
40+
RM ?= rm -f
3441

3542
all: $(DIRS)
3643
for d in $(DIRS); do $(MAKE) -C $$d || exit $$?; done
3744

3845
clean: $(DIRS)
46+
$(RM) $(APP_OUTPUT_DIR)logs*.sqlite3
47+
$(RM) $(APP_OUTPUT_DIR)*.aplx
48+
$(RM) -r $(NEURAL_MODELLING_DIRS)/modified_src
49+
3950
for d in $(DIRS); do $(MAKE) -C $$d clean || exit $$?; done
4051

52+
INSTALL_ERROR := neural_modelling install is only required if you are building in a temporary location.
53+
INSTALL_ERROR += In which case you must set the environment variable SPYNNAKER_INSTALL_DIR to where the install should go.
54+
INSTALL_ERROR += This environment variable must also exist for all higher level makes.
55+
56+
# This installs the source and makefiles into a central location so that
57+
# other projects can make use if it
58+
install: $(DIRS)
59+
$(eval SPYNNAKER_INSTALL_DIR := $(strip $(if $(SPYNNAKER_INSTALL_DIR), $(SPYNNAKER_INSTALL_DIR), $(error $(INSTALL_ERROR)))))
60+
for d in $(DIRS); do $(MAKE) -C $$d || exit $$?; done
61+
$(MKDIR) $(SPYNNAKER_INSTALL_DIR)/src
62+
$(MKDIR) $(SPYNNAKER_INSTALL_DIR)/modified_src
63+
$(MKDIR) $(SPYNNAKER_INSTALL_DIR)/make
64+
65+
for d in $$(find $(NEURAL_MODELLING_DIRS)/src -type d -printf '%P\n' ); do install -d --mode 755 "$(NEURAL_MODELLING_DIRS)/src/$$d" "$(SPYNNAKER_INSTALL_DIR)/src/$$d"; done
66+
for f in $$(find $(NEURAL_MODELLING_DIRS)/src -type f -printf '%P\n' ); do install --mode 644 "$(NEURAL_MODELLING_DIRS)/src/$$f" "$(SPYNNAKER_INSTALL_DIR)/src/$$f"; done
67+
for d in $$(find $(NEURAL_MODELLING_DIRS)/modified_src -type d -printf '%P\n' ); do install -d --mode 755 "$(NEURAL_MODELLING_DIRS)/modified_src/$$d" "$(SPYNNAKER_INSTALL_DIR)/modified_src/$$d"; done
68+
for f in $$(find $(NEURAL_MODELLING_DIRS)/modified_src -type f -printf '%P\n' ); do install --mode 644 "$(NEURAL_MODELLING_DIRS)/modified_src/$$f" "$(SPYNNAKER_INSTALL_DIR)/modified_src/$$f"; done
69+
$(INSTALL) $(NEURAL_MODELLING_DIRS)/make/* $(SPYNNAKER_INSTALL_DIR)/make
70+
4171
sllt.tag: .sllt_template.tag
4272
cp .sllt_template.tag sllt.tag
4373
ifneq (, $(shell which $(WGET)))
4474
-$(WGET) -q -O sllt.tag $(SLLT_TAG)
45-
endif
75+
endif
4676

4777
common.tag: .common_template.tag
4878
cp .common_template.tag common.tag
4979
ifneq (, $(shell which $(WGET)))
5080
-$(WGET) -q -O common.tag $(COMMON_TAG)
51-
endif
81+
endif
5282

5383
fec.tag: .fec_template.tag
5484
cp .fec_template.tag fec.tag
5585
ifneq (, $(shell which $(WGET)))
5686
-$(WGET) -q -O fec.tag $(FEC_TAG)
57-
endif
87+
endif
5888

5989
doxygen: $(TAGFILES)
6090
$(DOXYGEN)
6191
doxysetup: $(TAGFILES)
6292

63-
.PHONY: all clean doxygen doxysetup
93+
.PHONY: all clean install doxygen doxysetup

neural_modelling/make/funcs.mk

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# See Notes in sPyNNaker/neural_modelling/CHANGES_April_2018
2+
3+
# Copyright (c) 2025 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+
# Define a rule to find the source directory of the given file.
18+
# This attempts to find each of SOURCE_DIRS within the given file name; the
19+
# first one that matches is then returned. If none match, an empty string
20+
# will be returned.
21+
22+
# Get one of the paths from the colon separated pair in SOURCE_DIRS
23+
# $1 = colon separated pair
24+
# $2 = 1 for original source dir, 2 for modified source dir
25+
get_path = $(abspath $(word $2, $(subst :, ,$1)))/
26+
27+
# Get the source directory for a given file
28+
define get_source_dir#(file)
29+
$(firstword $(strip $(foreach d, $(SOURCE_DIRS), $(findstring $(call get_path,$(d),1), $(1)))))
30+
endef
31+
32+
# Get the modified source directory for a given source directory
33+
define get_mod_dir#(src_dir)
34+
$(call get_path,$(firstword $(strip $(foreach d, $(SOURCE_DIRS), $(findstring $(1):, $(d))))), 2)
35+
endef
36+
37+
# Define rule to strip any SOURCE_DIRS from source_file to allow use via local.mk.
38+
# If no match is found, the value is returned untouched
39+
# (though this will probably fail later).
40+
define strip_source_dirs#(source_file)
41+
$(or $(patsubst $(call get_source_dir, $(1))%,%,$(1)), $(1))
42+
endef
43+
44+
# Define a rule to replace any SOURCE_DIRS from header_file with the modified_src folder.
45+
define replace_source_dirs#(header_file)
46+
$(foreach d, $(SOURCE_DIRS), $(patsubst $(call get_path,$(d),1)%, $(call get_path,$(d),2)%, $(filter $(call get_path,$(d),1)%,$(1))))
47+
endef
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
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+
CUR_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
16+
FEC_INSTALL_DIR := $(strip $(if $(FEC_INSTALL_DIR), $(FEC_INSTALL_DIR), $(abspath $(CUR_DIR)/../../../SpiNNFrontEndCommon/c_common/front_end_common_lib)))
17+
18+
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
19+
CURRENT_DIR := $(abspath $(dir $(MAKEFILE_PATH)))
20+
NEURAL_MODELLING_DIRS := $(abspath $(dir $(MAKEFILE_PATH))/../)/
21+
22+
# Set logging levels
23+
ifeq ($(SPYNNAKER_DEBUG), DEBUG)
24+
NEURON_DEBUG = LOG_DEBUG
25+
LOCAL_ONLY_DEBUG = LOG_DEBUG
26+
endif
27+
28+
ifndef NEURON_DEBUG
29+
NEURON_DEBUG = LOG_INFO
30+
endif
31+
32+
ifndef LOCAL_ONLY_DEBUG
33+
LOCAL_ONLY_DEBUG = LOG_INFO
34+
endif
35+
36+
# Add source directory
37+
38+
# Define the directories
39+
NEURON_DIR := $(abspath $(NEURAL_MODELLING_DIRS)/src)
40+
NEURON_MODIFIED_DIR := $(abspath $(NEURAL_MODELLING_DIRS)/modified_src)/
41+
SOURCE_DIRS += $(NEURON_DIR):$(NEURON_MODIFIED_DIR)
42+
43+
include $(CURRENT_DIR)/funcs.mk
44+
45+
# Check if the neuron implementation is the default one
46+
ifndef NEURON_IMPL_H
47+
$(error NEURON_IMPL_H is not set. Please select a neuron implementation)
48+
else
49+
NEURON_IMPL := $(call strip_source_dirs,$(NEURON_IMPL_H))
50+
NEURON_IMPL_H := $(call replace_source_dirs,$(NEURON_IMPL_H))
51+
NEURON_IMPL_STANDARD := neuron/implementations/neuron_impl_standard.h
52+
NEURON_INCLUDES := -include $(NEURON_IMPL_H)
53+
ifeq ($(NEURON_IMPL), $(NEURON_IMPL_STANDARD))
54+
55+
# Check required inputs and point them to modified sources
56+
ifndef ADDITIONAL_INPUT_H
57+
ADDITIONAL_INPUT_H = $(NEURON_MODIFIED_DIR)neuron/additional_inputs/additional_input_none_impl.h
58+
else
59+
ADDITIONAL_INPUT_H := $(call replace_source_dirs,$(ADDITIONAL_INPUT_H))
60+
endif
61+
62+
ifndef NEURON_MODEL_H
63+
$(error NEURON_MODEL_H is not set. Please select a neuron model header file)
64+
else
65+
NEURON_MODEL_H := $(call replace_source_dirs,$(NEURON_MODEL_H))
66+
endif
67+
68+
ifndef INPUT_TYPE_H
69+
$(error INPUT_TYPE_H is not set. Please select an input type header file)
70+
else
71+
INPUT_TYPE_H := $(call replace_source_dirs,$(INPUT_TYPE_H))
72+
endif
73+
74+
ifndef THRESHOLD_TYPE_H
75+
$(error THRESHOLD_TYPE_H is not set. Please select a threshold type header file)
76+
else
77+
THRESHOLD_TYPE_H := $(call replace_source_dirs,$(THRESHOLD_TYPE_H))
78+
endif
79+
80+
ifndef SYNAPSE_TYPE_H
81+
$(error SYNAPSE_TYPE_H is not set. Please select a synapse type header file)
82+
else
83+
SYNAPSE_TYPE_H := $(call replace_source_dirs,$(SYNAPSE_TYPE_H))
84+
endif
85+
86+
ifndef CURRENT_SOURCE_H
87+
CURRENT_SOURCE_H = $(NEURON_MODIFIED_DIR)neuron/current_sources/current_source_impl.h
88+
else
89+
CURRENT_SOURCE_H := $(call replace_source_dirs,$(CURRENT_SOURCE_H))
90+
endif
91+
92+
NEURON_INCLUDE_FILES := \
93+
$(NEURON_MODEL_H) \
94+
$(SYNAPSE_TYPE_H) \
95+
$(INPUT_TYPE_H) \
96+
$(THRESHOLD_TYPE_H) \
97+
$(ADDITIONAL_INPUT_H) \
98+
$(CURRENT_SOURCE_H) \
99+
$(NEURON_IMPL_H)
100+
NEURON_INCLUDES := $(NEURON_INCLUDE_FILES:%=-include %)
101+
endif
102+
endif
103+
104+
ifndef LOCAL_ONLY_IMPL
105+
$(error LOCAL_ONLY_IMPL is not set. Please choose an implementation to compile)
106+
else
107+
LOCAL_ONLY_IMPL := $(call strip_source_dirs,$(LOCAL_ONLY_IMPL))
108+
endif
109+
110+
OTHER_SOURCES_CONVERTED := $(call strip_source_dirs,$(OTHER_SOURCES))
111+
112+
# List all the sources relative to one of SOURCE_DIRS
113+
SOURCES = neuron/c_main_local_only.c \
114+
neuron/neuron.c \
115+
neuron/local_only.c \
116+
$(LOCAL_ONLY_IMPL) $(OTHER_SOURCES_CONVERTED)
117+
118+
include $(FEC_INSTALL_DIR)/make/fec.mk
119+
120+
FEC_OPT = $(OTIME)
121+
122+
$(BUILD_DIR)neuron/c_main_local_only.o: $(NEURON_MODIFIED_DIR)neuron/c_main_local_only.c
123+
#c_main.c
124+
-@mkdir -p $(dir $@)
125+
$(CC) $(CFLAGS) -o $@ $<
126+
127+
$(BUILD_DIR)neuron/spike_processing_local_only.o: $(NEURON_MODIFIED_DIR)neuron/spike_processing_local_only.c
128+
#spike_processing.c
129+
-@mkdir -p $(dir $@)
130+
$(CC) $(CFLAGS) -o $@ $<
131+
132+
$(BUILD_DIR)neuron/neuron.o: $(NEURON_MODIFIED_DIR)neuron/neuron.c
133+
# neuron.o
134+
-@mkdir -p $(dir $@)
135+
$(CC) -DLOG_LEVEL=$(NEURON_DEBUG) $(CFLAGS) $(NEURON_INCLUDES) -o $@ $<
136+
137+
.PRECIOUS: $(NEURON_MODIFIED_DIR)%.c $(NEURON_MODIFIED_DIR)%.h $(LOG_DICT_FILE) $(EXTRA_PRECIOUS)
138+
139+
clean:
140+
$(RM) -r $(BUILD_DIR)

0 commit comments

Comments
 (0)