spacktutorial on aws · q&a on slack: spackpm.herokuapp.com tutorial materials:...

64
LLNL-PRES-806064 This work was performed under the auspices of the U.S. Department of Energy by Lawrence Livermore National Laboratory under contract DE-AC52-07NA27344. Lawrence Livermore National Security, LLC Spack Tutorial on AWS July 28-29, 2020 The most recent version of these slides can be found at: https://spack-tutorial.readthedocs.io

Upload: others

Post on 01-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-806064This work was performed under the auspices of the U.S. Department of Energy by Lawrence Livermore National Laboratory under contract DE-AC52-07NA27344. Lawrence Livermore National Security, LLC

Spack Tutorial on AWS

July 28-29, 2020The most recent version of these slides can be found at:https://spack-tutorial.readthedocs.io

Page 2: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-8060642Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Download the latest version of slides and handouts at:

spack-tutorial.readthedocs.io

§ Spack website: spack.io

§ Spack GitHub repository: github.com/spack/spack

§ Spack Reference Documentation: spack.readthedocs.io

Tutorial Materials

For more:

Page 3: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-8060643Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Software complexity in HPC is growing

nalu

cmake

openmpi

trilinos

yaml-cppncurses

openssl

pkgconf

zlib

hwloc libxml2 xz

boost

glm

hdf5

matio

metis

mumps

netlib-scalapack

openblas

netcdf

parallel-netcdf

parmetis

suite-sparse

superlu

bzip2

m4 libsigsegv

Nalu: Generalized Unstructured Massively Parallel Low Mach Flow

Page 4: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-8060644Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

dealii

adol-c

arpack-ng

cmake

zlib

openblas

openmpi

assimpboost

gmsh oce

intel-tbb

gsl

hdf5

metis

muparser

nanoflann

netcdfnetcdf-cxx

netlib-scalapack

p4est

petsc

slepc

suite-sparse

sundials

trilinos

autoconf

m4

automake

libtool

perl

libsigsegv

gdbm

readline

ncurses

pkgconf

openssl

hwloc libxml2xz

bzip2

gmp

netgen

tetgen

hypre

parmetis

python

superlu-distsqlite

glm

matio

mumps

dealii: C++ Finite Element Library

nalu

cmake

openmpi

trilinos

yaml-cppncurses

openssl

pkgconf

zlib

hwloc libxml2 xz

boost

glm

hdf5

matio

metis

mumps

netlib-scalapack

openblas

netcdf

parallel-netcdf

parmetis

suite-sparse

superlu

bzip2

m4 libsigsegv

Nalu: Generalized Unstructured Massively Parallel Low Mach Flow

Software complexity in HPC is growing

Page 5: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-8060645Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

r-rminer

r

r-adabag

r-mass

r-lattice

r-nnet

r-rpart

r-cubist

r-e1071

r-glmnet

r-kernlab

r-kknn

r-mda

r-party

r-plotrix

r-pls

r-randomforest

r-xgboost

bzip2

cairo

freetype

zlib

glib

ncurses

pcre readline

curl

icu4c

jdklibjpeg-turbo

libtiff

pango

tcltk

fontconfig

pkgconf

libpngpixman

font-util

gperf

libxml2

util-macros

xz

gettext

libffi

perl

python

tar

gdbm

openssl

sqlitecmake

nasm

gobject-introspection

harfbuzz

bison

flex

sed

m4 libsigsegv

help2man

libx11 inputproto

kbproto

libxcb

xproto

xextproto

xtranslibpthread-stubs

libxau

libxdmcp

xcb-proto

r-caret

r-mlbench

r-car

r-nlme

r-foreach

r-ggplot2r-plyr

r-reshape2

r-modelmetrics

r-mgcv

r-pbkrtest

r-quantreg

r-matrix

r-lme4

r-minqa

r-rcpp

r-nloptr

r-rcppeigen

r-testthat

r-crayon

r-digest

r-magrittr

r-praise

r-r6

r-matrixmodels

r-sparsem

r-codetools

r-iterators

r-gtable

r-lazyeval

r-scales

r-tibble

r-stringr

r-stringi

r-dichromat

r-labeling

r-munsell

r-rcolorbrewer

r-viridislite

r-colorspace

r-assertthat

r-rlang

r-class

r-igraph

gmp

r-irlba

r-pkgconfig autoconf

automake

libtool

r-coin

r-modeltoolsr-mvtnorm

r-sandwich

r-zoo

r-survival

r-strucchange

r-multcomp r-th-data

r-data-table

R Miner: R Data Mining Library

dealii

adol-c

arpack-ng

cmake

zlib

openblas

openmpi

assimpboost

gmsh oce

intel-tbb

gsl

hdf5

metis

muparser

nanoflann

netcdfnetcdf-cxx

netlib-scalapack

p4est

petsc

slepc

suite-sparse

sundials

trilinos

autoconf

m4

automake

libtool

perl

libsigsegv

gdbm

readline

ncurses

pkgconf

openssl

hwloc libxml2xz

bzip2

gmp

netgen

tetgen

hypre

parmetis

python

superlu-distsqlite

glm

matio

mumps

dealii: C++ Finite Element Library

nalu

cmake

openmpi

trilinos

yaml-cppncurses

openssl

pkgconf

zlib

hwloc libxml2 xz

boost

glm

hdf5

matio

metis

mumps

netlib-scalapack

openblas

netcdf

parallel-netcdf

parmetis

suite-sparse

superlu

bzip2

m4 libsigsegv

Nalu: Generalized Unstructured Massively Parallel Low Mach Flow

Software complexity in HPC is growing

Page 6: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-8060646Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

§ Someone’s home directory?

§ LLNL? LANL? Sandia? ANL? LBL? TACC?— Environments at large-scale sites are very different.

§ Which MPI implementation?

§ Which compiler?

§ Which dependencies?

§ Which versions of dependencies?— Many applications require specific dependency versions.

