-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
261 lines (229 loc) · 7.91 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
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# SPDX-License-Identifier: MIT
# Copyright (c) 2023. University of Texas at Austin. All rights reserved.
SHELL := /bin/bash
UNAME ?= $(shell whoami)
UID ?= $(shell id -u)
GID ?= $(shell id -g)
BASE_IMAGE_NAME ?= pando-galois
IMAGE_NAME ?= ${UNAME}-${BASE_IMAGE_NAME}
SRC_DIR ?= $(shell pwd)
VERSION ?= $(shell git log --pretty="%h" -1 Dockerfile.dev)
DRIVEX_VERSION ?= $(shell cd pando-drv && git log --pretty="%h" -1)
CONTAINER_SRC_DIR ?= /pando
CONTAINER_BUILD_DIR ?= /pando/dockerbuild
CONTAINER_WORKDIR ?= ${CONTAINER_SRC_DIR}
CONTAINER_CONTEXT ?= default
CONTAINER_OPTS ?=
CONTAINER_CPUSET ?=
CONTAINER_CMD ?= setarch `uname -m` -R bash -l
INTERACTIVE ?= i
BUILD_TYPE ?= Release
BUILD_EXAMPLES ?= OFF
BUILD_WORKFLOWS ?= OFF
BUILD_MICROBENCH ?= OFF
ROOT_TESTS ?= OFF
GALOIS_TESTS ?= OFF
BFS_TESTS ?= OFF
TC_TESTS ?= OFF
WF4_TESTS ?= OFF
BFS_TESTS ?= OFF
PANDO_VALIDATION_PRINT ?= ON
# CMake variables
PANDO_TEST_DISCOVERY_TIMEOUT ?= 150
PANDO_EXTRA_CXX_FLAGS ?= ""
PANDO_BUILD_DOCS ?= OFF
# Drive X variables
DRV_BUILD_DIR ?= /pando/dockerbuild-drv
DRV_ROOT ?=
# Developer variables that should be set as env vars in startup files like .profile
PANDO_CONTAINER_MOUNTS ?=
PANDO_CONTAINER_ENV ?=
.PHONY: docker docker-image-dependencies
dependencies: dependencies-asdf
dependencies-asdf:
@echo "Updating asdf plugins..."
@asdf plugin update --all >/dev/null 2>&1 || true
@echo "Adding new asdf plugins..."
@awk '$$1 != "#" {print $$1}' ./.tool-versions | xargs -I % asdf plugin-add % >/dev/null 2>&1 || true
@echo "Installing asdf tools..."
@awk '$$1 != "#" {print $$1}' ./.tool-versions | xargs -I{} bash -c 'asdf install {}'
@echo "Updating local environment to use proper tool versions..."
@awk '$$1 != "#" {print $$1, $$2}' ./.tool-versions | xargs -I{} bash -c 'asdf local {}'
@asdf reshim
@echo "Done!"
hooks:
@pre-commit install --hook-type pre-commit
@pre-commit install-hooks
pre-commit:
@pre-commit run -a
git-submodules:
@git submodule update --init --recursive
ci-image:
@${MAKE} docker-image-dependencies
@docker --context ${CONTAINER_CONTEXT} build \
--build-arg SRC_DIR=${CONTAINER_SRC_DIR} \
--build-arg BUILD_DIR=${CONTAINER_BUILD_DIR} \
--build-arg UNAME=runner \
--build-arg UID=1078 \
--build-arg GID=504 \
--build-arg DRIVEX_IMAGE=drivex:${DRIVEX_VERSION} \
-t pando:${VERSION} \
--file Dockerfile.dev \
--target dev .
docker-image:
@${MAKE} docker-image-dependencies
@docker --context ${CONTAINER_CONTEXT} build \
--build-arg SRC_DIR=${CONTAINER_SRC_DIR} \
--build-arg BUILD_DIR=${CONTAINER_BUILD_DIR} \
--build-arg UNAME=${UNAME} \
--build-arg IS_CI=false \
--build-arg UID=${UID} \
--build-arg GID=${GID} \
--build-arg DRIVEX_IMAGE=drivex:${DRIVEX_VERSION} \
-t ${IMAGE_NAME}:${VERSION} \
--file Dockerfile.dev \
--target dev .
tacc-image:
@${MAKE} docker-image-dependencies
@docker --context ${CONTAINER_CONTEXT} build \
--build-arg SRC_DIR=${CONTAINER_SRC_DIR} \
--build-arg BUILD_DIR=${CONTAINER_BUILD_DIR} \
--build-arg UNAME=${UNAME} \
--build-arg IS_CI=false \
--build-arg UID=${UID} \
--build-arg GID=${GID} \
--build-arg DRIVEX_IMAGE=drivex:${DRIVEX_VERSION} \
-t ${IMAGE_NAME}-tacc:${VERSION} \
--file Dockerfile.dev \
--target dev .
docker-image-dependencies:
@mkdir -p dockerbuild
@mkdir -p data
docker --context ${CONTAINER_CONTEXT} build \
-t pando-gasnet:latest \
--file Dockerfile.dev \
--target gasnet .
docker --context ${CONTAINER_CONTEXT} build \
--build-arg GASNET_IMAGE=pando-gasnet:latest \
-t drivex:${DRIVEX_VERSION} \
--file Dockerfile.dev \
--target drivex .
docker:
@docker --context ${CONTAINER_CONTEXT} run --rm \
-v ${SRC_DIR}/:${CONTAINER_SRC_DIR} \
${PANDO_CONTAINER_MOUNTS} \
${PANDO_CONTAINER_ENV} \
${CONTAINER_CPUSET} \
--privileged \
--workdir=${CONTAINER_WORKDIR} ${CONTAINER_OPTS} -${INTERACTIVE}t \
${IMAGE_NAME}:${VERSION} \
${CONTAINER_CMD}
apptainer-image:
@${MAKE} tacc-image
@mkdir -p data/images
@apptainer build data/images/${IMAGE_NAME}-tacc.${VERSION}.sif docker-daemon://${IMAGE_NAME}-tacc:${VERSION}
apptainer:
apptainer exec \
--no-mount hostfs \
--no-mount home \
--writable-tmpfs \
--bind ${SRC_DIR}/:${CONTAINER_SRC_DIR} \
--pwd=${CONTAINER_WORKDIR} \
data/images/${IMAGE_NAME}-tacc.${VERSION}.sif \
${CONTAINER_CMD}
cmake-mpi:
@echo "Must be run from inside the dev Docker container"
@. /dependencies/spack/share/spack/setup-env.sh && \
spack load gasnet@${GASNET_VERSION}%gcc@${GCC_VERSION} qthreads@${QTHEADS_VERSION}%gcc@${GCC_VERSION} openmpi@${OMPI_VERSION}%gcc@${GCC_VERSION} && \
cmake \
-S ${SRC_DIR} \
-B ${BUILD_DIR} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_CXX_FLAGS=${PANDO_EXTRA_CXX_FLAGS} \
-DPANDO_PREP_GASNET_CONDUIT=mpi \
-DCMAKE_INSTALL_PREFIX=/opt/pando-lib-galois \
-DBUILD_EXAMPLES=${BUILD_EXAMPLES} \
-DBUILD_WORKFLOWS=${BUILD_WORKFLOWS} \
-DBUILD_MICROBENCH=${BUILD_MICROBENCH} \
-DENABLE_ROOT_TESTS=${ROOT_TESTS} \
-DENABLE_GALOIS_TESTS=${GALOIS_TESTS} \
-DENABLE_INFLUENCE_MAX_TESTS=${WF4_TESTS} \
-DENABLE_BFS_TESTS=${BFS_TESTS} \
-DENABLE_TC_TESTS=${TC_TESTS} \
-DPANDO_VALIDATION_PRINT=${PANDO_VALIDATION_PRINT} \
-DBUILD_DOCS=${PANDO_BUILD_DOCS} \
-DPANDO_TEST_DISCOVERY_TIMEOUT=${PANDO_TEST_DISCOVERY_TIMEOUT} \
-DCMAKE_CXX_COMPILER=g++-12 \
-DCMAKE_C_COMPILER=gcc-12
cmake-smp:
@echo "Must be run from inside the dev Docker container"
@. /dependencies/spack/share/spack/setup-env.sh && \
spack load gasnet@${GASNET_VERSION}%gcc@${GCC_VERSION} qthreads@${QTHEADS_VERSION}%gcc@${GCC_VERSION} openmpi@${OMPI_VERSION}%gcc@${GCC_VERSION} && \
cmake \
-S ${SRC_DIR} \
-B ${BUILD_DIR}-smp\
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_CXX_FLAGS=${PANDO_EXTRA_CXX_FLAGS} \
-DPANDO_PREP_GASNET_CONDUIT=smp \
-DCMAKE_INSTALL_PREFIX=/opt/pando-lib-galois \
-DBUILD_EXAMPLES=${BUILD_EXAMPLES} \
-DBUILD_WORKFLOWS=${BUILD_WORKFLOWS} \
-DBUILD_MICROBENCH=${BUILD_MICROBENCH} \
-DENABLE_ROOT_TESTS=${ROOT_TESTS} \
-DENABLE_GALOIS_TESTS=${GALOIS_TESTS} \
-DENABLE_INFLUENCE_MAX_TESTS=${WF4_TESTS} \
-DENABLE_BFS_TESTS=${BFS_TESTS} \
-DENABLE_TC_TESTS=${TC_TESTS} \
-DPANDO_VALIDATION_PRINT=${PANDO_VALIDATION_PRINT} \
-DBUILD_DOCS=${PANDO_BUILD_DOCS} \
-DPANDO_TEST_DISCOVERY_TIMEOUT=${PANDO_TEST_DISCOVERY_TIMEOUT} \
-DCMAKE_CXX_COMPILER=g++-12 \
-DCMAKE_C_COMPILER=gcc-12
cmake-drv:
@cmake \
-S ${SRC_DIR} \
-B ${DRV_BUILD_DIR} \
-DDRVX_ROOT=${DRV_ROOT} \
-DPANDO_RT_BACKEND=DRVX \
-DCMAKE_CXX_FLAGS=${PANDO_EXTRA_CXX_FLAGS} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX=/opt/pando-lib-galois \
-DBUILD_EXAMPLES=${BUILD_EXAMPLES} \
-DBUILD_WORKFLOWS=${BUILD_WORKFLOWS} \
-DBUILD_MICROBENCH=${BUILD_MICROBENCH} \
-DENABLE_ROOT_TESTS=${ROOT_TESTS} \
-DENABLE_GALOIS_TESTS=${GALOIS_TESTS} \
-DENABLE_INFLUENCE_MAX_TESTS=${WF4_TESTS} \
-DENABLE_BFS_TESTS=${BFS_TESTS} \
-DENABLE_TC_TESTS=${TC_TESTS} \
-DPANDO_VALIDATION_PRINT=${PANDO_VALIDATION_PRINT} \
-DBUILD_DOCS=OFF \
-DCMAKE_CXX_COMPILER=g++-12 \
-DCMAKE_C_COMPILER=gcc-12
setup-ci: cmake-mpi
setup: cmake-mpi cmake-smp
run-tests-mpi:
set -o pipefail && \
. ~/.profile && \
cd ${CONTAINER_BUILD_DIR} && ctest -j2 --verbose | tee test.out && \
! grep -E "Failure" test.out && ! grep -E "runtime error" test.out
run-tests-smp:
set -o pipefail && \
. ~/.profile && \
cd ${CONTAINER_BUILD_DIR}-smp && ctest -j2 --verbose | tee test.out && \
! grep -E "Failure" test.out && ! grep -E "runtime error" test.out
run-tests-drv:
set -o pipefail && \
. ~/.profile && \
cd ${DRV_BUILD_DIR} && ctest -j8 --verbose | tee test.out && \
! grep -E "Failure" test.out && ! grep -E "runtime error" test.out
run-tests: run-tests-mpi
smoke-tests:
@bash scripts/run.sh
# this command is slow since hooks are not stored in the container image
# this is mostly for CI use
docker-pre-commit:
@docker --context ${CONTAINER_CONTEXT} run --rm \
-v ${SRC_DIR}/:${CONTAINER_SRC_DIR} --privileged \
--workdir=${CONTAINER_WORKDIR} -t \
${IMAGE_NAME}:${VERSION} bash -lc "git config --global --add safe.directory /pando && make hooks && make pre-commit"