Adding External Spack Packages
By default, Spack does not initially look for or grab any external versions of packages. This means that Spack favors building its own version of every package instead of trying to use what is already available. This section offers a few tips to help guide Spack into using more external packages. A more in-depth look at external packages in Spack can be found on there website, here
Basic Commands:
The first command one can use to help inform Spack is spack compiler find. This command looks for any compiler loaded in the environment and adds it to the list of compilers spack can try to use to build other packages. Without this, Spack will install its own compiler when the first package is installed. For system with modules, you will need to repeat the process of loading the compiler module and then doing spack compiler find for each compiler you are interested in telling Spack about.
The second command is spack external find. This command has Spack look for a set of specific packages Spack can attempt locate on its own. The packages Spack can find depends on the package, but generally limited to more common packages.
Package.yaml Files for Livermore Systems
The COMPASS Github organization has a separate repository that holds system-specific external packages and additional Spack package files for our various applications. For more details on how to setup your Spack to include these additional features, see the README in the COMPASS spack packages repository.
Manual Explanation:
Warning
These commands are for doing a manual setup of package files on a machine. For most new users, following the guide in the repository link above will be enough.
- If you are on a Livermore machine (not your personal machine):
- Create a
~/.profilefile if does not exist already - Add the line
export SPACK_USER_CONFIG_PATH=$HOME/.spack/$CLUSTER. This tells Spack to look forpackage.yamlfiles in~/.spack/[system_name].$CLUSTERis provided by the OS on LLNL machines to identify the machine you are on. - Restart your current shell and make sure
echo $SPACK_USER_CONFIG_PATHreports the correct path! If it's blank, check if you have a.bash_profilein your top level directory. If so, you will need to move theexportcommand from the.profilefile to this file instead. For non-bash users, consult documentation to see which initialization files are loaded.
- Create a
- Navigate to
~/.spack/[system_name]/packages.yaml. (Possible system names: tuolumne, tioga, dane) If the directory or thepackages.yamlfile do not exist, you'll need to create them first. - Copy the contents of the appropriate
packages.yamlfile from the "COMPASS spack-packages" repository into thepackages.yamlon the system you are using. - Use Spack normally. Spack will now find packages already installed on the system and prefer those over installing duplicate libraries.