What is the “production” environment for HPC?

Real answer: there isn’t a single production environment or a standard way to build.Reusing someone else’s software is HARD.

Page 7: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-8060647Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

The complexity of the exascale ecosystem threatens productivity.

§ Every application has its own stack of dependencies.§ Developers, users, and facilities dedicate (many) FTEs to building & porting.§ Often trade reuse and usability for performance.

80+ software packagesx5+ target architectures/platforms

Xeon Power KNLNVIDIA ARM Laptops?

x

Up to 7 compilersIntel GCC Clang XL

PGI Cray NAGx

= up to 1,260,000 combinations!

15+ applications

x10+ Programming Models

OpenMPI MPICH MVAPICH OpenMP CUDAOpenACC Dharma Legion RAJA Kokkos

2-3 versions of each package + external dependenciesx

We must make it easier to rely on others’ software!

Page 8: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-8060648Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

§ Containers provide a great way to reproduce and distribute an already-built software stack

§ Someone needs to build the container!— This isn’t trivial— Containerized applications still have hundreds of dependencies

§ Using the OS package manager inside a container is insufficient— Most binaries are built unoptimized— Generic binaries, not optimized for specific architectures

§ HPC containers may need to be rebuilt to support manydifferent hosts, anyway.— Not clear that we can ever build one container for all facilities— Containers likely won’t solve the N-platforms problem in HPC

What about containers?

We need something more flexible to build the containers

Page 9: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-8060649Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

§ How to install Spack:

§ How to install a package:

§ HDF5 and its dependencies are installed within the Spack directory.

§ Unlike typical package managers, Spack can also install many variants of the same build.— Different compilers— Different MPI implementations— Different build options

Spack is a flexible package manager for HPC

github.com/spack/spack

$ git clone https://github.com/spack/spack$ . spack/share/spack/setup-env.sh

$ spack install hdf5

@spackpm

Page 10: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606410Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

People who want to use or distribute software for HPC!

1. End Users of HPC Software— Install and run HPC applications and tools

2. HPC Application Teams— Manage third-party dependency libraries

3. Package Developers— People who want to package their own software for distribution

4. User support teams at HPC Centers— People who deploy software for users at large HPC sites

Who can use Spack?

Page 11: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606411Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Spack is used worldwide!

Over 600 contributorsfrom labs, academia, industry

Over 4,300 software packagesOver 2,900 monthly active users (on docs site)

Plot shows sessions onspack.readthedocs.io for one month

Page 12: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606412Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Users on our documentation site have also been increasing

Page 13: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606413Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Spack is being used on many of the top HPC systems

§ Official deployment tool for the U.S. Exascale Computing Project

§ >= 5 of the top 10 supercomputers§ High Energy Physics community

— Fermilab, CERN, collaborators

§ Astra (Sandia)§ Fugaku (Japanese National Supercomputer Project)

Summit (ORNL), Sierra (LLNL) Edison, Cori, Perlmutter (NERSC)SuperMUC-NG (LRZ, Germany)

#1 Fugaku OSS software stack isdeployed with Spack

Page 14: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606414Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

One month of Spack development is pretty busy!

14

Page 15: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606415Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

§ In November 2015, LLNL provided most of the contributions to Spack

§ Since then, we’ve gone from 300 to over 4,000 packages

§ Most packages are from external contributors!

§ Many contributions in core, as well.

§ We are committed to sustaining Spack’s open source ecosystem!

Contributions to Spack continue to grow!

Page 16: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

16LLNL-PRES-806064

16Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

§ Many new features:— Packages can specify how they should be found on the system

• spack external find command— Source code mirror for all Spack packages (from 0.15.1)— Testing builds in GitLab for all packages in E4S— Better Cray support— Better compiler optimization support on macOS

• apple-clang now its own compiler— Enhancements and simplification to configuration

• spack config add / spack config remove

§ Over 4,300 packages— 430 new since 0.14 in November 2019

§ Several bugfix releases since (0.15.1, 0.15.2, 0.15.3)

Spack 0.15 was released at the end of June

Page 17: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606417Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

1. “Functional” Package Managers— Nix https://nixos.org/— GNU Guix https://www.gnu.org/s/guix/

2. Build-from-source Package Managers— Homebrew, LinuxBrew http://brew.sh— MacPorts https://www.macports.org— Gentoo https://gentoo.org

Other tools in the HPC Space:

§ Easybuild http://hpcugent.github.io/easybuild/— An installation tool for HPC— Focused on HPC system administrators – different package model from Spack— Relies on a fixed software stack – harder to tweak recipes for experimentation

§ Conda https://conda.io— Very popular binary package manager for data science— Not targeted at HPC; generally has unoptimized binaries

Spack is not the only tool that automates builds

Page 18: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606418Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Spack Basics

Page 19: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606419Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

§ Each expression is a spec for a particular configuration— Each clause adds a constraint to the spec— Constraints are optional – specify only what you need.— Customize install on the command line!

§ Spec syntax is recursive— Full control over the combinatorial build space

Spack provides a spec syntax to describe customized DAG configurations

$ spack install mpileaks unconstrained$ spack install [email protected] @ custom version$ spack install [email protected] %[email protected] % custom compiler$ spack install [email protected] %[email protected] +threads +/- build option$ spack install [email protected] cppflags="-O3 –g3" set compiler flags$ spack install [email protected] target=skylake set target microarchitecture$ spack install [email protected] ^[email protected] %[email protected] ^ dependency information

Page 20: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606420Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

`spack list` shows what packages are available

