Skip to content

packages.yaml

Read the official Spack documentation

compilers.yaml is deprecated

Previous versions of Spack would use a separate compilers.yaml file to configure available compilers. This information is now stored in packages.yaml - please adjust any outdated personal config scopes as required.

The packages.yaml file contains details of how packages should be compiled, as well as where any existing compilers are located, along with the basic compilation arguments used by them:

packages:
  all:
    target: ['x86_64_v4']
  cuda:
    prefer:
    - '%gcc@14.2.0'
  cudnn:
    prefer:
    - '%gcc@14.2.0'
  gcc:
    externals:
    - spec: gcc@11.4.1 languages='c,c++,fortran'
      prefix: /usr
      extra_attributes:
        compilers:
          c: /usr/bin/gcc
          cxx: /usr/bin/g++
          fortran: /usr/bin/gfortran
    - spec: gcc@12.2.0 languages='c,c++,fortran'
      prefix: /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gcc/12.2.0-6frskzg
      extra_attributes:
        compilers:
          c: /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gcc/12.2.0-6frskzg/bin/gcc
          cxx: /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gcc/12.2.0-6frskzg/bin/g++
          fortran: /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gcc/12.2.0-6frskzg/bin/gfortran
        flags: {}
        environment: {}
        extra_rpaths: []
    - spec: gcc@14.2.0 languages:='c,c++,fortran'
      prefix: /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gcc/14.2.0-4hynq53
      extra_attributes:
        compilers:
          c: /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gcc/14.2.0-4hynq53/bin/gcc
          cxx: /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gcc/14.2.0-4hynq53/bin/g++
          fortran: /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gcc/14.2.0-4hynq53/bin/gfortran
  intel-oneapi-compilers:
    externals:
    - spec: intel-oneapi-compilers@2024.1.0
      prefix: /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/intel-oneapi-compilers/2024.1.0-bdqsx5f
      extra_attributes:
        compilers:
          c: /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/intel-oneapi-compilers/2024.1.0-bdqsx5f/compiler/2024.1/bin/icx
          cxx: /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/intel-oneapi-compilers/2024.1.0-bdqsx5f/compiler/2024.1/bin/icpx
          fortran: /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/intel-oneapi-compilers/2024.1.0-bdqsx5f/compiler/2024.1/bin/ifx
        flags: {}
        environment: {}
        extra_rpaths: []
  openmpi:
    buildable: false
    prefer:
    - '@5.0.5 +gpfs'
    externals:
    - spec: "openmpi@5.0.5 +gpfs %gcc@14.2.0"
      prefix: /share/apps/rocky9/general/libs/openmpi/gcc/14.2.0/5.0.5
    - spec: "openmpi@5.0.5-nogpfs ~gpfs %gcc@14.2.0"
      prefix: /share/apps/rocky9/general/libs/openmpi/gcc/14.2.0/5.0.5-nogpfs
    - spec: "openmpi@5.0.3 +gpfs %gcc@12.2.0"
      prefix: /share/apps/rocky9/general/libs/openmpi/gcc/12.2.0/5.0.3
    - spec: "openmpi@5.0.3-nogpfs ~gpfs %gcc@12.2.0"
      prefix: /share/apps/rocky9/general/libs/openmpi/gcc/12.2.0/5.0.3-nogpfs
  ucx:
    buildable: false
    externals:
    - spec: "ucx@1.17.0%gcc@14.2.0"
      prefix: /share/apps/rocky9/general/libs/ucx/gcc/14.2.0/1.17.0
    - spec: "ucx@1.16.0%gcc@12.2.0"
      prefix: /share/apps/rocky9/general/libs/ucx/gcc/12.2.0/1.16.0

The above sets the compilation target for all personal packages to x86_64_v4, which matches what we have used for our centrally installed applications and libraries. Most users will want to keep this the same, but compiling for alternative architectures is possible.

The sections for cuda, cudnn, openmpi and ucx should be included, they define versions we have manually compiled specifically for Apocrita, allowing things such as Infiniband to function correctly.

Also contained within the file above are the following compilers:

  • GCC 11.4.1, which is installed as part of the Rocky 9 operating system that runs on all Apocrita nodes
  • GCC 12.2.0, which is installed centrally already via Spack and is what the vast majority of centrally installed applications available as modules were compiled against
  • GCC 14.2.0, which is also installed centrally already via Spack. Usage is optional (and not always possible depending on what you are installing)
  • Intel 2024.1.0, which you may or may not require, and can be deleted as appropriate

You can provide a Spack install command with a specific compiler using the % sigil, as per the Spack documentation, e.g.:

spack install nano@8.7 %gcc@14.2.0

We will return to more example installation commands later in this tutorial.