-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathMakefile
More file actions
176 lines (145 loc) · 4.55 KB
/
Makefile
File metadata and controls
176 lines (145 loc) · 4.55 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#
# Utility Makefile to build/push Docker images
#
# To use an alternate tag invoke as:
#
# make build ALTTAG=<alternate-tag>
#
# Optionally override
#
# DOCKER_EXE=<name of docker executable>
# DOCKER_NAME=<name of user used to push the image>
#
# Set this envirnment or command line variable
#
# DOCKER_PASS=<password of user used to push the image>
#
DOCKER_EXE ?= docker
DOCKER_NAME ?= timeloopaccelergy
VERSION := 0.2
USER := timeloopaccelergy
REPO := accelergy-timeloop-infrastructure
NAME := ${USER}/${REPO}
TAG := $$(git log -1 --pretty=%h)
IMG := ${NAME}:${TAG}
ALTTAG := latest
ALTIMG := ${NAME}:${ALTTAG}
# For Timeloop installation
BARVINOK_VER ?= 0.41.6
NTL_VER ?= 11.5.1
all: build
# Pull all submodules
pull:
# Only update top-level submodules
GIT_MAX_RECURSION=1 git submodule update --remote --merge --recursive
cp cacti.patch ./src/cacti/ && \
cd ./src/cacti/ && \
git reset --hard && \
git apply cacti.patch
cp cacti.patch ./src/accelergy-cacti-plug-in/cacti/ && \
cd ./src/accelergy-cacti-plug-in/cacti/ && \
git reset --hard && \
git apply cacti.patch
# Build and tag docker image
build-amd64:
"${DOCKER_EXE}" 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 .
"${DOCKER_EXE}" tag ${IMG}-amd64 ${ALTIMG}-amd64
build-arm64:
"${DOCKER_EXE}" 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 .
"${DOCKER_EXE}" tag ${IMG}-arm64 ${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 create \
${NAME}:${ALTTAG} \
--amend ${NAME}:${ALTTAG}-amd64 \
--amend ${NAME}:${ALTTAG}-arm64
"${DOCKER_EXE}" manifest push ${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 create \
${NAME}:${ALTTAG} \
--amend ${NAME}:${ALTTAG}-amd64 \
--amend ${NAME}:${ALTTAG}-arm64
"${DOCKER_EXE}" manifest push ${NAME}:${ALTTAG}
# Lint the Dockerfile
lint:
"${DOCKER_EXE}" run --rm -i hadolint/hadolint < Dockerfile || true
# Login to docker hub
login:
"${DOCKER_EXE}" login --username ${DOCKER_NAME} --password ${DOCKER_PASS}
install_accelergy:
python3 -m pip install setuptools wheel libconf numpy joblib
cd src/accelergy-cacti-plug-in && make
cd src/accelergy-neurosim-plug-in && make
cd src && pip3 install ./accelergy*
install_timeloop:
mkdir -p /tmp/build-timeloop
sudo apt-get update \
&& sudo DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata \
&& sudo apt-get install -y --no-install-recommends \
locales \
curl \
git \
wget \
python3-dev \
python3-pip \
scons \
make \
autotools-dev \
autoconf \
automake \
libtool \
&& sudo apt-get install -y --no-install-recommends \
g++ \
cmake
sudo apt-get update \
&& sudo apt-get install -y --no-install-recommends \
g++ \
libconfig++-dev \
libboost-dev \
libboost-filesystem-dev \
libboost-iostreams-dev \
libboost-log-dev \
libboost-serialization-dev \
libboost-thread-dev \
libyaml-cpp-dev \
libncurses5-dev \
libtinfo-dev \
libgpm-dev \
libgmp-dev
cd /tmp/build-timeloop \
&& wget https://libntl.org/ntl-${NTL_VER}.tar.gz \
&& tar -xvzf ntl-${NTL_VER}.tar.gz \
&& cd ntl-${NTL_VER}/src \
&& ./configure NTL_GMP_LIP=on SHARED=on \
&& make -j8 \
&& sudo make install
cd /tmp/build-timeloop \
&& wget https://barvinok.sourceforge.io/barvinok-${BARVINOK_VER}.tar.gz \
&& tar -xvzf barvinok-${BARVINOK_VER}.tar.gz \
&& cd barvinok-${BARVINOK_VER} \
&& ./configure --enable-shared-barvinok \
&& make -j8 \
&& sudo make install
cd src/timeloop \
&& cp -r pat-public/src/pat src/pat \
&& scons -j8 --with-isl --static --accelergy \
&& scons -j8 --with-isl --accelergy
cp src/timeloop/build/timeloop-mapper ~/.local/bin/timeloop-mapper
cp src/timeloop/build/timeloop-metrics ~/.local/bin/timeloop-metrics
cp src/timeloop/build/timeloop-model ~/.local/bin/timeloop-model