$ spack list==> 303 packages.activeharmony cgal fish gtkplus libgd mesa openmpi py-coverage py-pycparser qt tcladept-utils cgm flex harfbuzz libgpg-error metis openspeedshop py-cython py-pyelftools qthreads texinfoapex cityhash fltk hdf libjpeg-turbo Mitos openssl py-dateutil py-pygments R the_silver_searcherarpack cleverleaf flux hdf5 libjson-c mpc otf py-epydoc py-pylint ravel thriftasciidoc cloog fontconfig hwloc libmng mpe2 otf2 py-funcsigs py-pypar readline tkatk cmake freetype hypre libmonitor mpfr pango py-genders py-pyparsing rose tmuxatlas cmocka gasnet icu libNBC mpibash papi py-gnuplot py-pyqt rsync tmuxinatoratop coreutils gcc icu4c libpciaccess mpich paraver py-h5py py-pyside ruby trilinosautoconf cppcheck gdb ImageMagick libpng mpileaks paraview py-ipython py-pytables SAMRAI uncrustifyautomaded cram gdk-pixbuf isl libsodium mrnet parmetis py-libxml2 py-python-daemon samtools util-linux automake cscope geos jdk libtiff mumps parpack py-lockfile py-pytz scalasca valgrindbear cube gflags jemalloc libtool munge patchelf py-mako py-rpy2 scorep vimbib2xhtml curl ghostscript jpeg libunwind muster pcre py-matplotlib py-scientificpython scotch vtkbinutils czmq git judy libuuid mvapich2 pcre2 py-mock py-scikit-learn scr wgetbison damselfly glib julia libxcb nasm pdt py-mpi4py py-scipy silo wxboost dbus glm launchmon libxml2 ncdu petsc py-mx py-setuptools snappy wxpropgridbowtie2 docbook-xml global lcms libxshmfence ncurses pidx py-mysqldb1 py-shiboken sparsehash xcb-protoboxlib doxygen glog leveldb libxslt netcdf pixman py-nose py-sip spindle xerces-c bzip2 dri2proto glpk libarchive llvm netgauge pkg-config py-numexpr py-six spot xzcairo dtcmp gmp libcerf llvm-lld netlib-blas pmgr_collective py-numpy py-sphinx sqlite yasmcallpath dyninst gmsh libcircle lmdb netlib-lapack postgresql py-pandas py-sympy stat zeromqcblas eigen gnuplot libdrm lmod netlib-scalapack ppl py-pbr py-tappy sundials zlibcbtf elfutils gnutls libdwarf lua nettle protobuf py-periodictable py-twisted swig zshcbtf-argonavis elpa gperf libedit lwgrp ninja py-astropy py-pexpect py-urwid szipcbtf-krell expat gperftools libelf lwm2 ompss py-basemap py-pil py-virtualenv tarcbtf-lanl extrae graphlib libevent matio ompt-openmp py-biopython py-pillow py-yapf taskcereal exuberant-ctags graphviz libffi mbedtls opari2 py-blessings py-pmw python taskdcfitsio fftw gsl libgcrypt memaxes openblas py-cffi py-pychecker qhull tau

§ Spack has over 3,500 packages now.

Page 21: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606421Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

§ All the versions coexist!— Multiple versions of

same package are ok.

§ Packages are installed to automatically find correct dependencies.

§ Binaries work regardless of user’s environment.

§ Spack also generates module files.— Don’t have to use them.

`spack find` shows what is installed

$ spack find==> 103 installed packages.-- linux-rhel6-x86_64 / [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]@3.9.1 [email protected] [email protected] [email protected] [email protected]@1.0 [email protected] [email protected] [email protected] [email protected]@2.14.0 [email protected] [email protected] [email protected] [email protected]@1.55.0 [email protected] [email protected] [email protected] [email protected]@1.14.0 [email protected] [email protected] [email protected] [email protected]@1.0.2 jpeg@9a [email protected] [email protected] [email protected]@8.1.2 libdwarf@20130729 [email protected] [email protected] [email protected]@8.1.2 [email protected] ocr@2015-02-16 [email protected] [email protected]@2.11.1 [email protected] [email protected] [email protected]@2.5.3 [email protected] [email protected] [email protected]@2.31.2 [email protected] [email protected] [email protected]

-- linux-rhel6-x86_64 / [email protected] [email protected] [email protected] [email protected] libdwarf@20130729 [email protected]@1.0.1 [email protected] [email protected] [email protected] [email protected]

-- linux-rhel6-x86_64 / [email protected] [email protected] [email protected] [email protected]

-- linux-rhel6-x86_64 / [email protected] [email protected] [email protected] libdwarf@20130729 [email protected] [email protected]

-- linux-rhel6-x86_64 / [email protected] [email protected] [email protected] libdwarf@20130729 [email protected]@1.55.0 [email protected] [email protected] [email protected]

Page 22: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606422Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Users can query the full dependency configuration of installed packages.

§ Architecture, compiler, versions, and variants may differ between builds.

$ spack find callpath==> 2 installed packages.-- linux-rhel6-x86_64 / [email protected] —— -- linux-rhel6-x86_64 / [email protected] [email protected] [email protected]

Expand dependencies with spack find -d

$ spack find -dl callpath==> 2 installed packages.-- linux-x86_64 / [email protected] ----------- -- linux-x86_64 / [email protected] -----------xv2clz2 [email protected] udltshs [email protected] ^[email protected] rfsu7fb ^[email protected] ^[email protected] ybet64y ^[email protected] ^[email protected] aa4ar6i ^[email protected] ^[email protected] tmnnge5 ^[email protected] ^[email protected] ybet64y ^[email protected] ^libdwarf@20130729 g2mxrl2 ^libdwarf@20130729cj5p5fk ^[email protected] ynpai3j ^[email protected] ^[email protected] ynpai3j ^[email protected] ^libdwarf@20130729 g2mxrl2 ^libdwarf@20130729cj5p5fk ^[email protected] ynpai3j ^[email protected] ^[email protected] ynpai3j ^[email protected] ^[email protected] aa4ar6i ^[email protected]

