Skip to content

Instantly share code, notes, and snippets.

@DraTeots
Last active November 6, 2020 06:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DraTeots/551d4862be177ea574238bcf5de1148e to your computer and use it in GitHub Desktop.
Save DraTeots/551d4862be177ea574238bcf5de1148e to your computer and use it in GitHub Desktop.
EIC Spack hints and tricks

Where to report

Eic spack repository https://github.com/eic/eic-spack

EIC slack channel for spack support https://eicug.slack.com/archives/C015QRU5ESH

Tips and tricks

Install

Spack verbose install

spack install -v g4e@1.3.8

# for debug spack itself (usually it is not needed)
spack --debug install -v g4e@1.3.8

# install in one thread
spack install -v -j 1 g4e@1.3.8

# stop on the first error
spack --debug install -v --fail-fast g4e@1.3.8

# Force target
spack install -v g4e@1.3.8 target=x86_64

Writes installation tree and what is installed:

spack spec -I g4e@1.3.8

Make spack use previously built packages

Spack tends to make many copies of dependent packages when they are of different versions or even built with different compilation flags. It is probably OK for smaller utility libraries but when it starts to rebuild big packages such as Cern ROOT, Geant4, QT, python - it is not desired behaviour in many cases. It can be solved with environments but not in case if you do installations of different packages over time.

It is possible to make Spack to build new packages using previously installed packages.

To do so one has to use package hashes as the dependency of the desired package, e.g.

spack install g4e@master ^/75hx6ia

Lets look at example to clarify what happens here. Spack gives unique hashes to packages it installs. One can see them using -l flag for both find and spec commands.

> spack find -l root

==> 3 installed packages
-- linux-ubuntu18.04-zen / gcc@7.5.0 ----------------------------
5h5oh7p root@6.18.04  oqyq5qp root@6.18.04  75hx6ia root@6.20.04

Here 5h5oh7p, oqyq5qp and 75hx6ia are unique hashes of different CERN root installations. Now one can use '/' symbol to specify a package by hash.

For example, to activate root version 6.20.04 from 3 different versions listed by spack one can use:

spack load /75hx6ia

Those hashes can be used to specify packet dependencies (one specifies dependencies with '^' symbol). So

spack install g4e@master ^/75hx6ia` 

translates like:

"install g4e from branch master using preinstalled root 6.20.04 with hash /75hx6ia as the dependency"

P.S. Without /75hx6ia spack will look for ROOT v6.18 as the default ROOT version.

Show what specks are used for package

To see exact specs which where used to build a package and reasons why they are used,

spack find -flv <packet name>

Ubuntu install

apt-get update -q && apt-get install -q -y \
        bzip2 \
        curl \
        build-essential \
        gfortran \
        git \
        gnupg2 \
        patch \
        python-dev \
        rsync \
        unzip \

The ubuntu docker file
https://github.com/eic/eic-spack/blob/master/docker/ubuntu18.04/Dockerfile

The files
https://gitlab.com/eic/escalate/workspace/-/blob/master/data/herwig6_20k.zip

Another source
https://gitlab.com/eic/validation_data

G4e
https://gitlab.com/eic/escalate/g4e/-/issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment