forked from erdc/proteus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
340 lines (286 loc) · 13.2 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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
.PHONY: all check clean distclean doc install profile proteus update FORCE
all: install
#We use environment variables from the invoking process if they have been set,
#otherwise we try our best to determine them automatically.
SHELL=/usr/bin/env bash
PROTEUS ?= $(shell python -c "from __future__ import print_function; import os; print(os.path.realpath(os.getcwd()))")
VER_CMD = git log -1 --pretty="%H"
PROTEUS_INSTALL_CMD = python setup.py install -O2
PROTEUS_DEVELOP_CMD = pip --disable-pip-version-check install -v -e .
# shell hack for now to automatically detect Garnet front-end nodes
PROTEUS_ARCH ?= $(shell [[ $$(hostname) = garnet* ]] && echo "garnet.gnu" || python -c "import sys; print sys.platform")
PROTEUS_PREFIX ?= ${PROTEUS}/${PROTEUS_ARCH}
PROTEUS_PYTHON ?= ${PROTEUS_PREFIX}/bin/python
PROTEUS_VERSION := $(shell ${VER_CMD})
HASHDIST_DEFAULT_VERSION := $(shell cat .hashdist_default)
HASHSTACK_DEFAULT_VERSION := $(shell cat .hashstack_default)
HASHDIST_VERSION := $(shell cd hashdist; ${VER_CMD})
HASHSTACK_VERSION := $(shell cd stack; ${VER_CMD})
define show_info
@echo "Please include this information in all bug reports."
@echo "+======================================================================================================+"
@echo "PROTEUS : ${PROTEUS}"
@echo "PROTEUS_ARCH : ${PROTEUS_ARCH}"
@echo "PROTEUS_PREFIX : ${PROTEUS_PREFIX}"
@echo "PROTEUS_VERSION : ${PROTEUS_VERSION}"
@echo "HASHDIST_VERSION : ${HASHDIST_VERSION}"
@echo "HASHSTACK_VERSION: ${HASHSTACK_VERSION}"
@echo "+======================================================================================================+"
@echo ""
endef
define howto
@echo "Proteus and its dependencies have been installed!"
@echo ""
@echo "You may want to add the installation directory to your PATH:"
@echo "${PROTEUS_PREFIX}/bin"
@echo ""
@echo "On bash or zsh:"
@echo 'export PATH=${PROTEUS_PREFIX}/bin:$${PATH}'
@echo ""
@echo "You can also invoke the Python interpreter directly:"
@echo "${PROTEUS_PREFIX}/bin/python"
@echo ""
@echo "You should now verify that the install succeeded by running:"
@echo "make test"
@echo ""
endef
ifeq ($(PROTEUS_ARCH), darwin)
PLATFORM_ENV = MACOSX_DEPLOYMENT_TARGET=$(shell sw_vers -productVersion | sed -E "s/([0-9]+\.[0-9]+).*/\1/")
endif
ifeq ($(PROTEUS_ARCH), cygwin)
BOOTSTRAP = cygwin_bootstrap.done
endif
ifdef MATLAB
MATLAB_SETUP = matlab_setup.done
endif
# The choice for default Fortran compiler needs to be overridden on the Garnet system
ifeq ($(PROTEUS_ARCH), garnet.gnu)
FC=ftn
F77=ftn
F90=ftn
endif
ifeq ($(PROTEUS_ARCH), topaz)
FC=gfortran
F77=gfortran
F90=gfortran
endif
ifdef VERBOSE
HIT_FLAGS += -v
endif
ifdef DEBUG
PROTEUS_ARCH := ${PROTEUS_ARCH}-debug
endif
PROTEUS_ENV ?= PATH="${PROTEUS_PREFIX}/bin:${PATH}"
clean:
-PROTEUS_PREFIX=${PROTEUS_PREFIX} ${PROTEUS_PYTHON} setup.py clean
distclean: clean
-rm -f stack.done
-rm -rf ${PROTEUS_PREFIX}
-rm -rf build proteus/*.pyc proteus/*.so proteus/*.a proteus/MeshAdaptPUMI/*.so
-rm -rf build proteus/mprans/*.pyc proteus/mprans/*.so proteus/mprans/*.a
update:
@echo "Manually trying to update all repositories"
git fetch origin; git checkout -q origin/master
@echo "Proteus repository updated to latest versions"
cd stack; git fetch origin; git checkout -q origin/master
@echo "Stack repository updated to latest versions"
cd hashdist; git fetch origin; git checkout -q origin/master
@echo "HashDist repository updated to latest versions"
@echo "+======================================================================================================+"
@echo "Warning, the HEAD has been detached in all repositories"
@echo "Type: git checkout -b branch_name to save changes"
@echo "+======================================================================================================+"
default_stack: stack hashdist
cd stack; git fetch origin; git checkout -q ${HASHSTACK_DEFAULT_VERSION}
@echo "Stack repository updated to .hashstack_default"
HASHSTACK_VERSION=${HASHSTACK_DEFAULT_VERSION}
@echo "hashdist repository updated to .hashdist_default"
cd hashdist; git fetch origin; git checkout -q ${HASHDIST_DEFAULT_VERSION}
HASHDIST_VERSION=${HASHDIST_DEFAULT_VERSION}
hashdist:
@echo "No hashdist found. Cloning hashdist from GitHub"
git clone https://github.com/hashdist/hashdist.git
cd hashdist && git checkout ${HASHDIST_DEFAULT_VERSION}
hashdist_src:
@echo "Trying to add hashdist source cache"
./hashdist/bin/hit remote add https://dl.dropboxusercontent.com/u/26353144/hashdist_src --objects="source"
hashdist_bld:
@echo "Trying to add hashdist build cache for your arch"
HASHSTACK_BLD = $(shell lsb_release -ir | python -c "import sys; rel=dict((k.split(':')[0].split()[0],k.split(':')[1].strip().replace('.','_').lower()) for k in sys.stdin.readlines()); print '{Distributor}_{Release}'.format(**rel)")
./hashdist/bin/hit remote add https://dl.dropboxusercontent.com/u/26353144/hashdist_${HASHSTACK_BLD} --objects="build"
stack:
@echo "No stack found. Cloning stack from GitHub"
git clone https://github.com/hashdist/hashstack.git stack
cd stack && git checkout ${HASHSTACK_DEFAULT_VERSION}
cygwin_bootstrap.done: stack/scripts/setup_cygstack.py stack/scripts/cygstack.txt
python stack/scripts/setup_cygstack.py stack/scripts/cygstack.txt
touch cygwin_bootstrap.done
matlab_setup.done: stack stack/default.yaml hashdist
@echo "User requests MATLAB install"
@echo "MATLAB environment variable set to ${MATLAB}"
@python setupmatlab.py stack/default.yaml ${MATLAB}; if [ $$? -ne 0 ] ; then \
echo "+======================================================================================================+"; \
echo "Couldn't find matlab on PATH."; \
echo "Try"; \
echo " MATLAB=/path/to/matlab make"; \
echo "+======================================================================================================+"; \
false; fi
touch matlab_setup.done
profile: ${PROTEUS_PREFIX}/artifact.json
stack/default.yaml: stack stack/examples/proteus.${PROTEUS_ARCH}.yaml
# workaround since mac doesn't support '-b' and '-i' breaks travis
-cp ${PWD}/stack/default.yaml ${PWD}/stack/default.yaml.bak
ln -sf ${PWD}/stack/examples/proteus.${PROTEUS_ARCH}.yaml ${PWD}/stack/default.yaml
# A hashstack profile will be rebuilt if Make detects any files in the stack
# directory newer than the profile artifact file.
${PROTEUS_PREFIX}/artifact.json: stack/default.yaml stack hashdist $(shell find stack -type f) ${BOOTSTRAP} ${MATLAB_SETUP}
@echo "************************"
@echo "Building dependencies..."
@echo "************************"
$(call show_info)
cd stack && ${PROTEUS}/hashdist/bin/hit develop ${HIT_FLAGS} -v -f -k error default.yaml ${PROTEUS_PREFIX}
@echo "************************"
@echo "Dependency build complete"
@echo "************************"
versions: ${PROTEUS_PREFIX}/versions.txt
@echo "************************"
@echo "Installing hashdist/hashstack versions..."
@echo "************************"
echo ${HASHDIST_VERSION} > ${PROTEUS_PREFIX}/hashdist_version.txt
echo ${HASHSTACK_VERSION} > ${PROTEUS_PREFIX}/hashstack_version.txt
# this always runs
${PROTEUS_PREFIX}/versions.txt: ${PROTEUS_PREFIX}/artifact.json FORCE
proteus: ${PROTEUS_PREFIX}/bin/proteus
${PROTEUS_PREFIX}/bin/proteus ${PROTEUS_PREFIX}/bin/proteus_env.sh: profile
@echo "************************"
@echo "Installing proteus scripts..."
@echo "************************"
echo "#!/usr/bin/env bash" > ${PROTEUS_PREFIX}/bin/proteus
echo '${PROTEUS_ENV} python "$${@:1}"' >> ${PROTEUS_PREFIX}/bin/proteus
chmod a+x ${PROTEUS_PREFIX}/bin/proteus
echo "#!/usr/bin/env sh" > ${PROTEUS_PREFIX}/bin/proteus_env.sh
echo '${PROTEUS_ENV}' >> ${PROTEUS_PREFIX}/bin/proteus_env.sh
chmod a+x ${PROTEUS_PREFIX}/bin/proteus_env.sh
@echo "************************"
@echo "Proteus script successfully installed"
@echo "************************"
# Proteus install should be triggered by an out-of-date hashstack profile, source tree, or modified setup files.
install: profile $(shell find proteus -type f) $(wildcard *.py) proteus
@echo "************************"
@echo "Installing..."
@echo "************************"
$(call show_info)
${PROTEUS_ENV} ${PROTEUS_INSTALL_CMD}
@echo "************************"
@echo "done installing standard extension modules"
@echo "************************"
@echo "installing scripts"
cd scripts && ${PROTEUS_ENV} PROTEUS_PREFIX=${PROTEUS_PREFIX} make
@echo "************************"
@echo "Installation complete"
@echo "************************"
@echo ""
@echo "************************"
@echo "Installing proteus version information..."
@echo "************************"
@echo ${PROTEUS_VERSION} > ${PROTEUS_PREFIX}/proteus_version.txt
@echo "Proteus was built using the following configuration:"
$(call show_info)
$(call howto)
develop: proteus profile
@echo "************************"
@echo "Installing development version"
@echo "************************"
$(call show_info)
${PROTEUS_ENV} CFLAGS="-Wall -Wstrict-prototypes -DDEBUG" ${PROTEUS_DEVELOP_CMD}
@echo "************************"
@echo "installing scripts"
cd scripts && ${PROTEUS_ENV} PROTEUS_PREFIX=${PROTEUS_PREFIX} make
@echo "************************"
@echo "Development installation complete"
@echo "************************"
@echo ""
@echo "************************"
@echo "Installing proteus version information..."
@echo "************************"
@echo "${PWD}" > ${PROTEUS_PREFIX}/proteus_version.txt
@echo "Proteus was built using the following configuration:"
$(call show_info)
$(call howto)
check:
@echo "************************"
@echo "Sanity environment check"
@echo PROTEUS: ${PROTEUS}
@echo PROTEUS_ARCH: ${PROTEUS_ARCH}
@echo PROTEUS_PREFIX: ${PROTEUS_PREFIX}
@echo PROTEUS_ENV: ${PROTEUS_ENV}
@echo "************************"
@echo "Hello world Check!"
${PROTEUS_PREFIX}/bin/python -c "print 'hello world'"
@echo "************************"
@echo "Proteus Partition Test"
source ${PROTEUS_PREFIX}/bin/proteus_env.sh; ${PROTEUS_PREFIX}/bin/python proteus/tests/ci/test_meshPartitionFromTetgenFiles.py
@echo "************************"
@echo "************************"
@echo "Parallel Proteus Partition Test"
source ${PROTEUS_PREFIX}/bin/proteus_env.sh; mpirun -np 4 ${PROTEUS_PYTHON} proteus/tests/ci/test_meshPartitionFromTetgenFiles.py
@echo "************************"
check_simmetrix:
@echo "SCOREC-Serial Simmetrix Error-Estimator and Adapt Test"
${PROTEUS_ENV} ${PROTEUS_PYTHON} proteus/MeshAdaptPUMI/test/test_MeshAdaptPUMI/test_errorAndSerialAdapt/errorCheck.py
@echo "************************"
@echo "SCOREC-Parallel Simmetrix Error Estimator and Adapt Test"
${PROTEUS_ENV} mpirun -np 2 ${PROTEUS_PYTHON} proteus/MeshAdaptPUMI/test/test_MeshAdaptPUMI/test_parallelAdapt/parallelAdaptCheck.py
@echo "************************"
@echo "SCOREC Simmetrix Isotropic Uniform Adapt Test"
${PROTEUS_ENV} ${PROTEUS_PYTHON} proteus/MeshAdaptPUMI/test/test_MeshAdaptPUMI/test_isotropicAdapt/isotropicCheck.py
@echo "************************"
#doc: install
doc:
@echo "************************************"
@echo "Generating documentation with Sphinx"
@echo "Be sure to first run"
@echo "make develop"
@echo "or"
@echo "make install"
@echo "************************************"
cd doc && ${PROTEUS_ENV} PROTEUS=${PWD} make html
@echo "**********************************"
@echo "Trying to open the html at"
@echo "../proteus-website/index.html"
@echo "**********************************"
-sensible-browser ../proteus-website/index.html &
test: check
@echo "************************************"
@echo "Running test suite"
source ${PROTEUS_PREFIX}/bin/proteus_env.sh; py.test --boxed -v proteus/tests --ignore proteus/tests/POD
@echo "Tests complete "
@echo "************************************"
jupyter:
@echo "************************************"
@echo "Enabling jupyter notebook/lab/widgets"
source ${PROTEUS_PREFIX}/bin/proteus_env.sh
pip install configparser
pip install ipyparallel==6.0.2 ipython==5.3.0 terminado==0.6 jupyter==1.0.0 jupyterlab==0.18.1 ipywidgets==6.0.0 ipyleaflet==0.3.0 jupyter_dashboards==0.7.0 pythreejs==0.3.0 rise==4.0.0b1 cesiumpy==0.3.3 bqplot==0.9.0 hide_code==0.4.0
ipcluster nbextension enable --user
jupyter serverextension enable --py jupyterlab --sys-prefix
jupyter nbextension enable --py --sys-prefix widgetsnbextension
jupyter nbextension enable --py --sys-prefix bqplot
jupyter nbextension enable --py --sys-prefix pythreejs
jupyter nbextension enable --py --sys-prefix ipyleaflet
jupyter nbextension install --py --sys-prefix hide_code
jupyter nbextension enable --py --sys-prefix hide_code
jupyter nbextension install --py --sys-prefix rise
jupyter nbextension enable --py --sys-prefix rise
jupyter dashboards quick-setup --sys-prefix
jupyter nbextension install --sys-prefix --py ipyparallel
jupyter nbextension enable --sys-prefix --py ipyparallel
jupyter serverextension enable --sys-prefix --py ipyparallel
ipython profile create mpi --parallel
echo "c.IPClusterEngines.engine_launcher_class = 'MPI'" >> ${HOME}/.ipython/profile_mpi/ipcluster_config.py
lfs:
pip install pyliblzma
wget https://github.com/git-lfs/git-lfs/releases/download/v1.5.5/git-lfs-linux-amd64-1.5.5.tar.gz
tar xzvf git-lfs-linux-amd64-1.5.5.tar.gz
cd git-lfs-1.5.5 && PREFIX=${HOME} ./install.sh
export PATH=${HOME}/bin:${PATH}