-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathARIEL.def
436 lines (374 loc) · 15.4 KB
/
ARIEL.def
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
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# ARIEL Singularity container definition file
# See https://github.com/JeffersonLab/ARIEL
Bootstrap: debootstrap
OSVersion: focal
MirrorURL: http://mirrors.edge.kernel.org/ubuntu/
# MirrorURL: http://us.archive.ubuntu.com/ubuntu/
%labels
Author Ole Hansen ([email protected])
Version 0.6.4
%runscript
. /etc/profile.d/modules.sh
[ -r $HOME/.arielrc ] && . $HOME/.arielrc
exec /bin/bash --login "$@"
%setup
# If we have local copy of the installation, bring it in
if [ -d usr/local/ARIEL ]; then
mkdir -p ${SINGULARITY_ROOTFS}/usr/local
rsync -rl usr/local/ ${SINGULARITY_ROOTFS}/usr/local/
fi
%post -c /bin/bash
LOGNAME=`whoami`
export DEBIAN_FRONTEND=noninteractive
echo "deb http://mirrors.edge.kernel.org/ubuntu focal universe" > /etc/apt/sources.list.d/universe.list
apt-get update
# Useful things
apt-get install -qy locales
locale-gen en_US.UTF-8
update-locale LANG=en_US.UTF-8
apt-get install -qy less wget nano tcl environment-modules
# Prerequisites for building ROOT and dependencies
apt-get install -qy dpkg-dev cmake g++ gcc binutils patch git rsync mesa-utils \
libx11-dev libxpm-dev libxft-dev libxext-dev libssl-dev python3 python3-numpy \
gfortran libpcre3-dev libglu1-mesa-dev libglew-dev libftgl-dev libmysqlclient-dev libfftw3-dev \
libgraphviz-dev python3-dev libxml2-dev libkrb5-dev libgsl-dev zlib1g-dev libzstd-dev \
libfreetype6-dev liblz4-dev liblzma-dev libgif-dev libtiff-dev libpng-dev libsqlite3-dev \
libpq-dev libxxhash-dev libglew-dev libgl2ps-dev libtbb-dev libopenblas-dev libz3-dev
# ROOT optional
# apt-get install -qy libcfitsio-dev libavahi-compat-libdnssd-dev libldap2-dev qtwebengine5-dev
# Clean up from possible previous build attempt
rm -rf /tmp/{Vc,VecGeom,pythia8,ROOT,ARIEL} /var/tmp/$LOGNAME-{ROOT,ARIEL}-build
# Vc external for ROOT (vc-dev in the Ubuntu repos works, but is not the most recent)
if [ ! -f /usr/local/lib/libVc.a ]; then
mkdir -p /tmp/Vc && cd /tmp/Vc
VCVERSION=1.4.1
VCTARFILE=${VCVERSION}.tar.gz
wget https://github.com/VcDevel/Vc/archive/$VCTARFILE
tar xf $VCTARFILE --strip-components=1
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 \
-DBUILD_TESTING=OFF \
/tmp/Vc
cmake --build . --parallel $(nproc) --target install
cd
rm -rf /tmp/Vc
fi
# VecGeom external for ROOT (needs Vc)
if [ ! -f /usr/local/lib/libvecgeom.a ]; then
mkdir -p /tmp/VecGeom && cd /tmp/VecGeom
VGVERSION=v1.1.7
VGTARFILE=VecGeom-${VGVERSION}.tar.bz2
wget https://gitlab.cern.ch/VecGeom/VecGeom/-/archive/${VGVERSION}/${VGTARFILE}
tar xf $VGTARFILE --strip-components=1
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 \
-DBACKEND=vc -DBUILTIN_VECCORE=ON -DCTEST=OFF \
/tmp/VecGeom
cmake --build . --parallel $(nproc) --target install
cd
rm -rf /tmp/VecGeom
fi
# Pythia8 external for ROOT
# TODO: Add HepMC support
if [ ! -f /usr/local/lib/libpythia8.so ]; then
mkdir -p /tmp/pythia8 && cd /tmp/pythia8
PYTHIATARFILE=pythia8303.tgz
#wget http://home.thep.lu.se/~torbjorn/pythia8/$PYTHIATARFILE
wget https://hallaweb.jlab.org/software/$PYTHIATARFILE
tar xf $PYTHIATARFILE --strip-components=1
./configure --prefix=/usr/local --cxx=g++ \
--cxx-common="-O2 -std=c++17 -pedantic -W -Wall -Wshadow -fPIC" \
--with-python-include=/usr/include/python3.8 --with-gzip --with-openmp
make -j$(nproc) install
/sbin/ldconfig
cd
rm -rf /tmp/pythia8
fi
# ROOT
ROOTVER=6.22-06
if [ ! -f /usr/local/ROOT/$ROOTVER/bin/thisroot.sh ]; then
# Get ROOT source
cd /tmp
ROOTINSTALL=/usr/local/ROOT
ROOTSYS=$ROOTINSTALL/$ROOTVER
ROOTDOTVER=`echo $ROOTVER | sed 's|-|.|g'`
ROOTDIST=root_v${ROOTDOTVER}.source.tar.gz
mkdir -p $ROOTSYS
mkdir -p /tmp/ROOT && cd /tmp/ROOT
wget https://root.cern.ch/download/$ROOTDIST
tar xf $ROOTDIST
rm $ROOTDIST
# Patch for building ROOT against VecGeom successfully
cat >vecgeom.patch <<EOF
--- geom/vecgeom/CMakeLists.txt.orig 2020-09-19 15:37:06.700277918 -0400
+++ geom/vecgeom/CMakeLists.txt 2020-09-19 15:06:13.802811082 -0400
@@ -9,7 +9,7 @@
# @author Mihaela Gheata, CERN
############################################################################
-include_directories(AFTER SYSTEM \${VECGEOM_INCLUDE_DIRS})
+include_directories(AFTER SYSTEM \${VECGEOM_INCLUDE_DIRS} \${VECGEOM_INCLUDE_DIRS}/VecGeom)
if ( Vc_FOUND )
include_directories( AFTER SYSTEM \${Vc_INCLUDE_DIRS})
if (NOT "\${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"
EOF
cd root-$ROOTDOTVER
patch -p0 < ../vecgeom.patch
cd ..
# Configure & build ROOT
export LDFLAGS="-Wl,--no-undefined"
export GOFLAGS="-buildmode=pie -trimpath -modcacherw"
mkdir /var/tmp/$LOGNAME-ROOT-build && cd /var/tmp/$LOGNAME-ROOT-build
cmake -DCMAKE_INSTALL_PREFIX=$ROOTSYS \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=17 \
-Dgnuinstall:BOOL=OFF \
-Dbuiltin_afterimage:BOOL=ON \
-Dbuiltin_cfitsio:BOOL=OFF \
-Dbuiltin_davix:BOOL=OFF \
-Dbuiltin_fftw3:BOOL=OFF \
-Dbuiltin_freetype:BOOL=OFF \
-Dbuiltin_ftgl:BOOL=OFF \
-Dbuiltin_gl2ps:BOOL=OFF \
-Dbuiltin_glew:BOOL=OFF \
-Dbuiltin_gsl:BOOL=OFF \
-Dbuiltin_clang:BOOL=ON \
-Dbuiltin_llvm:BOOL=ON \
-Dbuiltin_lzma:BOOL=OFF \
-Dbuiltin_lz4:BOOL=OFF \
-Dbuiltin_openssl:BOOL=OFF \
-Dbuiltin_pcre:BOOL=OFF \
-Dbuiltin_tbb:BOOL=OFF \
-Dbuiltin_unuran:BOOL=ON \
-Dbuiltin_vc:BOOL=OFF \
-Dbuiltin_vdt:BOOL=ON \
-Dbuiltin_xrootd:BOOL=ON \
-Dbuiltin_zlib:BOOL=OFF \
-Dalien:BOOL=OFF \
-Dasimage:BOOL=ON \
-Dcastor:BOOL=OFF \
-Dccache:BOOL=OFF \
-Dchirp:BOOL=OFF \
-Dcocoa:BOOL=OFF \
-Droot7:BOOL=ON \
-Dcxxmodules:BOOL=OFF \
-Dcuda:BOOL=OFF \
-Dcudnn:BOOL=OFF \
-Ddataframe:BOOL=ON \
-Ddavix:BOOL=OFF \
-Ddcache:BOOL=OFF \
-Dexceptions:BOOL=ON \
-Dfftw3:BOOL=ON \
-Dfitsio:BOOL=OFF \
-Dfortran:BOOL=ON \
-Dgdml:BOOL=ON \
-Dgenvector:BOOL=ON \
-Dgfal:BOOL=OFF \
-Dgl2ps:BOOL=ON \
-Dglite:BOOL=OFF \
-Dglobus:BOOL=OFF \
-Dgsl_shared:BOOL=ON \
-Dgviz:BOOL=ON \
-Dhdfs:BOOL=OFF \
-Dhttp:BOOL=ON \
-Dimt:BOOL=ON \
-Djemalloc:BOOL=OFF \
-Dlibcxx:BOOL=OFF \
-Dmathmore:BOOL=ON \
-Dminuit2:BOOL=ON \
-Dmonalisa:BOOL=OFF \
-Dmt:BOOL=ON \
-Dmysql:BOOL=ON \
-Dodbc:BOOL=OFF \
-Dopengl:BOOL=ON \
-Doracle:BOOL=OFF \
-Dpgsql:BOOL=ON \
-Dpythia6:BOOL=OFF \
-Dpythia8:BOOL=ON \
-Dpyroot:BOOL=ON \
-Dqt5web:BOOL=OFF \
-Dr:BOOL=OFF \
-Drfio:BOOL=OFF \
-Droofit:BOOL=ON \
-Drpath:BOOL=OFF \
-Druntime_cxxmodules:BOOL=ON \
-Dshadowpw:BOOL=ON \
-Dshared:BOOL=ON \
-Dsoversion:BOOL=ON \
-Dspectrum:BOOL=ON \
-Dsqlite:BOOL=ON \
-Dssl:BOOL=ON \
-Dtbb:BOOL=ON \
-Dtcmalloc:BOOL=OFF \
-Dthread:BOOL=ON \
-Dtmva:BOOL=ON \
-Dunuran:BOOL=ON \
-Dvc:BOOL=ON \
-Dvdt:BOOL=ON \
-Dveccore:BOOL=ON \
-Dvecgeom:BOOL=ON \
-Dwebgui:BOOL=ON \
-Dx11:BOOL=ON \
-Dxml:BOOL=ON \
-Dxrootd:BOOL=ON \
-Dfail-on-missing:BOOL=ON \
-Dtesting:BOOL=OFF \
-DPYTHON_EXECUTABLE=/usr/bin/python3 \
-DCLANG_ENABLE_STATIC_ANALYZER=ON \
-DCLANG_ANALYZER_BUILD_Z3=ON \
/tmp/ROOT/root-$ROOTDOTVER
cmake --build . --parallel $(nproc) --target install
# Cleanup ROOT build
cd
rm -rf /tmp/ROOT /var/tmp/$LOGNAME-ROOT-build
fi
# ARIEL/art development prerequisites
apt-get install -qy ninja-build sqlite3 libboost-dev libboost-chrono-dev \
libboost-date-time-dev libboost-filesystem-dev libboost-graph-dev libboost-iostreams-dev \
libboost-locale-dev libboost-program-options-dev libboost-random-dev libboost-timer-dev \
libboost-wave-dev pybind11-dev libcppunit-dev
# Ensure that Boost is found under /usr/lib, not just /lib.
export Boost_ROOT=/usr
# Clone ARIEL and submodules
export ARIEL=/usr/local/ARIEL
if [ ! -d $ARIEL ]; then
cd /tmp
git clone https://github.com/JeffersonLab/ARIEL.git
cd ARIEL
git submodule update --init
# Build and install ARIEL
source /usr/local/ROOT/$ROOTVER/bin/thisroot.sh
./build-and-install.sh --builddir /var/tmp/$LOGNAME-ARIEL-build --release $ARIEL
# Verify installation (must be run from the build location)
./run-tests.sh
# Copy workbook to installation destination
cp -a examples/workbook $ARIEL/
# Cleanup ARIEL build
cd
rm -rf /tmp/ARIEL /var/tmp/$LOGNAME-ARIEL-build
fi
# Install a PDF viewer so users can read the documentation ;)
apt-get install -qy evince
# Final cleanup
apt-get clean
apt-get autoremove
%environment
export LC_ALL=C
export LANG=en_US.UTF-8
export PYTHONPATH=/usr/local/lib # For pythia8 Python module
export TERM=xterm-256color # For environment modules
. /etc/profile.d/modules.sh
module use /usr/local/ARIEL/modulefiles
module -s load ariel
%test
root --version
if [ $? -eq 0 ]; then
echo "ROOT set up successfully"
else
exit 1
fi
art --version
if [ $? -eq 0 ]; then
echo "art set up successfully"
else
exit 1
fi
%help
This is ARIEL, the art-based integrated event-processing library.
This container provides a full installation of
root 6.22.06 ROOT analysis framework from CERN (https://root.cern)
art 3.06.03 ART event processing framework from FNAL (https://art.fnal.gov)
This is a beta version of this container. Expect things to change.
The preferred way to access the software is to run the container binary
directly, which is equivalent to invoking a bash login shell within the
container environment. Examples
# Interactive shell
> ./ARIEL.sif
Singularity> art --version
art 3.06.03
# Non-interactive shell
> ./ARIEL.sif -c 'root -l'
root [0] b = new TBrowser;
root [1] .q
When started like this, the shell is properly initialized as a software
development environment. Before launching the bash shell, the file
$HOME/.arielrc is sourced to allow user-specific initialization
such as setting environment variables. To avoid nuisance messages from
graphics applications, it is recommended to put at least
unset XDG_RUNTIME_DIR
in this file.
The container sets up environment modules with configuration modules for the
ARIEL software. The 'root' and 'ariel' modules are loaded automatically.
To see all available modules, do
> ./ARIEL.sif
Singularity> module avail
----------------- /usr/local/ARIEL/modulefiles ---------------------------
ariel root workbook
...
Singularity> module list
Currently Loaded Modulefiles:
1) root 2) ariel
Avoid using the "singularity exec" and "singularity shell" commands for
loading and developing ARIEL plugins as these commands do not fully
initialize the environment and do not load $HOME/.arielrc.
** Getting started **
The "art workbook" contains user-friendly documentation for beginners.
To view the workbook PDF document, do
> ./ARIEL.sif
Singularity> evince $ARIEL/workbook/doc/art-workbook-v0_91.pdf 2>/dev/null &
The workbook code can be built as follows:
Singularity> mkdir -p ~/Analysis/art-workbook/{build,output}
Singularity> cd ~/Analysis/art-workbook/build
Singularity> module load workbook
Singularity> cmake $ARIEL/workbook
Singularity> make -j$(nproc)
Once built, you can run the various examples in the "fcl" directory like so:
Singularity> art -c fcl/FirstModule/first.fcl
See also here:
https://github.com/JeffersonLab/ARIEL/tree/develop/examples/workbook
The workbook document has not been updated in a while, so some information
may be outdated. Any references to the UPS package manager, buildtool etc.
should be ignored. Nevertheless, the bulk of the material about programming
in C++ and writing art modules is still applicable.
** 3D accelerated graphics **
The event display example in the workbook requires OpenGL graphics.
(This applies to all of ROOT's OpenGL functions.) Currently, this is only
supported if
* Singularity runs on the console of a machine with an Nvidia graphics card
* Nvidia graphics drivers are installed and active
* Singularity is started with the --nv option:
> singularity shell --nv ARIEL.sif
(if you get an error here, your system does not meet the requirements)
Singularity> cd ~/Analysis/art-workbook/build
Singularity> module load workbook
Singularity> art -c fcl/EventDisplay3D/eventDisplay01.fcl
Specifically, OpenGL will *not* work over an ssh connection, even with
X-forwarding enabled. (Regular X11 graphics, e.g. drawing histograms,
do work with X-forwarding.)
** Modifying the container **
At some point, advanced users may want to install additional software into
the container or reconfigure certain aspects of the operating system. To enable
modifications, extract the container to a "sandbox" directory (e.g. myARIEL/)
and run Singularity on this directory as root in writable mode:
> singularity build --sandbox myARIEL ARIEL.sif
> sudo singularity shell --writable myARIEL
Singularity> apt-get update
Singularity> apt-get install <new packages you want>
Singularity> <other configuration commands you want to run as root>
When done, you can run the modified sandbox as a regular user to test things
out:
> singularity shell myARIEL
Once you are happy with the results, you can generate a new compressed
container file from the sandbox:
> sudo singularity build myARIEL.sif myARIEL
Please note, however, that a container generated in this way will have
no record of how it was created. If you care about reproducibility (you
should), take careful notes of all the modifications you make. Then add
those modifications (e.g. additional apt-get commands, etc.) to the
definition file of the original container. (See below as to how to extract
the definition file directly from the container.) Finally, build a new
container file from the new definition file:
> singularity inspect --deffile ARIEL.sif > myARIEL.def
> <edit myARIEL.def>
> sudo singularity build myARIEL.sif myARIEL.def
Additional information can be found here:
https://github.com/JeffersonLab/ARIEL/tree/develop/container