$ spack find -dl callpath==> 2 installed packages.-- linux-rhel6-x86_64 / [email protected] ----- -- linux-rhel6-x86_64 / [email protected] -----xv2clz2 [email protected] udltshs [email protected] ^[email protected] rfsu7fb ^[email protected] ^[email protected] ybet64y ^[email protected] ^[email protected] aa4ar6i ^[email protected] ^[email protected] tmnnge5 ^[email protected] ^[email protected] ybet64y ^[email protected] ^libdwarf@20130729 g2mxrl2 ^libdwarf@20130729cj5p5fk ^[email protected] ynpai3j ^[email protected] ^[email protected] ynpai3j ^[email protected] ^libdwarf@20130729 g2mxrl2 ^libdwarf@20130729cj5p5fk ^[email protected] ynpai3j ^[email protected] ^[email protected] ynpai3j ^[email protected] ^[email protected] aa4ar6i ^[email protected]

Page 23: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606423Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Spack manages installed compilers

§ Compilers are automatically detected— Automatic detection determined by OS— Linux: PATH— Cray: `module avail`

§ Compilers can be manually added— Including Spack-built compilers

compilers:- compiler:

modules: []operating_system: ubuntu14paths:cc: /usr/bin/gcc/4.9.3/gcccxx: /usr/bin/gcc/4.9.3/g++f77: /usr/bin/gcc/4.9.3/gfortranfc: /usr/bin/gcc/4.9.3/gfortran

spec: [email protected] compiler:

modules: []operating_system: ubuntu14paths:cc: /usr/bin/clang/6.0/clangcxx: /usr/bin/clang/6.0/clang++f77: nullfc: null

spec: [email protected] - compiler:

...

$ spack compilers==> Available compilers-- gcc [email protected] [email protected]

-- clang [email protected]

compilers.yaml

Page 24: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606424Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Hands-on Time: Spack Basics

Follow script at spack-tutorial.readthedocs.io

Page 25: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606425Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Core Spack Concepts

Page 26: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606426Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

§ Traditional binary package managers— RPM, yum, APT, yast, etc.— Designed to manage a single stack.— Install one version of each package in a single prefix (/usr).— Seamless upgrades to a stable, well tested stack

§ Port systems— BSD Ports, portage, Macports, Homebrew, Gentoo, etc.— Minimal support for builds parameterized by compilers, dependency versions.

§ Virtual Machines and Linux Containers (Docker)— Containers allow users to build environments for different applications.— Does not solve the build problem (someone has to build the image)— Performance, security, and upgrade issues prevent widespread HPC deployment.

Most existing tools do not support combinatorial versioning

Page 27: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606427Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

opt!"" spack

#"" darwin-mojave-skylake$ !"" clang-10.0.0-apple$ #"" bzip2-1.0.8-hc4sm4vuzpm4znmvrfzri4ow2mkphe2e$ #"" python-3.7.6-daqqpssxb6qbfrztsezkmhus3xoflbsy$ #"" sqlite-3.30.1-u64v26igxvxyn23hysmklfums6tgjv5r$ #"" xz-5.2.4-u5eawkvaoc7vonabe6nndkcfwuv233cj$ !"" zlib-1.2.11-x46q4wm46ay4pltriijbgizxjrhbaka6#"" darwin-mojave-x86_64$ !"" clang-10.0.0-apple$ !"" coreutils-8.29-pl2kcytejqcys5dzecfrtjqxfdssvnob

§ Each unique dependency graph is a unique configuration.

§ Each configuration in a unique directory.— Multiple configurations of the same

package can coexist.

§ Hash of entire directed acyclic graph (DAG) is appended to each prefix.

§ Installed packages automatically find dependencies— Spack embeds RPATHs in binaries.— No need to use modules or set

LD_LIBRARY_PATH— Things work the way you built them

Spack handles combinatorial software complexity

mpileaks

mpi

callpath dyninst

libdwarf

libelf

Installation Layout

Dependency DAG

opt!"" spack

#"" darwin-mojave-skylake$ !"" clang-10.0.0-apple$ #"" bzip2-1.0.8-hc4sm4vuzpm4znmvrfzri4ow2mkphe2e$ #"" python-3.7.6-daqqpssxb6qbfrztsezkmhus3xoflbsy$ #"" sqlite-3.30.1-u64v26igxvxyn23hysmklfums6tgjv5r$ #"" xz-5.2.4-u5eawkvaoc7vonabe6nndkcfwuv233cj$ !"" zlib-1.2.11-x46q4wm46ay4pltriijbgizxjrhbaka6#"" darwin-mojave-x86_64$ !"" clang-10.0.0-apple$ !"" coreutils-8.29-pl2kcytejqcys5dzecfrtjqxfdssvnob

Hash

Page 28: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606428Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

mpileaks

mpi

callpath dyninst

libdwarf

libelf

§ Spack ensures one configuration of each library per DAG— Ensures ABI consistency.— User does not need to know DAG structure; only the dependency names.

§ Spack can ensure that builds use the same compiler, or you can mix— Working on ensuring ABI compatibility when compilers are mixed.

Spack Specs can constrain versions of dependencies

$ spack install mpileaks %[email protected] ^[email protected]

Page 29: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606429Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Spack handles ABI-incompatible, versioned interfaces like MPI

$ spack install mpileaks ^[email protected] $ spack install mpileaks ^[email protected]:

$ spack install mpileaks ^mpi@2

mpileaks

mpi

callpath dyninst

libdwarf

libelf

§ mpi is a virtual dependency

§ Install the same package built with two different MPI implementations:

§ Let Spack choose MPI implementation, as long as it provides MPI 2 interface:

Page 30: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606430Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Concretization fills in missing configuration detailswhen the user is not explicit.

mpileaks ^[email protected]+debug ^[email protected] User input: abstract spec with some constraints

Concrete spec is fully constrainedand can be passed to install.

[email protected]%[email protected]=linux-ppc64

[email protected]%[email protected]=linux-ppc64

[email protected]%[email protected]+debug

=linux-ppc64

