Spack Documentation Release 0.9
Total Page:16
File Type:pdf, Size:1020Kb
Spack Documentation Release 0.9 Todd Gamblin August 31, 2016 Contents 1 Table of Contents 3 1.1 Feature overview.............................................3 1.2 Getting Started..............................................5 1.3 Basic usage................................................6 1.4 Packaging Guide............................................. 40 1.5 Mirrors.................................................. 80 1.6 Configuration............................................... 83 1.7 Developer Guide............................................. 86 1.8 Using Spack for CMake-based Development.............................. 90 1.9 Command index............................................. 92 1.10 Package List............................................... 93 1.11 spack package.............................................. 335 2 Indices and tables 453 Python Module Index 455 i ii Spack Documentation, Release 0.9 Spack is a package management tool designed to support multiple versions and configurations of software on a wide variety of platforms and environments. It was designed for large supercomputing centers, where many users and application teams share common installations of software on clusters with exotic architectures, using libraries that do not have a standard ABI. Spack is non-destructive: installing a new version does not break existing installations, so many configurations can coexist on the same system. Most importantly, Spack is simple. It offers a simple spec syntax so that users can specify versions and configuration options concisely. Spack is also simple for package authors: package files are written in pure Python, and specs allow package authors to maintain a single file for many different builds of the same package. See the Feature overview for examples and highlights. Get spack from the github repository and install your first package: $ git clone https://github.com/llnl/spack.git $ cd spack/bin $ ./spack install libelf If you’re new to spack and want to start using it, see Getting Started, or refer to the full manual below. Contents 1 Spack Documentation, Release 0.9 2 Contents CHAPTER 1 Table of Contents 1.1 Feature overview This is a high-level overview of features that make Spack different from other package managers and port systems. 1.1.1 Simple package installation Installing the default version of a package is simple. This will install the latest version of the mpileaks package and all of its dependencies: $ spack install mpileaks 1.1.2 Custom versions & configurations Spack allows installation to be customized. Users can specify the version, build compiler, compile-time options, and cross-compile platform, all on the command line. # Install a particular version by appending @ $ spack install [email protected] # Specify a compiler(and its version), with % $ spack install [email protected] %[email protected] # Add special compile-time options by name $ spack install [email protected] %[email protected] debug=True # Add special boolean compile-time options with + $ spack install [email protected] %[email protected] +debug # Add compiler flags using the conventional names $ spack install [email protected] %[email protected] cppflags=\"-O3 -floop-block\" # Cross-compile for a different architecture with arch= $ spack install [email protected] arch=bgqos_0 Users can specify as many or few options as they care about. Spack will fill in the unspecified values with sensible defaults. The two listed syntaxes for variants are identical when the value is boolean. 3 Spack Documentation, Release 0.9 1.1.3 Customize dependencies Spack allows dependencies of a particular installation to be customized extensively. Suppose that mpileaks depends indirectly on libelf and libdwarf. Using ^, users can add custom configurations for the dependencies: # Install mpileaks and link it with specific versions of libelf and libdwarf $ spack install [email protected] %[email protected] +debug ^[email protected] ^libdwarf@20130729+debug 1.1.4 Non-destructive installs Spack installs every unique package/dependency configuration into its own prefix, so new installs will not break existing ones. 1.1.5 Packages can peacefully coexist Spack avoids library misconfiguration by using RPATH to link dependencies. When a user links a library or runs a program, it is tied to the dependencies it was built with, so there is no need to manipulate LD_LIBRARY_PATH at runtime. 1.1.6 Creating packages is easy To create a new packages, all Spack needs is a URL for the source archive. The spack create command will create a boilerplate package file, and the package authors can fill in specific build steps in pure Python. For example, this command: $ spack create http://www.mr511.de/software/libelf-0.8.13.tar.gz creates a simple python file: from spack import * class Libelf(Package): """FIXME: Put a proper description of your package here.""" # FIXME: Add a proper url for your package's homepage here. homepage="http://www.example.com" url="http://www.mr511.de/software/libelf-0.8.13.tar.gz" version('0.8.13','4136d7b4c04df68b686570afa26988ac') # FIXME: Add dependencies if required. # depends_on('foo') def install(self, spec, prefix): # FIXME: Modify the configure line to suit your build system here. configure('--prefix={0}'.format(prefix)) # FIXME: Add logic to build and install here. make() make('install') It doesn’t take much python coding to get from there to a working package: 4 Chapter 1. Table of Contents Spack Documentation, Release 0.9 from spack import * class Libelf(Package): """libelf lets you read, modify or create ELF object files in an architecture-independent way. The library takes care of size and endian issues, e.g. you can process a file for SPARC processors on an Intel-based system.""" homepage="http://www.mr511.de/software/english.html" url="http://www.mr511.de/software/libelf-0.8.13.tar.gz" version('0.8.13','4136d7b4c04df68b686570afa26988ac') version('0.8.12','e21f8273d9f5f6d43a59878dc274fec7') provides('elf') def install(self, spec, prefix): configure("--prefix="+ prefix, "--enable-shared", "--disable-dependency-tracking", "--disable-debug") make() # The mkdir commands in libelf's install can fail in parallel make("install", parallel=False) Spack also provides wrapper functions around common commands like configure, make, and cmake to make writing packages simple. 1.2 Getting Started 1.2.1 Download Getting spack is easy. You can clone it from the github repository using this command: $ git clone https://github.com/llnl/spack.git This will create a directory called spack. We’ll assume that the full path to this directory is in the SPACK_ROOT environment variable. Add $SPACK_ROOT/bin to your path and you’re ready to go: $ export PATH=$SPACK_ROOT/bin:$PATH $ spack install libelf For a richer experience, use Spack’s shell support: # For bash users $ export SPACK_ROOT=/path/to/spack $ . $SPACK_ROOT/share/spack/setup-env.sh # For tcsh or csh users(note you must set SPACK_ROOT) $ setenv SPACK_ROOT /path/to/spack $ source $SPACK_ROOT/share/spack/setup-env.csh This automatically adds Spack to your PATH. 1.2. Getting Started 5 Spack Documentation, Release 0.9 1.2.2 Installation You don’t need to install Spack; it’s ready to run as soon as you clone it from git. You may want to run it out of a prefix other than the git repository you cloned. The spack bootstrap command provides this functionality. To install spack in a new directory, simply type: $ spack bootstrap /my/favorite/prefix This will install a new spack script in /my/favorite/prefix/bin, which you can use just like you would the regular spack script. Each copy of spack installs packages into its own $PREFIX/opt directory. 1.3 Basic usage The spack command has many subcommands. You’ll only need a small subset of them for typical usage. Note that Spack colorizes output. less -R should be used with Spack to maintain this colorization. E.g.: $ spack find | less -R It is recommend that the following be put in your .bashrc file: alias less='less -R' 1.3.1 Listing available packages To install software with Spack, you need to know what software is available. You can see a list of available package names at the Package List webpage, or using the spack list command. spack list The spack list command prints out a list of all of the packages Spack can install: $ spack list ack llvm qrupdate activeharmony llvm-lld qt adept-utils lmdb qt-creator adios lmod qthreads adol-c lrslib R allinea-forge lrzip r-abind allinea-reports lua r-assertthat antlr lua-luafilesystem r-base64enc ape lua-luaposix r-bh apex LuaJIT r-BiocGenerics apr lwgrp r-boot apr-util lwm2 r-brew armadillo lz4 r-car arpack lzma r-caret arpack-ng lzo r-chron asciidoc m4 r-class astyle mafft r-cluster atk mariadb r-codetools atlas matio r-colorspace atop mbedtls r-crayon autoconf meep r-cubature 6 Chapter 1. Table of Contents Spack Documentation, Release 0.9 automaded memaxes r-curl automake mercurial r-datatable bash mesa r-dbi bbcp metis r-devtools bcftools mfem r-diagrammer bdw-gc Mitos r-dichromat bear mkl r-digest bertini moab r-doparallel bib2xhtml mpc r-dplyr binutils mpe2 r-dt bison mpfr r-dygraphs bliss mpibash r-e1071 blitz mpich r-filehash boost mpileaks r-foreach bowtie2 mrnet r-foreign boxlib msgpack-c r-gdata bpp-core mumps r-geosphere bpp-phyl munge r-ggmap bpp-seq muparser r-ggplot2 bpp-suite muster r-ggvis bwa mvapich2 r-git2r bzip2 mxml r-glmnet c-blosc nag r-googlevis cairo nano r-gridbase caliper nasm r-gridextra callpath nauty r-gtable cantera nccmp r-gtools cask ncdu r-htmltools cblas nco r-htmlwidgets cbtf ncurses r-httpuv cbtf-argonavis ncview r-httr cbtf-krell ndiff r-igraph cbtf-lanl netcdf r-influencer cdd netcdf-cxx r-inline cddlib netcdf-cxx4 r-irlba cdo netcdf-fortran r-iterators cereal netgauge r-jpeg cfitsio netlib-lapack r-jsonlite cgal netlib-scalapack r-labeling cgm nettle r-lattice cgns nextflow r-lazyeval cityhash ninja r-leaflet cleverleaf numdiff r-lme4 cloog nwchem r-lmtest cmake ocaml r-lubridate cmocka oce r-magic cnmem octave r-magrittr coreutils octave-splines r-mapproj cp2k octopus r-maps cppcheck ompss r-maptools cram ompt-openmp r-markdown cryptopp opari2 r-mass cscope openblas r-matrix cube opencoarrays r-matrixmodels cuda opencv r-memoise curl openexr r-mgcv czmq openjpeg r-mime daal openmpi r-minqa 1.3.