AOCL Spack
About Spack tool:
Spack (https://spack.io/) is a package manager for supercomputers, Linux, and macOS. It makes installing scientific software easy. With Spack, user can build a package with multiple versions,configurations,platforms, and compilers, and all these builds can coexist on the same machine.
Install AOCL Spack Environment Setup
AOCL Spack environment setup can be done through an automated script (spack_set_env.sh) or via manual setup steps
-
Download AOCL Spack tar package from URL https://github.com/amd/aocl-spack/releases
-
Extract aocl_spack_recipe.tar package $ tar -xf aocl_spack_recipe.tar
The tar file aocl_spack_recipe.tar, contains below items: . README . spack_set_env.sh . spack_recipes.tar
Bash script spack_set_env.sh setups the environment required for AOCL package.
spack_set_env.sh script performs below activities: . Lists Spack prerequisites . Downloads Spack tool (release version - v0.12) . Install and configure environment-modules . Extracts AMD spack deliverable tar package (spack_recipes.tar) . Adding repo with namespace "amd" . Print the step for adding Spack tool path to the Shell environment
-
script usage: . If Spack tool not present in machine:
-
Run the spack environment script $ bash spack_set_env.sh -t spack_recipes.tar
-
Add spack to system PATH $ source /SPACK_SRC/spack/share/spack/setup-env.sh
. If Spack tool already present in machine:
- Run the spack environment script $ bash spack_set_env.sh -t spack_recipes.tar -s
-
- Install Spack:
Please refer https://spack.readthedocs.io/en/latest/getting_started.html link for Spack tool's: . Prerequisites . Installation . Add Spack to the Shell
Note: AOCL packages are tested using Spack release version - v0.12
- Install Environment Modules:
In order to use Spack's generated module files, user needs to install environment-modules package. Following steps shows the procedure.
$ spack install environment-modules
$ spack -i environment-modules
$ source init/bash
- Setup environment required for AOCL packages:
3.1 AOCL Prerequisites Recommended compiler version for AOCL package are AOCC-2.1 and GCC-9.2.0
3.1.1 Steps for adding AOCC-2.1 compiler to Spack: . Download AOCC-2.1 binaries from URL - https://developer.amd.com/amd-aocc/ . tar -xf aocc-compiler-2.1.0.tar . spack compiler find <Install directory path i.e., aocc-compiler-2.1.0>
3.1.2 Steps for adding GCC-9.2.0 compiler to Spack: $ spack install --no-checksum [email protected] $ gcc_9_2_0=$(spack location --install-dir [email protected]) $ spack compiler find ${gcc_9_2_0}
3.2 AOCL tar package . Download AOCL Spack tar package from URL - https://github.com/amd/aocl-spack/releases
. Extract aocl_spack_recipe.tar package
$ tar -xf aocl_spack_recipe.tar
The tar file aocl_spack_recipe.tar, contains below items: . README . spack_set_env.sh (Not required for manual approach) . spack_recipes.tar
$ cd ${SPACK_ROOT}
Where SPACK_ROOT is Spack install directory
$ cd ../
$ cp -v <AOCL Spack download Path>/spack_recipes.tar .
Extract spack_recipes.tar package $ tar -xf spack_recipes.tar
spack_recipes.tar package contains spack recipes for AMD Blis, AMD FFTW, AMD libFLAME libraries along with spack files required for adding 'amd' namespace
3.3 Add 'amd' namespace (spack package repositories) to Spack: We use a separate package repository for installing AOCL packages. Package repositories allows user to separate sets of packages that take precedence over one another.
We use the 'amd' repo that ships with spack_recipes.tar package to avoid breaking the builtin Spack packages.
Add amd namespace $ spack repo add ${SPACK_ROOT}/var/spack/repos/amd/
Install AOCL packages
AOCL package, which consists of amd.Blis, amd.libFlame and amd.fftw can be installed using below procedure as shown for Blis package:
Below command will provide blis package info and supported versions $ spack info amd.blis
Install amd blis latest version $ spack install amd.blis
Verify contents installed contents $ spack spec amd.blis
Command to go to blis install-directory $ spack cd -i amd.blis
under Blis installation directory, user will get .spack directory which contains below files or directories:
. build.env - captures build environment details
. build.out - captures build output
. spec.yaml - captures installed version, arch, compiler, namespace,
configure parameters and package hash value
. repos - directory containing spack recipe and repo namespace
files
To install other versions of amd blis package use @ (supported versions of blis are 2.0, 1.3, 1.2 and 1.0): $ spack install -v [email protected]
Build and install Blis 1.2 with openmp multithreading using AOCC compiler: $ spack install [email protected] threads=openmp %[email protected]
Build and install Blis 1.0 with pthread multithreading using GCC compiler: $ spack install [email protected] threads=pthreads %[email protected]
Note: AMD FFTW package is delivered for single and double precision. Default installation creats double precision binaries.
For single precision, use below command: $ spack install amd.fftw +single
Other Useful Spack Commands
List all the available namespaces in spack $ spack repo list
To list all versions of blis along with "hash", "version","arch","compiler", "namespace" and "parameters" value: $ spack find -lvN amd.blis
To use spack installed packages: $ spack load or export the path of installed package (output of spack cd -i package)
To uninstall Blis package:
To uninstall Blis default package $ spack uninstall amd.blis
To uninstall Blis based out of different version: $ spack uninstall [email protected]
To uninstall Blis based out of hash values: $ spack uninstall amd.blis/43reafx
To uninstall Blis based out of different namespace: $ spack uninstall [email protected]
To switch to builtin namespace: $ spack repo remove amd $ spack repo add </path/to/spack>/var/spack/repos/builtin
Note: AOCL packages based out of 'amd' namespaces and community libraries can exist together under same spack directory.