[email protected]%[email protected]=linux-ppc64

[email protected]%[email protected]=linux-ppc64

libdwarf@20130729%[email protected]=linux-ppc64

Abstract, normalized specwith some dependencies.

mpileaks

mpi

[email protected]+debug

dyninst

[email protected]

libdwarf

Norm

alize

Concretize Store

spec:- mpileaks:

arch: linux-x86_64compiler:name: gccversion: 4.9.2

dependencies:adept-utils: kszrtkpbzac3ss2ixcjkcorlaybnptp4callpath: bah5f4h4d2n47mgycej2mtrnrivvxy77mpich: aa4ar6ifj23yijqmdabeakpejcli72t3

hash: 33hjjhxi7p6gyzn5ptgyes7sghyprujhvariants: {} version: '1.0'

- adept-utils:arch: linux-x86_64compiler:name: gccversion: 4.9.2

dependencies:boost: teesjv7ehpe5ksspjim5dk43a7qnowlqmpich: aa4ar6ifj23yijqmdabeakpejcli72t3

hash: kszrtkpbzac3ss2ixcjkcorlaybnptp4variants: {} version: 1.0.1

- boost:arch: linux-x86_64compiler:name: gccversion: 4.9.2

dependencies: {} hash: teesjv7ehpe5ksspjim5dk43a7qnowlqvariants: {} version: 1.59.0

...

spec.yaml

Detailed provenance is storedwith the installed package

Page 31: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606431Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Use `spack spec` to see the results of concretization

$ spack spec mpileaksInput spec------------------------------mpileaks

[email protected]%[email protected] arch=darwin-elcapitan-x86_64

^[email protected]%[email protected] arch=darwin-elcapitan-x86_64^[email protected]%[email protected]+atomic+chrono+date_time~debug+filesystem~graph~icu_support+iostreams+locale+log+math~mpi+multithreaded+program_options~python+random +regex+serialization+shared+signals+singlethreaded+system+test+thread+timer+wave arch=darwin-elcapitan-x86_64

^[email protected]%[email protected] arch=darwin-elcapitan-x86_64^[email protected]%[email protected] arch=darwin-elcapitan-x86_64

^[email protected]%[email protected]~mxm~pmi~psm~psm2~slurm~sqlite3~thread_multiple~tm~verbs+vt arch=darwin-elcapitan-x86_64^[email protected]%[email protected] arch=darwin-elcapitan-x86_64

^[email protected]%[email protected] arch=darwin-elcapitan-x86_64^[email protected]%[email protected] arch=darwin-elcapitan-x86_64

^[email protected]%[email protected]+sigsegv arch=darwin-elcapitan-x86_64^[email protected]%[email protected] arch=darwin-elcapitan-x86_64

^[email protected]%[email protected] arch=darwin-elcapitan-x86_64^[email protected]%[email protected]~stat_dysect arch=darwin-elcapitan-x86_64

^libdwarf@20160507%[email protected] arch=darwin-elcapitan-x86_64^[email protected]%[email protected] arch=darwin-elcapitan-x86_64

Page 32: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606432Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Spack builds each package in its own compilation environment

SpackProcess

Set up environment

CC = spack/env/spack-cc SPACK_CC = /opt/ic-15.1/bin/iccCXX = spack/env/spack-c++ SPACK_CXX = /opt/ic-15.1/bin/icpcF77 = spack/env/spack-f77 SPACK_F77 = /opt/ic-15.1/bin/ifortFC = spack/env/spack-f90 SPACK_FC = /opt/ic-15.1/bin/ifort

PKG_CONFIG_PATH = ... PATH = spack/env:$PATHCMAKE_PREFIX_PATH = ...LIBRARY_PATH = ...

do_install()

Install dep1 Install dep2 Install package…

Build Process

Fork

install() configure make make install

-I /dep1-prefix/include-L /dep1-prefix/lib-Wl,-rpath=/dep1-prefix/lib

Compiler wrappers (spack-cc, spack-c++, spack-f77, spack-f90)

icc icpc ifort

▪ Forked build process isolates environment for each build.Uses compiler wrappers to:— Add include, lib, and RPATH flags— Ensure that dependencies are found automatically— Load Cray modules (use right compiler/system deps)

Page 33: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606433Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

§ Spack installs each package in its own prefix

§ Some packages need to be installed within directory structure of other packages— i.e., Python modules installed in $prefix/lib/python-<version>/site-packages— Spack supports this via extensions

Extensions and Python Support

class PyNumpy(Package):"""NumPy is the fundamental package for scientific computing with Python."""

