Skip to content

Spack Manager Tutorial 02 18 2022

psakievich edited this page Feb 18, 2022 · 11 revisions

Spack-Manager Tutorial

Agenda:

  1. Introduction to Spack-Manager (20 min)
  1. Snapshot Workflow Tutorial (20 min)
  • Eagle Snapshot Workflow Commands:
    1. export SCRATCH=/scratch/${USER}
    2. cd ${SCRATCH}
    3. git clone --recursive https://github.com/psakievich/spack-manager.git
    4. export SPACK_MANAGER=${SCRATCH}/spack-manager && source ${SPACK_MANAGER}/start.sh && spack-start
    5. spack manager create-env --name exawind --spec 'exawind@master+hypre %gcc'
    6. spack env activate -d ${SPACK_MANAGER}/environments/exawind
    7. spack manager develop nalu-wind@master; spack manager develop exawind@master;
    8. spack manager external --list
    9. spack manager external --latest -v gcc
    10. spack concretize -f
    11. spack install
    12. cd ${SPACK_MANAGER}/environments/exawind/nalu-wind
    13. vi unit_tests.C
    14. spack install
    15. spack cd -b nalu-wind
    16. spack build-env nalu-wind ./unittestX
  1. Quick-Command Workflow Tutorial (10 min)
  • List of commands on ascicigpu
    1. export SCRATCH=/scratch/${USER}
    2. quick-develop -h
    3. quick-develop -d ${SCRATCH}/tutorial -s amr-wind@main+cuda cuda_arch=70
    4. spack install
    5. despacktivate
    6. quick-activate ${SCRATCH}/tutorial
    7. build-env-dive -h
    8. build-env-dive amr-wind
    9. ./amr_wind_unit_test
    10. make
    11. exit
    12. spack cd -e
    13. ls -lh #discuss environment directory if there is time.
  1. Additional Q&A (10 min)

Other Topics:

  • FAQ
  • Pre commands for quick-develop for customization
  • Monthly information sessions?
  • In's and outs of spack manager external
  • CMake script
  • How to add your own CMake flags
  • How to edit spack.yaml
  • What are the directories in Spack-Manager

Example CMake Script for Nalu-Wind on Eagle:

#!/bin/bash

COMPILER=gcc
TRILINOS_ROOT_DIR=/projects/exawind/exawind-snapshots/views/${COMPILER}
YAML_ROOT_DIR=/projects/exawind/exawind-snapshots/views/${COMPILER}
HYPRE_ROOT_DIR=/projects/exawind/exawind-snapshots/views/${COMPILER}

module use /projects/exawind/exawind-snapshots/modules
module load mpt exawind-${COMPILER}
which cmake
which mpirun

cmake \
  -DCMAKE_CXX_COMPILER:STRING=mpicxx \
  -DCMAKE_Fortran_COMPILER:STRING=mpif90 \
  -DTrilinos_DIR:PATH=${TRILINOS_ROOT_DIR} \
  -DYAML_DIR:PATH=${YAML_CPP_ROOT_DIR} \
  -DENABLE_HYPRE:BOOL=ON \
  -DHYPRE_DIR:PATH=${HYPRE_ROOT_DIR} \
  -DCMAKE_BUILD_TYPE:STRING=RELEASE \
  -DENABLE_DOCUMENTATION:BOOL=OFF \
  -DENABLE_TESTS:BOOL=ON \
  .. && nice make -j 16