Introduction

Spack allows the user to customize how the software is built through the packages.yaml file. User can set preferences for compiler and packages of any virtual dependency. Package preferences do not impose constraints on packages for particular versions or variants values, they rather only set defaults – the concretizer is free to change them if it must due to other constraints. Also note that package preferences are of lower priority than reuse of already installed packages. Settings in packages.yaml are used to fill in implicit defaults. Any of them can be overwritten on the command line if explicitly requested.

Spack provides six configuration scopes for configuration data, for more details on how the Spack pulls configuration data from files in several directories, refer https://spack.readthedocs.io/en/latest/configuration.html#configuration-scopes. Users can set their environment to prefer AMD compiler and AMD implementations of virtual dependencies over alternate options by copying below mentioned packages.yaml file in /etc/spack directory.

    packages:
      all:
        compilers: [aocc, gcc, intel, pgi, clang, xl, nag, fj]
        providers:
          blas: [amdblis, openblas]
          lapack: [amdlibflame, openblas]
          flame: [amdlibflame, libflame]
          fftw-api: [amdfftw, fftw]
          scalapack: [amdscalapack, netlib-scalapack]

Note: For more details, please check the Spack official documentation:
https://spack.readthedocs.io/en/latest/packages_yaml.html#package-preferences