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.
Proxy workarounds
When you install a package with Spack it usually needs to download some files, but sometimes the UC3M proxy will block these downloads, and you will get an error. For instance, if you tried to install git:
You would see an error like this:
==> Error: FetchError: All fetchers failed for resource-git-manpages-xvnirzmom7c4nenkzihpyi6twm6wpz5t
https://mirror.spack.io/_source-cache/archive/49/4954390466c125e82dce4a978dd1dadda13a916564d908cfdbd319f2e174a8ae.tar.gz: DetailedHTTPError: GET https://mirror.spack.io/_source-cache/archive/49/4954390466c125e82dce4a978dd1dadda13a916564d908cfdbd319f2e174a8ae.tar.gz returned 404: Not Found
https://www.kernel.org/pub/software/scm/git/git-manpages-2.53.0.tar.gz: DetailedURLError: GET https://www.kernel.org/pub/software/scm/git/git-manpages-2.53.0.tar.gz errored with: Tunnel connection failed: 403 Filtered
Now, to work around this we can download the missing file ourselves, copy it to C3 and then put it somewhere Spack can see it.
-
Set up a local mirror on the cluster. We will inject any missing dependencies here:
-
Download missing dependencies offline (from your computer) and copy them to C3
-
Let's put it in the local mirror and rename it according to the hash that Spack looks for in the error message
-
Now install it
Info
Now every time you install something with Spack you get a warning about your local mirror:
==> Warning: The following issues were ignored while updating the indices of binary caches
Multiple errors during fetching:
Error 1: BuildcacheIndexNotExists: Index not found in cache file:///home/user/spack/mirror/v3/manifests/index/index.manifest.json
Error 2: BuildcacheIndexNotExists: Index not found in cache file:///home/user/spack/mirror/build_cache/index.json
To suppress this warning let's tell Spack that this mirror is just for source code, not a buildcache. Edit this file:
Its contents should look like this (replace "user" with your username):