forked from xmos/ai_tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
148 lines (125 loc) · 5.49 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
NUM_PROCS := 8
.DEFAULT_GOAL := help
#**************************
# xcore_interpreter targets
#**************************
.PHONY: xcore_interpreters_build
xcore_interpreters_build:
cd python/xmos_ai_tools/xinterpreters/host/ && make install
#**************************
# xinterpreters smoke_test
#**************************
.PHONY: xinterpreters_smoke_test_host
xinterpreters_smoke_test_host:
cd python/xmos_ai_tools/xinterpreters/host/ && make install && make test
.PHONY: xinterpreters_smoke_test_device
xinterpreters_smoke_test_device:
cd python/xmos_ai_tools/xinterpreters/device/ && make test
#**************************
# integration test targets
#**************************
.PHONY: xformer2_test
xformer2_integration_test:
pytest integration_tests/runner.py --models_path integration_tests/models/non-bnns -n $(NUM_PROCS) --junitxml=integration_non_bnns_junit.xml
pytest integration_tests/runner.py --models_path integration_tests/models/bnns --bnn -n $(NUM_PROCS) --junitxml=integration_bnns_junit.xml
#**************************
# default build and test targets
#**************************
.PHONY: build
build: xcore_interpreters_build
.PHONY: test
test: xformer2_integration_test
#**************************
# other targets
#**************************
.PHONY: submodule_update
submodule_update:
git submodule update --init --recursive
.PHONY: clean
clean:
cd python/xmos_ai_tools/xinterpreters/host/ && make clean
.PHONY: help
help:
@: # This silences the "Nothing to be done for 'help'" output
$(info usage: make [target])
$(info )
$(info )
$(info primary targets:)
$(info build Build all components)
$(info test Run all tests)
$(info clean Clean all build artifacts)
$(info )
$(info secondary targets:)
$(info xcore_interpreters_build Build xcore_interpreters)
$(info xformer2_integration_test Run integration tests with xformer2)
$(info )
.PHONY: init_linux
init_linux:
export BAZEL_VERSION=`cat experimental/xformer/.bazelversion` ;\
curl -fLO "https://github.com/bazelbuild/bazel/releases/download/$${BAZEL_VERSION}/bazel-$${BAZEL_VERSION}-installer-linux-x86_64.sh" && \
chmod +x bazel-$${BAZEL_VERSION}-installer-linux-x86_64.sh && \
./bazel-$${BAZEL_VERSION}-installer-linux-x86_64.sh --prefix=$$PWD/bazel
.PHONY: init_darwin
init_darwin:
export BAZEL_VERSION=`cat experimental/xformer/.bazelversion` ;\
curl -fLO "https://github.com/bazelbuild/bazel/releases/download/$${BAZEL_VERSION}/bazel-$${BAZEL_VERSION}-installer-darwin-x86_64.sh" && \
chmod +x bazel-$${BAZEL_VERSION}-installer-darwin-x86_64.sh && \
./bazel-$${BAZEL_VERSION}-installer-darwin-x86_64.sh --prefix=$$PWD/bazel
.PHONY: init_windows
init_windows:
export BAZEL_VERSION=`cat experimental/xformer/.bazelversion` ;\
curl -fLO 'https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-windows-x86_64.exe'
mv bazel-${BAZEL_VERSION}-windows-x86_64.exe bazel.exe
.PHONY: build_release_linux
build_release_linux:
( module unload python && \
module load python/python-3.8.1 && \
module unload gcc && \
module load gcc/gcc-11.2.0 && \
module unload cmake && \
module load cmake/cmake-3.21.4 && \
python3 -m venv .venv && \
. .venv/bin/activate && \
pip install -r requirements.txt && \
cd experimental/xformer && ../../bazel/bin/bazel build --remote_cache=http://srv-bri-bld-cache:8080 //:xcore-opt --verbose_failures)
rm -rf ../Installs/Linux/External/xformer
mkdir -p ../Installs/Linux/External/xformer
cp experimental/xformer/bazel-bin/xcore-opt ../Installs/Linux/External/xformer
.PHONY: build_release_darwin
build_release_darwin:
( python3 -m venv .venv && \
. .venv/bin/activate && \
pip3 install --upgrade pip && \
pip3 install -r requirements.txt && \
cd experimental/xformer && ../../bazel/bin/bazel build --remote_cache=http://srv-bri-bld-cache:8080 --config=darwin_config //:xcore-opt --verbose_failures)
rm -rf ../Installs/Mac/External/xformer
mkdir -p ../Installs/Mac/External/xformer
cp experimental/xformer/bazel-bin/xcore-opt ../Installs/Mac/External/xformer
.PHONY: build_release_windows
build_release_windows:
python3 -m venv .venv
(. .venv/bin/activate && pip install -r requirements.txt)
(. .venv/bin/activate && cd experimental/xformer && ../../bazel build --remote_cache=http://srv-bri-bld-cache:8080 --config=windows_config //:xcore-opt --verbose_failures)
mkdir -p ../Installs/Linux/External/xformer
cp experimental/xformer/bazel-bin/xcore-opt ../Installs/Windows/External/xformer
TEST_SCRIPT= \
(cd xmos_ai_tools/src/xinterpreters/host/ && make build)&& \
(cd xmos_ai_tools && python3 setup.py bdist_wheel &&\
pip install ./xmos_ai_tools/dist/*"&& \
(cd experimental/xformer && ../../bazel/bin/bazel test --remote_cache=http://srv-bri-bld-cache:8080 //Test:all --verbose_failures)&& \
(pytest integration_tests/runner.py --models_path integration_tests/models/non-bnns -n $(NUM_PROCS) --junitxml=integration_non_bnns_junit.xml)&& \
(pytest integration_tests/runner.py --models_path integration_tests/models/bnns --bnn -n $(NUM_PROCS) --junitxml=integration_bnns_junit.xml)
.PHONY: test_linux
test_linux:
(. .venv/bin/activate && \
module unload python && \
module load python/python-3.8.1 && \
module unload gcc && \
module load gcc/gcc-11.2.0 && \
module unload cmake && \
module load cmake/cmake-3.21.4 && \
${TEST_SCRIPT} )
.PHONY: test_darwin
test_darwin:
(. .venv/bin/activate && \
${TEST_SCRIPT} )