homepage = "https://numpy.org"url = "https://pypi.python.org/packages/source/n/numpy/numpy-1.9.1.tar.gz" version('1.9.1', ' 78842b73560ec378142665e712ae4ad9’)

extends('python’)

def install(self, spec, prefix):setup_py("install“, "--prefix={0}".format(prefix))

Page 34: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606434Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

spack/opt/linux-rhel6-x86_64/gcc-4.7.2/python-2.7.12-6y6vvaw/lib/python2.7/site-packages/numpy@

py-numpy-1.10.4-oaxix36/lib/python2.7/site-packages/numpy/

...

Spack extensions

§ Symbolic link to Spack install location

§ Automatically activate for correct version of dependency— Provenance information from DAG— Activate all dependencies that are extensions as well

spack/opt/linux-rhel6-x86_64/gcc-4.7.2/python-2.7.12-6y6vvaw/lib/python2.7/site-packages/..

py-numpy-1.10.4-oaxix36/lib/python2.7/site-packages/numpy/

...

$ spack activate py-numpy @1.10.4

§ Some packages need to be installed within directory structure of other packages

§ Examples of extension packages:— python libraries are a good example— R, Lua, perl— Need to maintain combinatorial versioning

Page 35: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606435Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

packages:mpi:

buildable: Falsepaths:

[email protected] %[email protected] arch=linux-rhel6-ppc64:/path/to/external/gcc/openmpi-2.0.0

[email protected] %[email protected] arch=linux-rhel6-ppc64:/path/to/external/gcc/openmpi-1.10.3

...

[email protected]@4.7.3

arch=linux-redhat6-ppc64

[email protected]@4.7.3

arch=linux-redhat6-ppc64+debug

[email protected]@4.7.3

arch=linux-redhat6-ppc64

[email protected]@4.7.3

arch=linux-redhat6-ppc64

[email protected]@4.7.3

arch=linux-redhat6-ppc64

[email protected]@4.7.3

arch=linux-redhat6-ppc64

[email protected]@4.7.3

arch=linux-redhat6-ppc64

[email protected]@4.7.3

arch=linux-redhat6-ppc64

[email protected]@4.7.3

arch=linux-redhat6-ppc64

[email protected]@4.7.3

arch=linux-redhat6-ppc64

libdwarf@[email protected]

arch=linux-redhat6-ppc64

Building against externally installed software

[email protected]@4.7.3

arch=linux-redhat6-ppc64

[email protected]@4.7.3

arch=linux-redhat6-ppc64+debug

[email protected]@4.7.3

arch=linux-redhat6-ppc64

[email protected]@4.7.3

arch=linux-redhat6-ppc64

[email protected]@4.7.3

arch=linux-redhat6-ppc64

libdwarf@[email protected]

arch=linux-redhat6-ppc64

/path/to/external/gcc/openmpi-2.0.0

packages.yaml

Users register external packages in a configuration file (more on these later). Spack prunes the DAG when adding external packages.

mpileaks ^[email protected]+debug ^openmpi ^[email protected]

Page 36: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606436Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

$ spack repo create /path/to/my_repo$ spack repo add my_repo$ spack repo list==> 2 package repositories.my_repo /path/to/my_repobuiltin spack/var/spack/repos/builtin

Spack package repositories

spack/var/spack/repos/builtin

“standard” packages in the spack mainline.

my_repoproprietary packages, pathological builds

§ Spack supports external package repositories— Separate directories of package recipes

§ Many reasons to use this:— Some packages can’t be released publicly— Some sites require bizarre custom builds— Override default packages with site-

specific versions

§ Packages are composable:— External repositories can be layered on

top of the built-in packages— Custom packages can depend on built-in

packages (or packages in other repos)

Page 37: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606437Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Spack mirrors

§ Spack allows you to define mirrors:§ Directories in the filesystem§ On a web server§ In an S3 bucket

§ Mirrors are archives of fetched tarballs, repositories, and other resources needed to build§ Can also contain binary packages

§ By default, Spack maintains a mirror in var/spack/cache of everything you’ve fetched so far.

§ You can host mirrors internal to your site§ See the documentation for more details

Spackusers

Local cache

Shared FS

S3 Bucket

Original sourceon internet

Page 38: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606438Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Hands-on Time: Configuration

Follow script at spack-tutorial.readthedocs.io

Page 39: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606439Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Making your own Spack Packages

Page 40: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606440Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Hands-on Time: Creating Packages

Follow script at spack-tutorial.readthedocs.io

Page 41: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606441Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Day 2Spack Review

Page 42: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606442Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

§ Each expression is a spec for a particular configuration— Each clause adds a constraint to the spec— Constraints are optional – specify only what you need.— Customize install on the command line!

§ Spec syntax is recursive— Full control over the combinatorial build space

Spack provides a spec syntax to describe customized DAG configurations

$ spack install mpileaks unconstrained$ spack install [email protected] @ custom version$ spack install [email protected] %[email protected] % custom compiler$ spack install [email protected] %[email protected] +threads +/- build option$ spack install [email protected] cppflags="-O3 –g3" set compiler flags$ spack install [email protected] target=skylake set target microarchitecture$ spack install [email protected] ^[email protected] %[email protected] ^ dependency information

Page 43: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606443Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Spack packages are templatesThey use a simple Python DSL to define how to build

Metadata at the class level

Versions

Install logicin instance methods

Dependencies(note: same spec syntax)

Not shown: patches, resources, conflicts, other directives.

from spack import *

class Kripke(CMakePackage):"""Kripke is a simple, scalable, 3D Sn deterministic particle

transport proxy/mini app."""

homepage = "https://computation.llnl.gov/projects/co-design/kripke"url = "https://computation.llnl.gov/projects/co-design/download/kripke-openmp-1.1.tar.gz"

version(‘1.2.3’, sha256='3f7f2eef0d1ba5825780d626741eb0b3f026a096048d7ec4794d2a7dfbe2b8a6’)version(‘1.2.2’, sha256='eaf9ddf562416974157b34d00c3a1c880fc5296fce2aa2efa039a86e0976f3a3’)version('1.1’, sha256='232d74072fc7b848fa2adc8a1bc839ae8fb5f96d50224186601f55554a25f64a’)

variant('mpi', default=True, description='Build with MPI.’)variant('openmp', default=True, description='Build with OpenMP enabled.’)

depends_on('mpi', when='+mpi’)depends_on('[email protected]:', type='build’)

def cmake_args(self):return [

'-DENABLE_OPENMP=%s’ % ('+openmp’ in self.spec),'-DENABLE_MPI=%s' % ('+mpi’ in self.spec),

]

def install(self, spec, prefix):# Kripke does not provide install target, so we have to copy# things into place.mkdirp(prefix.bin)install('../spack-build/kripke', prefix.bin)

Base package(CMake support)

Variants (build options)

Don’t typically need install() for CMakePackage, but we can work around codes that don’t have it.

Page 44: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606444Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

§ Each unique dependency graph is a unique configuration.

§ Each configuration installed in a unique directory.— Configurations of the same package can coexist.

§ Hash of entire directed acyclic graph (DAG) is appended to each prefix.

§ Installed packages automatically find dependencies— Spack embeds RPATHs in binaries.— No need to use modules or set LD_LIBRARY_PATH— Things work the way you built them

Spack handles combinatorial software complexity.

spack/opt/linux-x86_64/

gcc-4.7.2/mpileaks-1.1-0f54bf34cadk/

intel-14.1/hdf5-1.8.15-lkf14aq3nqiz/

bgq/xl-12.1/

hdf5-1-8.16-fqb3a15abrwx/...

mpileaks

mpi

callpath dyninst

libdwarf

libelf

Installation Layout

Dependency DAG

Hash

Page 45: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606445Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Concretization fills in missing configuration detailswhen the user is not explicit.

mpileaks ^[email protected]+debug ^[email protected] User input: abstract spec with some constraints

Concrete spec is fully constrainedand can be passed to install.

[email protected]%[email protected]=linux-ppc64

[email protected]%[email protected]=linux-ppc64

[email protected]%[email protected]+debug

=linux-ppc64

[email protected]%[email protected]=linux-ppc64

[email protected]%[email protected]=linux-ppc64

libdwarf@20130729%[email protected]=linux-ppc64

Abstract, normalized specwith some dependencies.

mpileaks

mpi

[email protected]+debug

dyninst

[email protected]

libdwarf

Norm

alize

Concretize Store

spec:- mpileaks:

arch: linux-x86_64compiler:name: gccversion: 4.9.2

dependencies:adept-utils: kszrtkpbzac3ss2ixcjkcorlaybnptp4callpath: bah5f4h4d2n47mgycej2mtrnrivvxy77mpich: aa4ar6ifj23yijqmdabeakpejcli72t3

hash: 33hjjhxi7p6gyzn5ptgyes7sghyprujhvariants: {} version: '1.0'

- adept-utils:arch: linux-x86_64compiler:name: gccversion: 4.9.2

dependencies:boost: teesjv7ehpe5ksspjim5dk43a7qnowlqmpich: aa4ar6ifj23yijqmdabeakpejcli72t3

hash: kszrtkpbzac3ss2ixcjkcorlaybnptp4variants: {} version: 1.0.1

- boost:arch: linux-x86_64compiler:name: gccversion: 4.9.2

dependencies: {} hash: teesjv7ehpe5ksspjim5dk43a7qnowlqvariants: {} version: 1.59.0

...

spec.yaml

Detailed provenance is storedwith the installed package

Page 46: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606446Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Use `spack spec` to see the results of concretization

$ spack spec mpileaksInput spec------------------------------mpileaks

[email protected]%[email protected] arch=darwin-elcapitan-x86_64

^[email protected]%[email protected] arch=darwin-elcapitan-x86_64^[email protected]%[email protected]+atomic+chrono+date_time~debug+filesystem~graph~icu_support+iostreams+locale+log+math~mpi+multithreaded+program_options~python+random +regex+serialization+shared+signals+singlethreaded+system+test+thread+timer+wave arch=darwin-elcapitan-x86_64

^[email protected]%[email protected] arch=darwin-elcapitan-x86_64^[email protected]%[email protected] arch=darwin-elcapitan-x86_64

^[email protected]%[email protected]~mxm~pmi~psm~psm2~slurm~sqlite3~thread_multiple~tm~verbs+vt arch=darwin-elcapitan-x86_64^[email protected]%[email protected] arch=darwin-elcapitan-x86_64

^[email protected]%[email protected] arch=darwin-elcapitan-x86_64^[email protected]%[email protected] arch=darwin-elcapitan-x86_64

^[email protected]%[email protected]+sigsegv arch=darwin-elcapitan-x86_64^[email protected]%[email protected] arch=darwin-elcapitan-x86_64

^[email protected]%[email protected] arch=darwin-elcapitan-x86_64^[email protected]%[email protected]~stat_dysect arch=darwin-elcapitan-x86_64

^libdwarf@20160507%[email protected] arch=darwin-elcapitan-x86_64^[email protected]%[email protected] arch=darwin-elcapitan-x86_64

Page 47: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606447Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Spack builds each package in its own compilation environment

SpackProcess

Set up environment

CC = spack/env/spack-cc SPACK_CC = /opt/ic-15.1/bin/iccCXX = spack/env/spack-c++ SPACK_CXX = /opt/ic-15.1/bin/icpcF77 = spack/env/spack-f77 SPACK_F77 = /opt/ic-15.1/bin/ifortFC = spack/env/spack-f90 SPACK_FC = /opt/ic-15.1/bin/ifort

PKG_CONFIG_PATH = ... PATH = spack/env:$PATHCMAKE_PREFIX_PATH = ...LIBRARY_PATH = ...

do_install()

Install dep1 Install dep2 Install package…

Build Process

Fork

install() configure make make install

-I /dep1-prefix/include-L /dep1-prefix/lib-Wl,-rpath=/dep1-prefix/lib

Compiler wrappers (spack-cc, spack-c++, spack-f77, spack-f90)

icc icpc ifort

▪ Forked build process isolates environment for each build.Uses compiler wrappers to:— Add include, lib, and RPATH flags— Ensure that dependencies are found automatically— Load Cray modules (use right compiler/system deps)

Page 48: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606448Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Hands-on Time: Environment Modules

Follow script at spack-tutorial.readthedocs.io

Page 49: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606449Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Environments, spack.yaml and spack.lock

Follow script at spack-tutorial.readthedocs.io

Page 50: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606450Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Spack Stacks

Follow script at spack-tutorial.readthedocs.io

Page 51: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606451Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Developer Workflows

Follow script at spack-tutorial.readthedocs.io

Page 52: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606452Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Scripting and spack-python

Follow script at spack-tutorial.readthedocs.io

Page 53: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606453Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

More New Featuresand the Road Ahead

Page 54: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606454Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

§ We have developed a cross-platform library to detect and compare microarchitecture metadata— Detects based on /proc/cpuinfo (Linux), sysctl (Mac)— Allows comparisons for compatibility, e.g.:

§ Key features:— Know which compilers support which chips/which flags— Determine compatibility— Enable creation and reuse of optimized binary packages— Easily query available architecture features for portable

build recipes

§ We will be extracting this as a standalone library for other tools & languages— Hope to make this standard!

Spack now understands specific target microarchitectures

$ spack install lbann target=cascadelake

$ spack install petsc target=zen2

Specialized installationsSimple feature query

Extensive microarchitecture knowledge

skylake > broadwellzen2 > x86_64

Page 55: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606455Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Archspec: a library for reasoning about microarchitectures

ReadTheDocs: archspec.rtfd.io

github.com/archspec

archspec

License: Apache 2.0 OR MIT

pip3 install archspec

▪ Standalone library, extracted from Spack

▪ Use fine-grained, human-readable labels, e.g.:— broadwell, haswell, skylake— instead of x86_64, aarch64, ppc64 etc.

▪ Query capabilities— “Does haswell support AVX-512?” “no.”

▪ Query compiler flags— “How do I compile for broadwell with icc?”

▪ Python package for now, but we want more bindings!— Actual data is in a common JSON file w/schema

Page 56: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606456Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

Generate container images from environments (0.14)

spack containerize

▪ Any Spack environment can be bundled into a container image

— Optional container section allows finer-grained customization

▪ Generated Dockerfile uses multi-stage builds to minimize size of final image

— Strips binaries— Removes unneeded build deps

with spack gc

▪ Can also generate Singularity recipes

Page 57: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606457Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

§ User adds a gitlab-ci section to environment— Spack maps builds to GitLab runners— Generate gitlab-ci.yml with spack ci command

§ Can run in a Kube cluster or on bare metal at an HPC site— Sends progress to CDash

Spack can generate CI Pipelinesfrom environments

spack ci

Page 58: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606458Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

§ Spack has has compiler detection for a while— Finds compilers in your PATH— Registers them for use

§ We can find any package now— Package defines:

• possible command names• how to query the command

— Spack searches for known commands and adds them to configuration

§ Community can easily enable tools to be set up rapidly

spack external find

Logic for finding externalinstallations in package.py

packages.yamlconfiguration

Page 59: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606459Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

§ Spack has long been vulnerable to unreliably hosted code— Outages at large sites like Sourceforge or GNU

would leave Spack essentially down too.— Outages have been known to persist for long

periods of time (GNU).

§ Spack now has a dedicated S3 bucket with all sources, patches, and other resources needed to build— This is the first place we’ll download things now

§ If other sites go down, Spack is still in business.

Spack 0.15.1 introduced a source code mirror for all packages

Page 60: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606460Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

`

We are testing our development branch and our release brancheswith ECP’s E4S software stack

E4S spack.yamlconfiguration

GitLab CI builds (changed) packages• On every pull request• On every release branch

• E4S is about 250 packages – will eventually include all ECP software products– We’ve started with E4S built for CentOS6, CentOS7, Ubuntu18– Will start expanding to include more packages from Spack, ECP facility platforms, more instances

• More on E4S at https://e4s.io

spack ci

Spack Contributionson GitHub

gitlab.spack.io

Page 61: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606461Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

§ Sharing a Spack instance— Many users want to be able to install Spack on a cluster and `module load spack`— Installations in the Spack prefix are shared among users— Users would spack install to their home directory by default.— This requires us to move most state out of the Spack prefix

• Installations would go into ~/.spack/…

§ Getting rid of configuration in ~/.spack— While installations may move to the home directory, configuration there is causing issues— User configuration is like an unwanted global (e.g., LD_LIBRARY_PATH 😬)

• Interferes with CI builds (many users will rm -rf ~/.spack to avoid it)• Goes against a lot of our efforts for reproducibility• Hard to manage this configuration between multiple machines

— Environments are a much better fit• Make users keep configuration like this in an environment instead of a single config

Spack 0.16 Roadmap: permissions and directory structure

Page 62: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606462Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

§ We need deeper modeling of compilers to handle complex ABI issues— libstdc++, libc++ compatibility— Compilers that depend on compilers

§ Future GPU, OpenMP target, etc. libraries have similar issues— Entire stack for a large code needs to be consistent— We currently do not have visibility into what’s under

the compiler

§ Packages that depend on languages— Depend on cxx@2011, cxx@2017, fortran@1995, etc.— Model langauges, openmp, cuda, etc. as virtuals

Spack 0.16 roadmap: compilers as dependencies

1

intel@17

gcc@xxx

B

R

2

intel@16

B

[email protected]

R

L

Already-installed dep

Compiler-imposed dep

libstdc++

LL

Compilers and runtime libs fully modeledas dependencies

Page 63: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

LLNL-PRES-80606463Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io

§ There are lots of ways to get involved!— Contribute packages, documentation, or features at github.com/spack/spack— Contribute your configurations to github.com/spack/spack-configs

§ Talk to us!— Join our Google Group (see GitHub repo for info)— Join our Slack channel (see GitHub repo for info)— Submit GitHub issues and talk to us!

Join the Spack community!

@spackpm

We hope to make distributing & using HPC software easy!

github.com/spack/spackStar us on GitHub! Follow us on Twitter!

Page 64: SpackTutorial on AWS · Q&A on Slack: spackpm.herokuapp.com Tutorial materials: spack-tutorial.readthedocs.io 10 People who want to use or distribute software for HPC! 1. End Users

DisclaimerThis document was prepared as an account of work sponsored by an agency of the United States government. Neither the United States government nor Lawrence Livermore National Security, LLC, nor any of their employees makes any warranty, expressed or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately owned rights. Reference herein to any specific commercial product, process, or service by trade name, trademark, manufacturer, or otherwise does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States government or Lawrence Livermore National Security, LLC. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States government or Lawrence Livermore National Security, LLC, and shall not be used for advertising or product endorsement purposes.