forked from Accelergy-Project/accelforge
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·132 lines (112 loc) · 4.1 KB
/
Makefile
File metadata and controls
executable file
·132 lines (112 loc) · 4.1 KB
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
DOCKER_EXE ?= docker
DOCKER_NAME ?= accelforge
DOCKER_BUILD ?= ${DOCKER_EXE} buildx build --load --pull
VERSION := 0.1.5
USER := timeloopaccelergy
REPO := accelforge
INFRA_REPO := accelforge-extra
NAME := ${USER}/${REPO}
TAG := $$(git log -1 --pretty=%h)
IMG := ${NAME}:${TAG}
ALTTAG := latest
ALTIMG := ${NAME}:${ALTTAG}
INFRA_NAME := ${USER}/${INFRA_REPO}
INFRA_IMG := ${INFRA_NAME}:${TAG}
INFRA_ALTIMG := ${INFRA_NAME}:${ALTTAG}
# Install hwcomponents packages from PyPI for Docker builds.
.PHONY: install-hwcomponents
install-hwcomponents:
python3 -m pip install --no-cache-dir hwcomponents hwcomponents-adc hwcomponents-cacti hwcomponents-library hwcomponents-neurosim
# Login to docker hub
login:
"${DOCKER_EXE}" login --username ${DOCKER_NAME} --password ${DOCKER_PASS}
# Build and tag docker image
build-amd64:
${DOCKER_BUILD} ${BUILD_FLAGS} --platform linux/amd64 \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg VCS_REF=${TAG} \
--build-arg BUILD_VERSION=${VERSION} \
-t ${IMG}-amd64 \
-t ${ALTIMG}-amd64 .
build-extra-amd64:
${DOCKER_BUILD} ${BUILD_FLAGS} --platform linux/amd64 \
-f infrastructure/Dockerfile \
-t ${INFRA_IMG}-amd64 \
-t ${INFRA_ALTIMG}-amd64 .
build-arm64:
${DOCKER_BUILD} ${BUILD_FLAGS} --platform linux/arm64 \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg VCS_REF=${TAG} \
--build-arg BUILD_VERSION=${VERSION} \
-t ${IMG}-arm64 \
-t ${ALTIMG}-arm64 .
build-extra-arm64:
${DOCKER_BUILD} ${BUILD_FLAGS} --platform linux/arm64 \
-f infrastructure/Dockerfile \
-t ${INFRA_IMG}-arm64 \
-t ${INFRA_ALTIMG}-arm64 .
# Push docker image
push-amd64:
@echo "Pushing ${NAME}:${ALTTAG}-amd64"
#Push Amd64 version
"${DOCKER_EXE}" push ${NAME}:${ALTTAG}-amd64
#Combine Amd64 version into multi-architecture docker image.
"${DOCKER_EXE}" manifest rm ${NAME}:${ALTTAG} || true
"${DOCKER_EXE}" manifest create \
${NAME}:${ALTTAG} \
${NAME}:${ALTTAG}-amd64 \
${NAME}:${ALTTAG}-arm64
"${DOCKER_EXE}" manifest push ${NAME}:${ALTTAG}
@echo "Pushing ${INFRA_NAME}:${ALTTAG}-amd64"
push-extra-amd64:
@echo "Pushing ${INFRA_NAME}:${ALTTAG}-amd64"
"${DOCKER_EXE}" push ${INFRA_NAME}:${ALTTAG}-amd64
#Combine Amd64 infrastructure version into multi-architecture docker image.
"${DOCKER_EXE}" manifest rm ${INFRA_NAME}:${ALTTAG} || true
"${DOCKER_EXE}" manifest create \
${INFRA_NAME}:${ALTTAG} \
${INFRA_NAME}:${ALTTAG}-amd64 \
${INFRA_NAME}:${ALTTAG}-arm64
"${DOCKER_EXE}" manifest push ${INFRA_NAME}:${ALTTAG}
push-arm64:
@echo "Pushing ${NAME}:${ALTTAG}-arm64"
#Push Arm64 version
"${DOCKER_EXE}" push ${NAME}:${ALTTAG}-arm64
#Combine Arm64 version into multi-architecture docker image.
"${DOCKER_EXE}" manifest rm ${NAME}:${ALTTAG} || true
"${DOCKER_EXE}" manifest create \
${NAME}:${ALTTAG} \
${NAME}:${ALTTAG}-amd64 \
${NAME}:${ALTTAG}-arm64
"${DOCKER_EXE}" manifest push ${NAME}:${ALTTAG}
push-extra-arm64:
@echo "Pushing ${INFRA_NAME}:${ALTTAG}-arm64"
#Push Arm64 infrastructure version
"${DOCKER_EXE}" push ${INFRA_NAME}:${ALTTAG}-arm64
#Combine Arm64 infrastructure version into multi-architecture docker image.
"${DOCKER_EXE}" manifest rm ${INFRA_NAME}:${ALTTAG} || true
"${DOCKER_EXE}" manifest create \
${INFRA_NAME}:${ALTTAG} \
${INFRA_NAME}:${ALTTAG}-amd64 \
${INFRA_NAME}:${ALTTAG}-arm64
"${DOCKER_EXE}" manifest push ${INFRA_NAME}:${ALTTAG}
all-infra:
make build-arm64
make build-amd64
make push-arm64
make push-amd64
make build-extra-arm64
make build-extra-amd64
make push-extra-arm64
make push-extra-amd64
run-docker:
docker-compose up
clean-notebooks:
nb-clean clean notebooks/*.ipynb
.PHONY: generate-docs
generate-docs:
# pip install sphinx-autobuild sphinx_autodoc_typehints sphinx-copybutton pydata-sphinx-theme
rm -r docs/_build/html
rm docs/source/accelforge.*.rst
LC_ALL=C.UTF-8 LANG=C.UTF-8 sphinx-apidoc -f -o docs/source/ --tocfile accelforge accelforge
LC_ALL=C.UTF-8 LANG=C.UTF-8 sphinx-autobuild -a docs/source docs/_build/html