Skip to content

Building with Spack

Paul Kuberry edited this page Mar 8, 2021 · 3 revisions

If you would like to use Spack to build Compadre, it is as simple as (assuming you have your spack environment setup correctly):

Generic:

spack install compadre ^kokkos+{parallellism} ^kokkos-kernels

where {parallelism} is replaced by pthread, openmp, or cuda.

For mac with pthreads:

spack install compadre ^kokkos+pthread ^kokkos-kernels

For linux with openmp:

spack install compadre%gcc ^kokkos+openmp ^kokkos-kernels

If using Cuda in Kokkos, you'll also need to set the architecture as well as use kokkos-nvcc-wrapper with something like:

spack install compadre%gcc@7.2.0 ^kokkos@master +cuda +cuda_lambda +wrapper cuda_arch=60 ^kokkos-kernels@master ^kokkos-nvcc-wrapper@master

The @master in the last example indicates to spack that you want the versions of these packages from the master branch of their respective git repos.

Notes to speed things along:

If you are on some machine that uses modules, like module avail [packagename], then it is possible to use these modules within spack. https://spack.readthedocs.io/en/latest/build_settings.html#external-packages

Here is an example ~/.spack/packages.yaml:

packages:
  cuda:
    buildable: false
    externals:
    - spec: cuda@10.2.88
      modules:
      - 'cuda/9.2.88'
  cmake:
    buildable: false
    externals:
    - spec: cmake@3.17
      prefix: /ascldap/users/pakuber/anaconda3/envs/mypy
    - spec: cmake@3.18
      modules:
      - 'cmake/3.18.0'
  openmpi:
    buildable: false
    externals:
    - spec: openmpi@3.1.0
      modules:
      - 'openmpi/3.1.0/gcc/7.2.0/cuda/9.2.88'