Install your own SW with Spack
You can install your own software with Spack. First install Spack in your HOME directory. We will refer to this Spack instance as local Spack to distinguish it from the cluster-provided Spack or global Spack.
Activate your local Spack instance:
You can put those two lines in your ~/.bashrc instead of the SPACK_GLOBAL_ROOT ones to have your local Spack automatically activated every time you log in.You will see that there is nothing installed initially:
Access Global Spack packages from your Local Spack
If you want to use packages from the global Spack instance alongside those installed by you, run this command. It will create a YAML file that configures your local Spack to see the global Spack packages as well:
cat << EOF > ${HOME}/spack/etc/spack/defaults/upstreams.yaml
upstreams:
spack-instance-1:
install_tree: /opt/ohpc/pub/spack/opt/spack
EOF
Now you should see all the global packages:
Before installing: select compilers
Before you start installing packages you should check which compilers are available to Spack. To list them:
We recommend adding the AOCC compiler (clang-based, AMD-optimized). It is available from the global Spack instance. Load it and add it:
Now it should show up:
Installing packages
Now we can start installing packages.
Look up packages
List all installable packages:
You can also search for a package:
Once you find the package you want to install check its information (source, versions, compilation variants):
Basic installation
Install a package:
If you want a specific version: Install a package:
You can also tell Spack which compiler to use. We recommend using AOCC to produce AMD-optimized code:
Since there are multiple GCC versions available, you might want to specify a compiler version:
Advanced installation
Now we will specify some compilation options using Spack variants. With spack info you can see all the available variants of a package. Some can be turned on and off (true or false), others have named options.
Following the mpich example, let us check some of its variants:
Variants:
argobots [false] false, true
Enable Argobots support
build_system [autotools] autotools
Build systems supported by the package
cuda [false] false, true
Build with CUDA
device [ch4] ch3, ch3:sock, ch4
Abstract Device Interface (ADI)
implementation. The ch4 device is in experimental state for versions
before 3.4.
Install a package with specific variants:
spack install <package>@<version> +<variant set to true> ~<variant set to false> <variant>=<value> %<compiler>@<version>
Example
Let us say we want to install mpich with argobots on, cuda off and device as "ch3":
You can also specify version and variants for dependencies:
spack install <package>@<version> <variant>=<value> ^<dependency>@<dependency version><dependency variants> %<compiler>@<version>
Example
Let us say we want to install mpich with argobots on, cuda off and device as "ch3":
For more details please check the official Spack documentation.