title | layout | toc | author_profile |
---|---|---|---|
About Spack |
single |
true |
false |
Spack is a package manager for supercomputers, Linux, and macOS. It makes installing scientific software easy. With Spack, you can build a package with multiple versions, configurations, platforms, and compilers, and all of these builds can coexist on the same machine.
Spack isn't tied to a particular language; you can build a software stack in Python or R, link to libraries written in C, C++, or Fortran, easily swap compilers, and target specific microarchitectures. Use Spack to install without root in your home directory, to manage shared installations and modules, or to build combinatorial versions of software for testing.
Clone Spack from GitHub and you're ready to go:
{% highlight console %} git clone https://github.com/spack/spack.git . spack/share/spack/setup-env.sh spack install hdf5 {% endhighlight %}
The installation of Spack can be customized in a variety of ways. Users can specify the package version, compiler, compile-time options, and even cross-compile platform, all from the command line.
{% highlight bash %}
$ spack install [email protected]
$ spack install [email protected] %[email protected]
$ spack install [email protected] %[email protected] +szip
$ spack install [email protected] %[email protected] cppflags="-O3 -floop-block"
$ spack install [email protected] target=backend {% endhighlight %}
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.
Spack allows dependencies of particular installations to be customized
extensively. Suppose that hdf5
depends on openmpi
and indirectly on
hwloc
. Using ^
, users can add custom configurations for dependencies:
{% highlight bash %}
$ spack install [email protected] %[email protected] +debug ^openmpi+cuda fabrics=auto ^hwloc+gl {% endhighlight %}
Spack installs every unique package/dependency configuration into its own prefix, so new installs will not break existing ones.
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.
Spack packages are simple Python scripts. The
spack create
command will generate boilerplate to get you started, and you can create a
package in a matter of minutes. You write the build instructions; Spack builds
the dependencies for you.
{% highlight python %} from spack import *
class Kripke(Package): """Kripke is a simple, scalable, 3D Sn deterministic particle transport proxy/mini app. """ homepage = "https://computing.llnl.gov/projects/co-design/kripke" url = "https://computing.llnl.gov/downloads/kripke-openmp-1.1.tar.gz"
version('1.1', '7fe6f2b26ed983a6ce5495ab701f85bf')
variant('mpi', default=True, description='Build with MPI.')
variant('openmp', default=True, description='Build with OpenMP enabled.')
depends_on('mpi', when="+mpi")
def install(self, spec, prefix):
with working_dir('build', create=True):
cmake('-DCMAKE_INSTALL_PREFIX:PATH=.',
'-DENABLE_OPENMP=%s' % ('+openmp' in spec),
'-DENABLE_MPI=%s' % ('+mpi' in spec),
'..',
*std_cmake_args)
make()
mkdirp(prefix.bin)
install('kripke', prefix.bin)
{% endhighlight %}
Visit Spack on GitHub and take the tutorial. Join the discussion on the GoogleGroup, and learn how to contribute your own packages. Check out the Upcoming Events page for tutorials, workshops, BoFs, etc.