Skip to content
argentic edited this page Dec 23, 2024 · 2 revisions

Using Spack to Install and Manage ADDA

This guide summarizes our experience using Spack to install ADDA. Spack is a versatile package manager designed for scientific and high-performance computing (HPC) environments. It simplifies software installation by:

  • Managing dependencies and resolving environment conflicts.
  • Supporting multiple versions and configurations of the same library.
  • Allowing flexible environment setups for development and deployment.

This page outlines the steps for setting up and installing ADDa using Spack, including managing variants for different versions such as adda (default), adda+mpi, and adda+ocl.

Steps to Install ADDA via Spack

  1. (If needed) Install Spack Prerequisites and make:

    sudo apt install bzip2 ca-certificates file g++ gcc gfortran git gzip lsb-release patch python3 tar unzip xz-utils zstd make
  2. Download the necessary files:

    wget https://raw.githubusercontent.com/wiki/adda-team/adda/files/{package.py,spack.yaml}
  3. Clone the Spack Repository:

    git clone -c feature.manyFiles=true --depth=2 https://github.com/spack/spack.git
  4. Set Up the Spack Environment:

    . spack/share/spack/setup-env.sh
  5. Create the ADDA Package: Create the ADDa package from the GitHub repository:

    spack create --name adda https://github.com/adda-team/adda/archive/refs/heads/master.zip
  6. Customize the ADDA Package: Remove the default package.py file from Spack's built-in packages and replace it with your custom version:

    rm spack/var/spack/repos/builtin/packages/adda/package.py
    cp package.py spack/var/spack/repos/builtin/packages/adda/
  7. Create and Activate a Spack Environment:

    spack env create adda-env spack.yaml
    spack env activate adda-env
  8. Install ADDA within the environment:

    spack install --add adda

    Note: You can install additional variants (see Variants of ADDA).

  9. Load ADDA into your environment:

    spack load adda

    Note: Regardless of the variant installed in the previous step, this command will remain true.

  10. Run ADDA:

    adda

    Note: Depending on the variant, executables can also be adda_mpi or adda_ocl.

Variants of ADDA

ADDA comes with three variants to choose from:

  • adda (default, SEQ version)
  • adda+mpi (with MPI support)
  • adda+ocl (with OpenCL support)

Managing Multiple Variants

If you install more than one variant (e.g., spack install --add adda adda+mpi adda+ocl), you will need to specify which variant to load when running the spack load adda command, as the concretizer is set to False in spack.yaml. This means you must explicitly choose the variant when loading the executable.

Clone this wiki locally