Spack Example - Gromacs#

The trick to spack is realizing that spack compiles software with multiple variables.

+variant <- built with variant
~variant <- build without variant

Gromacs is installed via spack, and there are multiple variants that you will use depending on the scenario.

[1]:
spack find -l -v gromacs
-- linux-amzn2-x86_64_v3 / gcc@7.3.1 ----------------------------
pxsw7er gromacs@2021~blas~cp2k~cuda~cycle_subcounters~double+hwloc~ipo~lapack~mdrun_only+mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
xrwhukf gromacs@2021~blas~cp2k+cuda~cycle_subcounters~double+hwloc~ipo~lapack~mdrun_only~mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
h6qe4ag gromacs@2021+blas~cp2k~cuda~cycle_subcounters~double+hwloc~ipo+lapack~mdrun_only+mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
hwzyc7f gromacs@2022~blas~cp2k~cuda~cycle_subcounters~double+hwloc~ipo~lapack~mdrun_only+mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
eyjhnmz gromacs@2022~blas~cp2k+cuda~cycle_subcounters~double+hwloc~ipo~lapack~mdrun_only~mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
n3nfmby gromacs@2022~blas~cp2k+cuda~cycle_subcounters~double+hwloc~ipo~lapack~mdrun_only+mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
4ggo354 gromacs@2022+blas~cp2k~cuda~cycle_subcounters~double+hwloc~ipo+lapack~mdrun_only+mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
==> 7 installed packages

Gromacs + GPU#

[2]:
spack find -l -v gromacs+cuda
-- linux-amzn2-x86_64_v3 / gcc@7.3.1 ----------------------------
xrwhukf gromacs@2021~blas~cp2k+cuda~cycle_subcounters~double+hwloc~ipo~lapack~mdrun_only~mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
eyjhnmz gromacs@2022~blas~cp2k+cuda~cycle_subcounters~double+hwloc~ipo~lapack~mdrun_only~mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
n3nfmby gromacs@2022~blas~cp2k+cuda~cycle_subcounters~double+hwloc~ipo~lapack~mdrun_only+mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
==> 3 installed packages

Gromacs + Other Variant Combinations#

[3]:
spack find -l -v gromacs~cuda
-- linux-amzn2-x86_64_v3 / gcc@7.3.1 ----------------------------
pxsw7er gromacs@2021~blas~cp2k~cuda~cycle_subcounters~double+hwloc~ipo~lapack~mdrun_only+mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
h6qe4ag gromacs@2021+blas~cp2k~cuda~cycle_subcounters~double+hwloc~ipo+lapack~mdrun_only+mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
hwzyc7f gromacs@2022~blas~cp2k~cuda~cycle_subcounters~double+hwloc~ipo~lapack~mdrun_only+mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
4ggo354 gromacs@2022+blas~cp2k~cuda~cycle_subcounters~double+hwloc~ipo+lapack~mdrun_only+mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
==> 4 installed packages
[4]:
spack find -l -v gromacs+mpi
-- linux-amzn2-x86_64_v3 / gcc@7.3.1 ----------------------------
pxsw7er gromacs@2021~blas~cp2k~cuda~cycle_subcounters~double+hwloc~ipo~lapack~mdrun_only+mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
h6qe4ag gromacs@2021+blas~cp2k~cuda~cycle_subcounters~double+hwloc~ipo+lapack~mdrun_only+mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
hwzyc7f gromacs@2022~blas~cp2k~cuda~cycle_subcounters~double+hwloc~ipo~lapack~mdrun_only+mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
n3nfmby gromacs@2022~blas~cp2k+cuda~cycle_subcounters~double+hwloc~ipo~lapack~mdrun_only+mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
4ggo354 gromacs@2022+blas~cp2k~cuda~cycle_subcounters~double+hwloc~ipo+lapack~mdrun_only+mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
==> 5 installed packages
[5]:
spack find -l -v gromacs~mpi
-- linux-amzn2-x86_64_v3 / gcc@7.3.1 ----------------------------
xrwhukf gromacs@2021~blas~cp2k+cuda~cycle_subcounters~double+hwloc~ipo~lapack~mdrun_only~mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
eyjhnmz gromacs@2022~blas~cp2k+cuda~cycle_subcounters~double+hwloc~ipo~lapack~mdrun_only~mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
==> 2 installed packages
[6]:
spack find -l -v gromacs@2022+cuda+mpi
-- linux-amzn2-x86_64_v3 / gcc@7.3.1 ----------------------------
n3nfmby gromacs@2022~blas~cp2k+cuda~cycle_subcounters~double+hwloc~ipo~lapack~mdrun_only+mpi~nosuffix~opencl+openmp~plumed~relaxed_double_precision+shared~sycl build_system=cmake build_type=RelWithDebInfo
==> 1 installed package

The hash in the first column is the unique identifier.

[7]:
# load gromacs + mpi
spack load gromacs@2022+mpi+cuda
[8]:
which gmx_mpi
/apps/spack/0.19.0/opt/spack/linux-amzn2-x86_64_v3/gcc-7.3.1/gromacs-2022-n3nfmbygz2rfkwlv2idaqfut7rwbyl6u/bin/gmx_mpi
[9]:
spack load gromacs@2022~mpi+cuda
[10]:
which gmx
/apps/spack/0.19.0/opt/spack/linux-amzn2-x86_64_v3/gcc-7.3.1/gromacs-2022-eyjhnmzplx6yjwwzd23amr55ruwcbmvu/bin/gmx
[11]:
spack unload