Click for detailed status
Installing a package with spack
Welcome to this tutorial on installing software packages on Euler with the spack package manager.
You will learn how to install a software package with spack on top of the centrally provided software stack. The installation will use dependencies from the 2025-06 stack. We are going to install the AMD HIP package with a CUDA backend.
Step 1: Activate spack¶
First we activate the spack instance that goes with stack 2025-06. We source its setup-env.sh with
Expected output:
[sfux@eu-login-16 ~]$ . /cluster/software/stacks/2025-06/setup-env.sh
Spack configured with upstream /cluster/software/stacks/2025-06 .
[sfux@eu-login-16 ~]$
Step 2: Installation¶
For this tutorial we have choosen to install HIP 6.2.1 with CUDA as a backend, and we want GCC 12 to build it. The spack command for this is
Whitespaces are ignored by Spack and unspecified details are left for Spack to define on its own.For more details, have a look at the spack documentation of version 0.23.1, since that's the version stack 2025-06 uses.
Since installatios profit from multiple cores, use quite some RAM and CPU time, it's best to do it on a compute node. For them to have internet access, we need to first load the eth_proxy module. Then we run it with 16 cores
Spack will now resolve dependencies, make use of pre-installed packages, and download and install missing dependencies. In our example, two dependencies hipcc and rocprofiler-register are required and missing, so spack installs them before installing hip.Expected output:
[sfux@eu-login-16 ~]$ module load eth_proxy
[sfux@eu-login-16 ~]$ srun -c 16 spack install hip @6.2.1 +cuda %gcc@12
srun: Job step's --cpus-per-task value exceeds that of job (16 > 1). Job step may never run.
srun: job 51333347 queued and waiting for resources
srun: job 51333347 has been allocated resources
[+] /usr (external glibc-2.35-in2krha2yiqxkisevyirzxed7p7dicz5)
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/gcc-runtime-12.2.0-r27nlxe5zjt3sdyqe5hwczuek4dtupeq
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/gflags-2.2.2-i664jziotkkq22fdv2o7fim2d23fj3oz
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/berkeley-db-18.1.40-qwaotmad7dpndwh72xmnuujlcy5pbbx6
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/gmake-4.4.1-w6m4h7ya2yfzjnaleahsikm2tx7q35mp
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/glog-0.7.1-dpbezgnzfie32r7kvkebvi4mnqwbmucm
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/xz-5.4.6-w26iul25tcu3czvijkrmot4p5cfdnjbq
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/ncurses-6.5-s32hzh4n2bz2mlyahtcjeqyd6icrusis
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/zlib-1.3.1-og2kvw25eo5dn4cscs2xyglzapf2dvd2
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/numactl-2.0.18-epsdsuob3ic6wjgtgf5c3cqpphzwtkee
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/bzip2-1.0.8-pst2u4i4if5jlchrp22pcwfx737qproe
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/libiconv-1.17-x2qrehclc2o56z7bxrjyscg2k6ho3kns
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/fmt-11.0.2-oa34t3jo6ptz2nxyqadzilitbiz34oi2
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/nghttp2-1.63.0-xnf3i4qdmkz2icfwtfa3pevzzsczmzyz
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/readline-8.2-jhcopwy5gbb6ljyzh6w37rrdsq2e6k7a
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/libedit-3.1-20240808-blmk4wizyxqfpick7xz3ouszoarrwmhz
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/openssl-3.4.0-nxwzaxjdmghh4uqhdyv7nqn6idztcs4a
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/libunistring-1.2-i3v3xittaqofc3gavqek54zk6pm67m7d
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/libxml2-2.13.4-jqnw7d2ggtcrvjkyla572mcdsghzfae6
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/gdbm-1.23-teez7wcvoacz73tihqd6dpnvcmtus7s7
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/libidn2-2.3.7-tstjuxxm7deevsgl2dlqywfci7qfi6gz
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/cuda-12.6.2-6ovgc2ircbnyntakw37gaj2j7k2fuwp3
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/perl-5.40.0-klwdhlfhfbfeargox4lmlu3qgmjqrkwu
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/curl-8.10.1-t4u6ugpvwnggmvs4sorzbcuwz4zg73f6
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/perl-uri-encode-1.1.1-egb2jhhy3n2s3tdtg5ptgqftvtlut4zt
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/perl-file-which-1.27-z4oockkvxvofi7si7ulctulzhft6bgnu
[+] /cluster/software/stacks/2025-06/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/cmake-3.30.5-mmkob5m73rcew67mxbgj3gkpvj24jj2f
==> Installing rocprofiler-register-6.2.1-zwlst63tvkclicolewb2wn5m7hqvtfrh [28/30]
==> No binary for rocprofiler-register-6.2.1-zwlst63tvkclicolewb2wn5m7hqvtfrh found: installing from source
==> Fetching https://mirror.spack.io/_source-cache/archive/16/161d3502863147df4daeadc538d0eb156c314c94634f8c34ee5994f046f8753f.tar.gz
==> Applied patch /cluster/software/stacks/2025-06/StackySpack/spack/var/spack/repos/builtin/packages/rocprofiler-register/001-add-cpack-fmt-glog.patch
==> rocprofiler-register: Executing phase: 'cmake'
==> rocprofiler-register: Executing phase: 'build'
==> rocprofiler-register: Executing phase: 'install'
==> rocprofiler-register: Successfully installed rocprofiler-register-6.2.1-zwlst63tvkclicolewb2wn5m7hqvtfrh
Stage: 1.06s. Cmake: 21.95s. Build: 5.12s. Install: 0.49s. Post-install: 0.43s. Total: 29.57s
[+] /cluster/home/sfux/spack/2025-06/install_tree/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/rocprofiler-register-6.2.1-zwlst63tvkclicolewb2wn5m7hqvtfrh
==> Installing hipcc-6.2.1-mesffiq3myx6i2dccxqhwpy3s4ug52iu [29/30]
==> No binary for hipcc-6.2.1-mesffiq3myx6i2dccxqhwpy3s4ug52iu found: installing from source
==> Fetching https://mirror.spack.io/_source-cache/archive/48/4840f109d8f267c28597e936c869c358de56b8ad6c3ed4881387cf531846e5a7.tar.gz
==> Applied patch /cluster/software/stacks/2025-06/StackySpack/spack/var/spack/repos/builtin/packages/hipcc/0001-Update-the-ROCMINFO-HIPCLANG-PATHS-inside-hipcc-6.2.0.patch
==> Ran patch() for hipcc
==> hipcc: Executing phase: 'cmake'
==> hipcc: Executing phase: 'build'
==> hipcc: Executing phase: 'install'
==> hipcc: Successfully installed hipcc-6.2.1-mesffiq3myx6i2dccxqhwpy3s4ug52iu
Stage: 9m 46.42s. Cmake: 2.22s. Build: 7.35s. Install: 0.26s. Post-install: 0.37s. Total: 9m 57.21s
[+] /cluster/home/sfux/spack/2025-06/install_tree/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/hipcc-6.2.1-mesffiq3myx6i2dccxqhwpy3s4ug52iu
==> Installing hip-6.2.1-6bq2btgrybfkjhz5exne7r6qtjnu7opd [30/30]
==> No binary for hip-6.2.1-6bq2btgrybfkjhz5exne7r6qtjnu7opd found: installing from source
==> Fetching https://mirror.spack.io/_source-cache/archive/a8/a8b86666a59867cae67409c4a45e0b8f29a6328c9739e6512c2b5612376f30cf.tar.gz
==> Fetching https://mirror.spack.io/_source-cache/archive/e9/e9cff3a8663defdbda833d49c9e7160171eca14dc285ffe4061378607d6c890d.tar.gz
==> Fetching https://mirror.spack.io/_source-cache/archive/90/90fcf0169889533b882d289f9cb8a7baf9bd46a3ce36752b915083931dc839f1.tar.gz
==> Fetching https://mirror.spack.io/_source-cache/archive/5d/5d99e498c1fece44a421574282fc89c6a2499979eaa9f850e5caa7fa3a8938b8.tar.gz
==> Moving resource stage
source: /cluster/scratch/sfux/spack/2025-06/build_stage/resource-clr-6bq2btgrybfkjhz5exne7r6qtjnu7opd/spack-src/
destination: /cluster/scratch/sfux/spack/2025-06/build_stage/spack-stage-hip-6.2.1-6bq2btgrybfkjhz5exne7r6qtjnu7opd/spack-src/clr
==> Moving resource stage
source: /cluster/scratch/sfux/spack/2025-06/build_stage/resource-hip-tests-6bq2btgrybfkjhz5exne7r6qtjnu7opd/spack-src/
destination: /cluster/scratch/sfux/spack/2025-06/build_stage/spack-stage-hip-6.2.1-6bq2btgrybfkjhz5exne7r6qtjnu7opd/spack-src/hip-tests
==> Moving resource stage
source: /cluster/scratch/sfux/spack/2025-06/build_stage/resource-hipother-6bq2btgrybfkjhz5exne7r6qtjnu7opd/spack-src/
destination: /cluster/scratch/sfux/spack/2025-06/build_stage/spack-stage-hip-6.2.1-6bq2btgrybfkjhz5exne7r6qtjnu7opd/spack-src/hipother
==> Applied patch /cluster/software/stacks/2025-06/StackySpack/spack/var/spack/repos/builtin/packages/hip/0018-reverting-hipMemoryType-with-memoryType.patch
==> Ran patch() for hip
==> hip: Executing phase: 'cmake'
==> hip: Executing phase: 'build'
==> hip: Executing phase: 'install'
==> hip: Successfully installed hip-6.2.1-6bq2btgrybfkjhz5exne7r6qtjnu7opd
Stage: 40.13s. Cmake: 1.99s. Build: 0.05s. Install: 1.70s. Post-install: 1.15s. Total: 45.75s
[+] /cluster/home/sfux/spack/2025-06/install_tree/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/hip-6.2.1-6bq2btgrybfkjhz5exne7r6qtjnu7opd
[sfux@eu-login-16 ~]$
Step 3: Loading packages¶
Loading packages with spack¶
In order to use packages, you need to load them. spack load adds a package to the user environment. To check that hip was loaded, we query the included hipcc for its version.
Expected output:
[sfux@eu-login-28 ~]$ . /cluster/software/stacks/2025-06/setup-env.sh
Spack configured with upstream /cluster/software/stacks/2025-06 .
[sfux@eu-login-28 ~]$ spack load hip@6.2.1%gcc@12.2.0
[sfux@eu-login-28 ~]$ hipcc --version
HIP version: 6.2.41134-0
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Sep_12_02:18:05_PDT_2024
Cuda compilation tools, release 12.6, V12.6.77
Build cuda_12.6.r12.6/compiler.34841621_0
[sfux@eu-login-28 ~]$
Loading packages with modules¶
Alternatively you can use modules to load packages. Our spack instance automatically creates LMOD modules when installing packages. So in order to use them, you need to load the stack for which the package was installed and then you can specify the path to your local LMOD files. Then you can load the packages within.
module use $HOME/spack/2025-06/lmod/linux-ubuntu22.04-x86_64/gcc/12.2.0
module load hip/6.2.1
module list
hipcc --version
Expected output:
[sfux@eu-login-06 ~]$ module use $HOME/spack/2025-06/lmod/linux-ubuntu22.04-x86_64/gcc/12.2.0
[sfux@eu-login-06 ~]$ module load hip/6.2.1
[sfux@eu-login-06 ~]$ module list
Currently Loaded Modules:
1) hip/6.2.1
[sfux@eu-login-06 ~]$ hipcc --version
HIP version: 6.2.41134-0
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Sep_12_02:18:05_PDT_2024
Cuda compilation tools, release 12.6, V12.6.77
Build cuda_12.6.r12.6/compiler.34841621_0
[sfux@eu-login-06 ~]$