ROOT Version: 6.26.06
Platform: linuxx8664gcc (AlmaLinux 9)
Compiler: gcc 11.3.1
I’m building a Singularity image with ROOT and my app for a HPC environment for first time. However, ready images (Docker) are pretty huge (~1 GB) as I think, so I build ROOT from source with command like this:
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/root -DCMAKE_CXX_STANDARD=17 -Dminimal=ON -Dx11=ON -Dmathmore=ON -Dxrootd=ON -Dminuit2=ON -Dminuit2_omp=ON -Dbuiltin_xrootd=OFF -Dtmva=ON -Dxft=ON -Dmlp=ON /tmp/root_source/
Resulting image is around 400 MB. Can I shrink it further by deleting tutorials for example? Or is it ok in general to send such large images to a HPC cluster?
First of all, be very careful with this option:
This one (also
minuit2_mpi) result in Minuit 2 only being able to minimize thread-safe functions. This is not the case for RooFit for example, or even the regular
TH1::Fit() I think. So we don’t encourage using this option, because if breaks the rest of ROOT. In only makes sense when building Minuit 2 standalone.
To reduce the size further, did you already try
-DCMAKE_BUILD_TYPE=MinSizeRel? This build type is using the
-Os optimization flag, which is like the standard
-O2 except that it omits optimizations that often increase the code size.
With this, I get a build around 330 MB. Is that acceptable? Deleting small things like the tutorial does not help much. Other ideas: maybe disable also
tmva. Do you need it? It takes quite a few MB. And can you work with compression? There are some huge files, in particular
etc/allDict.cxx.pch, which compresses from 90 to 50 MB with gzip.
Or is it ok in general to send such large images to a HPC cluster?
I don’t know, the ROOT forum is not the right place to ask this Better ask the administrators of your cluster.
Thank you for the warning! I’ll take this into account.
Yes, it is included intentionally.
As for the tutorials, as far as I remember they are actually about 15 MB, so I think their removal is a low hanging fruit with little risk.
I’ve been thinking that likely size gain from the optimization flag and compression may not worth the performance loss. May be it would be simpler to send compressed image.
I decided not to go into further research and just tested the working image. I realized that downloading of data sample (500-1500 MB) to a cluster node will have a greater impact on the processing speed than the deployment time (edit: and working image is cached on the node). Of course, I should have noticed this earlier instead of premature optimization. Anyway, I think the ROOT image with minimum required dependencies won’t hurt.
I am grateful for your valuable insights!
For greater coherence I’m attaching example of a definition file:
dnf upgrade -y -q --nodocs --setopt=install_weak_deps=0
dnf install -y -q --nodocs --setopt=install_weak_deps=0 gcc-c++ make cmake git patch
git clone --branch latest-stable --depth=1 https://github.com/root-project/root.git root_source
mkdir root_build root
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/root -DCMAKE_CXX_STANDARD=17 -Dminimal=ON /opt/root_source/
cmake --build . --parallel $(nproc) --target install
%files from build
microdnf upgrade -y --nodocs --setopt=install_weak_deps=0
microdnf install -y --nodocs --setopt=install_weak_deps=0 libstdc++-devel
microdnf clean -y all
rm -rf /opt/root/tutorials
sudo singularity build almalinux-9.2-minimal-root.sif almalinux-9.2-minimal-root.def
- It took around 40 minutes to build on i7 7700. If debug is needed, it is better to build a writable sandbox image like
sudo singularity build --sandbox almalinux-9.2-test docker://almalinux:9.2
sudo singularity shell --writable almalinux-9.2-test
and go through all build steps in recipe manually.
dnf install -y -q --nodocs --setopt=install_weak_deps=0 epel-release
dnf install -y -q --nodocs --setopt=install_weak_deps=0 xrootd openssl-devel libuuid-devel readline-devel
and runtime version for the minimal image (not tested yet)
microdnf install -y --nodocs --setopt=install_weak_deps=0 epel-release
microdnf install -y --nodocs --setopt=install_weak_deps=0 xrootd openssl libuuid readline
- X11 and Xft require corresponding packages.
- Apparently other ROOT build options require some packages at build time and run time, which ones is a subject to a further study.
- If size of the image doesn’t matter much, it’s probably better to stick to ROOT Docker repo, or to do a one-stage build, remove only the build tools and artifacts afterwards, and not worry about transferring runtime dependencies to the minimal image.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.