Skip to content

Installing a personal version of LAMMPS

Another very popular application on Apocrita is LAMMPS, but as with Gromacs, we only provide modules for fairly simple compilation variants. Some more advanced users may want to compile additional personal versions with more granular compilation options.

Searching for available variants

So, as before, let's see what is on offer by default:

spack find output
$ spack -C ${HOME}/spack-config-templates/1.1.1 find -x -p -v lammps
-- linux-rocky9-x86_64_v4 / no compilers ------------------------
lammps@20230802.3~adios~amoeba~asphere~atc~awpmd~bocs~body~bpm~brownian~cg-dna~cg-spica~class2~colloid~colvars~compress~coreshell~cuda~cuda_mps~dielectric~diffraction~dipole~dpd-basic~dpd-meso~dpd-react~dpd-smooth~drude~eff~electrode~extra-compute~extra-dump~extra-fix~extra-molecule~extra-pair~fep~ffmpeg~granular~h5md~intel~interlayer~ipo~jpeg~kim~kokkos+kspace~latboltz~lepton+lib~machdyn~manifold+manybody~mc~meam~mesont~mgpt~misc~ml-hdnnp~ml-iap~ml-pod~ml-rann~ml-snap~mofff+molecule~molfile+mpi~netcdf~opencl+openmp~openmp-package~opt~orient~peri~phonon~plugin~plumed~png~poems~ptm~python~qeq~qtb~reaction~reaxff~replica+rigid~rocm~shock~smtbq~sph~spin~srd~tally~uef~voronoi~vtk~yaff build_system=cmake build_type=Release fftw_precision=double generator=make gpu_precision=mixed lammps_sizes=smallbig                      /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/lammps/20230802.3-openmpi-5.0.3-b27kssh
lammps@20230802.3~adios~amoeba~asphere~atc~awpmd~bocs~body~bpm~brownian~cg-dna~cg-spica~class2~colloid~colvars~compress~coreshell+cuda~cuda_mps~dielectric~diffraction~dipole~dpd-basic~dpd-meso~dpd-react~dpd-smooth~drude~eff~electrode~extra-compute~extra-dump~extra-fix~extra-molecule~extra-pair~fep~ffmpeg~granular~h5md~intel~interlayer~ipo~jpeg~kim~kokkos+kspace~latboltz~lepton+lib~machdyn~manifold+manybody~mc~meam~mesont~mgpt~misc~ml-hdnnp~ml-iap~ml-pod~ml-rann~ml-snap~mofff+molecule~molfile+mpi~netcdf~opencl+openmp~openmp-package~opt~orient~peri~phonon~plugin~plumed~png~poems~ptm~python~qeq~qtb~reaction~reaxff~replica+rigid~rocm~shock~smtbq~sph~spin~srd~tally~uef~voronoi~vtk~yaff build_system=cmake build_type=Release cuda_arch:=70,80,90 fftw_precision=double generator=make gpu_precision=mixed lammps_sizes=smallbig  /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/lammps/20230802.3-openmpi-5.0.3-zqtg4sr
==> 2 installed packages

As with Gromacs, the output of spack find includes an incredibly long list of variants, either marked with ~ (false) or + (true).

Spack Packages website

Package information is for the develop branch

The Spack Packages website lists information such as versions available, variants etc. from the develop branch of Spack. Some versions and variants may not be available in the specific Spack release you are using.

The Spack Packages page for LAMMPS can be found here:

https://packages.spack.io/package.html?name=lammps

There is a extremely long list of variants (too long to even screenshot here in full), and the defaults (true) or (false) are marked in brackets after each item in the list. For the versions centrally compiled, we have largely stuck to the defaults.

The spack info command

spack info output (click to expand)
$ spack -C ${HOME}/spack-config-templates/1.1.1 info lammps
CMakePackage:   lammps

Description:
    LAMMPS stands for Large-scale Atomic/Molecular Massively Parallel
    Simulator.

Homepage: https://www.lammps.org/

Preferred version:  
    20250722.3    https://github.com/lammps/lammps/archive/stable_22Jul2025_update3.tar.gz

Safe versions:  
    develop       [git] https://github.com/lammps/lammps.git on branch develop
    20260211      https://github.com/lammps/lammps/archive/patch_11Feb2026.tar.gz
    20251210      https://github.com/lammps/lammps/archive/patch_10Dec2025.tar.gz
    20250910      https://github.com/lammps/lammps/archive/patch_10Sep2025.tar.gz
    20250722.3    https://github.com/lammps/lammps/archive/stable_22Jul2025_update3.tar.gz
    20240829.4    https://github.com/lammps/lammps/archive/stable_29Aug2024_update4.tar.gz
    20230802.4    https://github.com/lammps/lammps/archive/stable_2Aug2023_update4.tar.gz
    20220623.4    https://github.com/lammps/lammps/archive/stable_23Jun2022_update4.tar.gz
    20210929.3    https://github.com/lammps/lammps/archive/stable_29Sep2021_update3.tar.gz
    20201029      https://github.com/lammps/lammps/archive/stable_29Oct2020.tar.gz
    20200303      https://github.com/lammps/lammps/archive/stable_3Mar2020.tar.gz

Deprecated versions:  
    20250722.2    https://github.com/lammps/lammps/archive/stable_22Jul2025_update2.tar.gz
    20250722.1    https://github.com/lammps/lammps/archive/stable_22Jul2025_update1.tar.gz
    20250722      https://github.com/lammps/lammps/archive/stable_22Jul2025.tar.gz
    20250612      https://github.com/lammps/lammps/archive/patch_12Jun2025.tar.gz
    20250402      https://github.com/lammps/lammps/archive/patch_2Apr2025.tar.gz
    20250204      https://github.com/lammps/lammps/archive/patch_4Feb2025.tar.gz

Variants:
(etc.)

Installing specific variants

LAMMPS has an enormous number of different variants and accelerators. If you aren't very familiar with LAMMPS in general, it's highly recommended to read this HPC Carpentry tutorial which goes into a great amount of detail about the most popular variants and accelerators.

We can't possibly cover all possible variants, so we'll focus on just two below:

Activate the KOKKOS LAMMPS package

Add a suffix for your private KOKKOS module

By default, the fact that the KOKKOS LAMMPS package has been added won't be reflected in your private module name. We recommend adding:

lammps:
  suffixes:
    +kokkos: kokkos

to the tcl: section of your personal modules.yaml configuration file to help to differentiate. It is already added to the template modules.yaml file in the spack-config-template repository.

Let's look at installing a variant of LAMMPS that activates the KOKKOS package. The default for the kokkos variant is (false) (which appears in the output of Spack commands as ~).

Always run a spec command before install!

You should always check what is about to be installed using the spec command as detailed below and then move onto the install command.

Let's see if we can spec a personal installation of LAMMPS adding in the KOKKOS package:

spack spec output (click to expand)
$ spack -C ${HOME}/spack-config-templates/1.1.1 spec lammps +kokkos ^openmpi ^kokkos@4
 -   lammps@20250722.3~adios~amoeba~asphere~atc~awpmd~bocs~body~bpm~brownian~cg-dna~cg-spica~class2~colloid~colvars~compress~coreshell~cuda~cuda_mps~curl~dielectric~diffraction~dipole~dpd-basic~dpd-meso~dpd-react~dpd-smooth~drude~eff~electrode~extra-command~extra-compute~extra-dump~extra-fix~extra-molecule~extra-pair~fep~ffmpeg~granular~h5md~heffte~intel~interlayer~ipo~jpeg~kim+kokkos+kspace~latboltz~lepton+lib~machdyn~manifold+manybody~mc~mdi~meam~mesont~mgpt~misc~ml-hdnnp~ml-iap~ml-pace~ml-pod~ml-rann~ml-snap~ml-uf3~mofff+molecule~molfile+mpi~netcdf~opencl+openmp~openmp-package~opt~orient~peri~phonon~plugin~plumed~png~poems~ptm~python~qeq~qtb~reaction~reaxff~replica~rheo+rigid~rocm~scafacos~shock~smtbq~sph~spin~srd~tally~tools~uef~voronoi~vtk~yaff build_system=cmake build_type=Release fft=fftw3 fft_kokkos=fftw3 fftw_precision=double generator=make lammps_sizes=smallbig platform=linux os=rocky9 target=x86_64_v4 %c,cxx=gcc@12.2.0
[+]      ^cmake@3.31.11~doc+ncurses+ownlibs~qtgui build_system=generic build_type=Release platform=linux os=rocky9 target=x86_64_v4 %c,cxx=gcc@12.2.0
[^]          ^curl@8.7.1~gssapi~ldap~libidn2~librtmp~libssh~libssh2+nghttp2 build_system=autotools libs:=shared,static tls:=openssl platform=linux os=rocky9 target=x86_64_v4
[^]              ^nghttp2@1.57.0 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                  ^diffutils@3.10 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]              ^openssl@3.3.0~docs+shared build_system=generic certs=mozilla platform=linux os=rocky9 target=x86_64_v4
[^]                  ^ca-certificates-mozilla@2023-05-30 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]              ^perl@5.38.0+cpanm+opcode+open+shared+threads build_system=generic patches:=714e4d1 platform=linux os=rocky9 target=x86_64_v4
[^]                  ^berkeley-db@18.1.40+cxx~docs+stl build_system=autotools patches:=26090f4,b231fcc platform=linux os=rocky9 target=x86_64_v4
[^]                  ^bzip2@1.0.8~debug~pic+shared build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]                  ^gdbm@1.23 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                      ^readline@8.2 build_system=autotools patches:=bbf97f1 platform=linux os=rocky9 target=x86_64_v4
[^]              ^pkgconf@2.2.0 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]          ^ncurses@6.5~symlinks+termlib abi=none build_system=autotools patches:=7a351bc platform=linux os=rocky9 target=x86_64_v4
[^]          ^zlib-ng@2.1.6+compat+new_strategies+opt+pic+shared build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]      ^compiler-wrapper@1.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]      ^fftw@3.3.10~mpi~openmp~pfft_patches+shared build_system=autotools precision:=double,float platform=linux os=rocky9 target=x86_64_v4
[^]          ^gcc-runtime@12.2.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[e]          ^glibc@2.34 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[e]      ^gcc@12.2.0+binutils+bootstrap~graphite+libsanitizer~mold~nvptx~piclibs~profiled~strip build_system=autotools build_type=RelWithDebInfo languages:='c,c++,fortran' platform=linux os=rocky9 target=x86_64
[+]      ^gcc-runtime@12.2.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[e]      ^glibc@2.34 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]      ^gmake@4.4.1~guile build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]          ^gcc-runtime@11.4.1 build_system=generic platform=linux os=rocky9 target=x86_64_v4
 -       ^kokkos@4.6.02~aggressive_vectorization~atomics_bypass~cmake_lang~compiler_warnings+complex_align~cuda~debug~debug_bounds_check~debug_dualview_modify_check~deprecated_code~examples~hip_relocatable_device_code~hpx~hpx_async_dispatch~hwloc~ipo~memkind~numactl~openmp~openmptarget~pic~rocm+serial+shared~sycl~tests~threads~tuning~wrapper build_system=cmake build_type=Release cxxstd=17 generator=make intel_gpu_arch=none platform=linux os=rocky9 target=x86_64_v4 %cxx=gcc@12.2.0
[e]      ^openmpi@5.0.5+atomics~cuda~debug+gpfs~internal-hwloc~internal-libevent~internal-pmix~java~lustre~memchecker~openshmem~romio+rsh~static~two_level_namespace+vt+wrapper-rpath build_system=autotools fabrics:=none romio-filesystem:=none schedulers:=none platform=linux os=rocky9 target=x86_64_v4

Almost everything required to compile LAMMPS is already available in our central upstream ([^]) The only thing we need to compile is kokkos itself, as well as a new version of LAMMPS integrating KOKKOS. We're using KOKKOS v4 here as at the time of writing, v5 isn't compatible with the Spack preferred version of LAMMPS (20250722.3). You should notice that the variant list for lammps contains +kokkos as well. Let's go ahead and install this variant:

spack install output (click to expand)
$ spack -C ${HOME}/spack-config-templates/1.1.1 install -j ${SLURM_NTASKS} lammps +kokkos ^openmpi ^kokkos@4
[+] /share/apps/rocky9/general/libs/openmpi/gcc/14.2.0/5.0.5 (external openmpi-5.0.5-ccatyv2dkfmw7f433zsigue7ffe2mrfi)
[+] /usr (external glibc-2.34-xri56vcyzs7kkvakhoku3fefc46nw25y)
[+] /usr (external glibc-2.34-q2367nemoxqj6j3fg54cg4mjlkvc7f5n)
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gcc/12.2.0-6frskzg (external gcc-12.2.0-c6glrz75exefrjwq5gurxmxiqkc34ubt)
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/none-none/compiler-wrapper/1.0-oqjjbmb
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gcc-runtime/11.4.1-llid4hw
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gcc-runtime/12.2.0-w77gg5r
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/none-none/gcc-runtime/12.2.0-izdgkrf
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/zlib-ng/2.1.6-g2yruc3
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gmake/4.4.1-xchit5a
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/ncurses/6.5-4n2uzha
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/nghttp2/1.57.0-4ntqcoo
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/fftw/3.3.10-tra2c2j
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/openssl/3.3.0-filwsx6
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/curl/8.7.1-v4za2y6
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/cmake/3.31.11-6b4ejcd
==> No binary for kokkos-4.6.02-4wjhcvbfy6dl7l3wvogyjoe2jy22ry2h found: installing from source
==> Installing kokkos-4.6.02-4wjhcvbfy6dl7l3wvogyjoe2jy22ry2h [17/18]
==> Fetching https://mirror.spack.io/_source-cache/archive/ba/baf1ebbe67abe2bbb8bb6aed81b4247d53ae98ab8475e516d9c87e87fa2422ce.tar.gz
    [100%]    2.47 MB @    3.2 MB/s
==> No patches needed for kokkos
==> kokkos: Executing phase: 'cmake'
==> kokkos: Executing phase: 'build'
==> kokkos: Executing phase: 'install'
==> kokkos: Successfully installed kokkos-4.6.02-4wjhcvbfy6dl7l3wvogyjoe2jy22ry2h
  Stage: 1.41s.  Cmake: 1.68s.  Build: 7.62s.  Install: 1.04s.  Post-install: 0.42s.  Total: 13.76s
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/kokkos/4.6.02-4wjhcvb
==> No binary for lammps-20250722.3-zmkeqefymb4j4prbxfta2lbilffppofb found: installing from source
==> Installing lammps-20250722.3-zmkeqefymb4j4prbxfta2lbilffppofb [18/18]
==> Using cached archive: /gpfs/scratch/abc123/spack/cache/_source-cache/archive/07/07f487cc33fc8f2ec4a449b7bce570e52b5a46608075e0276d26e0e232511bef.tar.gz
==> No patches needed for lammps
==> lammps: Executing phase: 'cmake'
==> lammps: Executing phase: 'build'
==> lammps: Executing phase: 'install'
==> lammps: Successfully installed lammps-20250722.3-zmkeqefymb4j4prbxfta2lbilffppofb
  Stage: 3.03s.  Cmake: 4.33s.  Build: 1m 41.00s.  Install: 1.64s.  Post-install: 0.53s.  Total: 1m 51.21s
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/lammps/20250722.3-openmpi-5.0.5-zmkeqef

To break down what has happened above:

  • The existing available upstream dependencies have been used from the central location as opposed to being re-installed personally
  • Spack has noticed that kokkos and lammps are missing and has thus pulled down source code tarballs to the source_cache directory defined in config.yaml and then manually compiled and installed them to the location defined as install_tree: root: in config.yaml
  • Spack has then compiled and installed LAMMPS with the KOKKOS LAMMPS package activated

Let's now return to our spack find command:

spack find output
$ spack -C ${HOME}/spack-config-templates/1.1.1 find -x -p -v lammps
-- linux-rocky9-x86_64_v4 / %c,cxx=gcc@12.2.0 -------------------
lammps@20250722.3~adios~amoeba~asphere~atc~awpmd~bocs~body~bpm~brownian~cg-dna~cg-spica~class2~colloid~colvars~compress~coreshell~cuda~cuda_mps~curl~dielectric~diffraction~dipole~dpd-basic~dpd-meso~dpd-react~dpd-smooth~drude~eff~electrode~extra-command~extra-compute~extra-dump~extra-fix~extra-molecule~extra-pair~fep~ffmpeg~granular~h5md~heffte~intel~interlayer~ipo~jpeg~kim+kokkos+kspace~latboltz~lepton+lib~machdyn~manifold+manybody~mc~mdi~meam~mesont~mgpt~misc~ml-hdnnp~ml-iap~ml-pace~ml-pod~ml-rann~ml-snap~ml-uf3~mofff+molecule~molfile+mpi~netcdf~opencl+openmp~openmp-package~opt~orient~peri~phonon~plugin~plumed~png~poems~ptm~python~qeq~qtb~reaction~reaxff~replica~rheo+rigid~rocm~scafacos~shock~smtbq~sph~spin~srd~tally~tools~uef~voronoi~vtk~yaff build_system=cmake build_type=Release fft=fftw3 fft_kokkos=fftw3 fftw_precision=double generator=make lammps_sizes=smallbig  /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/lammps/20250722.3-openmpi-5.0.5-zmkeqef

-- linux-rocky9-x86_64_v4 / no compilers ------------------------
lammps@20230802.3~adios~amoeba~asphere~atc~awpmd~bocs~body~bpm~brownian~cg-dna~cg-spica~class2~colloid~colvars~compress~coreshell~cuda~cuda_mps~dielectric~diffraction~dipole~dpd-basic~dpd-meso~dpd-react~dpd-smooth~drude~eff~electrode~extra-compute~extra-dump~extra-fix~extra-molecule~extra-pair~fep~ffmpeg~granular~h5md~intel~interlayer~ipo~jpeg~kim~kokkos+kspace~latboltz~lepton+lib~machdyn~manifold+manybody~mc~meam~mesont~mgpt~misc~ml-hdnnp~ml-iap~ml-pod~ml-rann~ml-snap~mofff+molecule~molfile+mpi~netcdf~opencl+openmp~openmp-package~opt~orient~peri~phonon~plugin~plumed~png~poems~ptm~python~qeq~qtb~reaction~reaxff~replica+rigid~rocm~shock~smtbq~sph~spin~srd~tally~uef~voronoi~vtk~yaff build_system=cmake build_type=Release fftw_precision=double generator=make gpu_precision=mixed lammps_sizes=smallbig                      /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/lammps/20230802.3-openmpi-5.0.3-b27kssh
lammps@20230802.3~adios~amoeba~asphere~atc~awpmd~bocs~body~bpm~brownian~cg-dna~cg-spica~class2~colloid~colvars~compress~coreshell+cuda~cuda_mps~dielectric~diffraction~dipole~dpd-basic~dpd-meso~dpd-react~dpd-smooth~drude~eff~electrode~extra-compute~extra-dump~extra-fix~extra-molecule~extra-pair~fep~ffmpeg~granular~h5md~intel~interlayer~ipo~jpeg~kim~kokkos+kspace~latboltz~lepton+lib~machdyn~manifold+manybody~mc~meam~mesont~mgpt~misc~ml-hdnnp~ml-iap~ml-pod~ml-rann~ml-snap~mofff+molecule~molfile+mpi~netcdf~opencl+openmp~openmp-package~opt~orient~peri~phonon~plugin~plumed~png~poems~ptm~python~qeq~qtb~reaction~reaxff~replica+rigid~rocm~shock~smtbq~sph~spin~srd~tally~uef~voronoi~vtk~yaff build_system=cmake build_type=Release cuda_arch:=70,80,90 fftw_precision=double generator=make gpu_precision=mixed lammps_sizes=smallbig  /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/lammps/20230802.3-openmpi-5.0.3-zqtg4sr
==> 3 installed packages

So now we have LAMMPS with KOKKOS activated installed alongside the two existing centrally installed versions.

If we now add our specified private module path using module use as specified in modules.yaml:

module use /gpfs/scratch/${USER}/spack/privatemodules/linux-rocky9-x86_64_v4

Then we should see our personal version available for use:

Output from module avail
$ module avail -l lammps
- Package/Alias -----------------------.- Versions --------.- Last mod. -------
/gpfs/scratch/abc123/spack/privatemodules/linux-rocky9-x86_64_v4:
lammps/20250722.3-openmpi-5.0.5-gcc-12.2.0-kokkos           2026/06/18 17:08:30

/share/apps/rocky9/environmentmodules/apocrita-modules/spack:
lammps-gpu/20230802.3-openmpi-5.0.3-cuda-12.4.0-gcc-12.2.0  2026/06/18 10:02:13
lammps/20230802.3-openmpi-5.0.3-gcc-12.2.0                  2026/06/18 10:02:13

And indeed, we can load and use our personal version:

Output from module load (click to expand)
$ module load lammps/20250722.3-openmpi-5.0.5-gcc-12.2.0-kokkos
Loading lammps/20250722.3-openmpi-5.0.5-gcc-12.2.0-kokkos
  Loading requirement: openmpi/5.0.5-gcc-14.2.0

$ lmp -help

Large-scale Atomic/Molecular Massively Parallel Simulator - 22 Jul 2025 - Update 3

Usage example: lmp -var t 300 -echo screen -in in.alloy

List of command-line options supported by this LAMMPS executable:

-echo none/screen/log/both  : echoing of input script (-e)
-help                       : print this help message (-h)
-in none/filename           : read input from file or stdin (default) (-i)
-kokkos on/off ...          : turn KOKKOS mode on or off (-k)
-log none/filename          : where to send log output (-l)
-mdi '<mdi flags>'          : pass flags to the MolSSI Driver Interface
-mpicolor color             : which exe in a multi-exe mpirun cmd (-m)
-cite                       : select citation reminder style (-c)
-nocite                     : disable citation reminder (-nc)
-nonbuf                     : disable screen/logfile buffering (-nb)
-package style ...          : invoke package command (-pk)
-partition size1 size2 ...  : assign partition sizes (-p)
-plog basename              : basename for partition logs (-pl)
-pscreen basename           : basename for partition screens (-ps)
-restart2data rfile dfile ... : convert restart to data file (-r2data)
-restart2dump rfile dgroup dstyle dfile ...
                            : convert restart to dump file (-r2dump)
-restart2info rfile         : print info about restart rfile (-r2info)
-reorder topology-specs     : processor reordering (-r)
-screen none/filename       : where to send screen output (-sc)
-skiprun                    : skip loops in run and minimize (-sr)
-suffix gpu/intel/kk/opt/omp: style suffix to apply (-sf)
-var varname value          : set index style variable (-v)

OS: Linux "Rocky Linux 9.6 (Blue Onyx)" 5.14.0-570.39.1.el9_6.x86_64 x86_64

Compiler: GNU C++ 12.2.0 with OpenMP 4.5
C++ standard: C++17
Embedded fmt library version: 10.2.0
Embedded JSON class version: 3.12.0

MPI v3.1: Open MPI v5.0.5, package: Open MPI abc123@ddy60 Distribution, ident: 5.0.5, repo rev: v5.0.5, Jul 22, 2024

Accelerator configuration:

KOKKOS package API: Serial
KOKKOS package precision: double
Kokkos library version: 4.6.2

FFT information:

FFT precision  = double
FFT engine  = mpiFFT
FFT library = FFTW3
KOKKOS FFT engine  = mpiFFT
KOKKOS FFT library = FFTW3

Active compile time flags:

-DLAMMPS_GZIP
-DLAMMPS_SMALLBIG
sizeof(smallint): 32-bit
sizeof(imageint): 32-bit
sizeof(tagint):   32-bit
sizeof(bigint):   64-bit

Available compression formats:

Extension: .gz     Command: gzip
Extension: .bz2    Command: bzip2
Extension: .zst    Command: zstd
Extension: .xz     Command: xz
Extension: .lzma   Command: xz


Installed packages:

KOKKOS KSPACE MANYBODY MOLECULE RIGID
(etc.)

We can see that KOKKOS appears in the listed "Accelerator configuration" and "Installed packages" sections.

Activate the KOKKOS LAMMPS package and CUDA

Use a GPU node for compilation and installation

At the time of writing, LAMMPS will not compile with CUDA unless there is a physical GPU (as well as CUDA drivers) present (see this GitHub issue).

Please ensure that you run any personal variant installations enabling CUDA support in an interactive salloc session on a GPU node, otherwise you will see this error:

/bin/ld: warning: libcuda.so.1, needed by liblammps.so.0, not found (try using -rpath or -rpath-link)

How about if we wanted LAMMPS with the KOKKOS package activated but also GPU support via CUDA? It's possible, but you need to specify the right variant. Remember, Spack will install the default variant unless explicitly told otherwise. If you look again at the variants for LAMMPS, you will see that cuda is set to (false) by default. The centrally available lammps-gpu module loads a version that has explicitly been compiled with CUDA support.

Let's see if we can spec a personal installation of LAMMPS activating the KOKKOS package and CUDA:

Specify your cuda_arch

When installing a CUDA variant of a package from Spack, you must also specify a cuda_arch (sm_70 - Volta V100, sm_80 - Ampere A100, sm_90 - Hopper H100). Some packages, like Gromacs, let you install one variant that supports all three at once, but LAMMPS requires a separate install per cuda_arch required when also activating KOKKOS. Check the output of the spec command for more details.

spack spec output (click to expand)
$ spack -C ${HOME}/spack-config-templates/1.1.1 spec lammps +cuda cuda_arch=80 +kokkos ^openmpi ^kokkos@4
 -   lammps@20250722.3~adios~amoeba~asphere~atc~awpmd~bocs~body~bpm~brownian~cg-dna~cg-spica~class2~colloid~colvars~compress~coreshell+cuda~cuda_mps~curl~dielectric~diffraction~dipole~dpd-basic~dpd-meso~dpd-react~dpd-smooth~drude~eff~electrode~extra-command~extra-compute~extra-dump~extra-fix~extra-molecule~extra-pair~fep~ffmpeg~granular~h5md~heffte~intel~interlayer~ipo~jpeg~kim+kokkos+kspace~latboltz~lepton+lib~machdyn~manifold+manybody~mc~mdi~meam~mesont~mgpt~misc~ml-hdnnp~ml-iap~ml-pace~ml-pod~ml-rann~ml-snap~ml-uf3~mofff+molecule~molfile+mpi~netcdf~opencl+openmp~openmp-package~opt~orient~peri~phonon~plugin~plumed~png~poems~ptm~python~qeq~qtb~reaction~reaxff~replica~rheo+rigid~rocm~scafacos~shock~smtbq~sph~spin~srd~tally~tools~uef~voronoi~vtk~yaff build_system=cmake build_type=Release cuda_arch:=80 fft=fftw3 fft_kokkos=fftw3 fftw_precision=double generator=make lammps_sizes=smallbig platform=linux os=rocky9 target=x86_64_v4 %c,cxx=gcc@12.2.0
[+]      ^cmake@3.31.11~doc+ncurses+ownlibs~qtgui build_system=generic build_type=Release platform=linux os=rocky9 target=x86_64_v4 %c,cxx=gcc@12.2.0
[^]          ^curl@8.7.1~gssapi~ldap~libidn2~librtmp~libssh~libssh2+nghttp2 build_system=autotools libs:=shared,static tls:=openssl platform=linux os=rocky9 target=x86_64_v4
[^]              ^nghttp2@1.57.0 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                  ^diffutils@3.10 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]              ^openssl@3.3.0~docs+shared build_system=generic certs=mozilla platform=linux os=rocky9 target=x86_64_v4
[^]                  ^ca-certificates-mozilla@2023-05-30 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]              ^perl@5.38.0+cpanm+opcode+open+shared+threads build_system=generic patches:=714e4d1 platform=linux os=rocky9 target=x86_64_v4
[^]                  ^berkeley-db@18.1.40+cxx~docs+stl build_system=autotools patches:=26090f4,b231fcc platform=linux os=rocky9 target=x86_64_v4
[^]                  ^bzip2@1.0.8~debug~pic+shared build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]                  ^gdbm@1.23 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                      ^readline@8.2 build_system=autotools patches:=bbf97f1 platform=linux os=rocky9 target=x86_64_v4
[^]              ^pkgconf@2.2.0 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]          ^ncurses@6.5~symlinks+termlib abi=none build_system=autotools patches:=7a351bc platform=linux os=rocky9 target=x86_64_v4
[^]          ^zlib-ng@2.1.6+compat+new_strategies+opt+pic+shared build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]      ^compiler-wrapper@1.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]      ^cuda@12.6.2~allow-unsupported-compilers~dev build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]          ^gcc-runtime@12.2.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]          ^libxml2@2.10.3+pic~python+shared build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]              ^xz@5.4.6~pic build_system=autotools libs:=shared,static platform=linux os=rocky9 target=x86_64_v4
[^]      ^fftw@3.3.10~mpi~openmp~pfft_patches+shared build_system=autotools precision:=double,float platform=linux os=rocky9 target=x86_64_v4
[e]          ^glibc@2.34 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[e]      ^gcc@12.2.0+binutils+bootstrap~graphite+libsanitizer~mold~nvptx~piclibs~profiled~strip build_system=autotools build_type=RelWithDebInfo languages:='c,c++,fortran' platform=linux os=rocky9 target=x86_64
[+]      ^gcc-runtime@12.2.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[e]      ^glibc@2.34 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]      ^gmake@4.4.1~guile build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]          ^gcc-runtime@11.4.1 build_system=generic platform=linux os=rocky9 target=x86_64_v4
 -       ^kokkos@4.6.02~aggressive_vectorization~alloc_async~cmake_lang~compiler_warnings+complex_align+cuda~cuda_constexpr~cuda_lambda~cuda_ldg_intrinsic~cuda_relocatable_device_code~cuda_uvm~debug~debug_bounds_check~debug_dualview_modify_check~deprecated_code~examples~hip_relocatable_device_code~hpx~hpx_async_dispatch~hwloc~ipo~memkind~numactl~openmp~openmptarget~pic~rocm+serial+shared~sycl~tests~threads~tuning~wrapper build_system=cmake build_type=Release cuda_arch=80 cxxstd=17 generator=make intel_gpu_arch=none platform=linux os=rocky9 target=x86_64_v4 %cxx=gcc@12.2.0
[e]      ^openmpi@5.0.5+atomics~cuda~debug+gpfs~internal-hwloc~internal-libevent~internal-pmix~java~lustre~memchecker~openshmem~romio+rsh~static~two_level_namespace+vt+wrapper-rpath build_system=autotools fabrics:=none romio-filesystem:=none schedulers:=none platform=linux os=rocky9 target=x86_64_v4

So a similar output to the kokkos variant above, but adding in CUDA (which comes from upstream). Again, almost everything required to compile LAMMPS is already available in our central upstream ([^]). A +cuda variant of kokkos needs to be compiled, as well as a new version of lammps that adds both kokkos and cuda support. You should notice that the variant list for lammps contains +cuda, +kokkos and cuda_arch=80 as well. So, as before, let's go ahead and install our personal variant:

spack install output (click to expand)
$ spack -C ${HOME}/spack-config-templates/1.1.1 install -j ${SLURM_NTASKS} lammps +cuda cuda_arch=80 +kokkos ^openmpi ^kokkos@4
[+] /usr (external glibc-2.34-xri56vcyzs7kkvakhoku3fefc46nw25y)
[+] /usr (external glibc-2.34-q2367nemoxqj6j3fg54cg4mjlkvc7f5n)
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gcc/12.2.0-6frskzg (external gcc-12.2.0-c6glrz75exefrjwq5gurxmxiqkc34ubt)
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/none-none/compiler-wrapper/1.0-oqjjbmb
[+] /share/apps/rocky9/general/libs/openmpi/gcc/14.2.0/5.0.5 (external openmpi-5.0.5-ccatyv2dkfmw7f433zsigue7ffe2mrfi)
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gcc-runtime/12.2.0-w77gg5r
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gcc-runtime/11.4.1-llid4hw
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/none-none/gcc-runtime/12.2.0-izdgkrf
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/fftw/3.3.10-tra2c2j
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/nghttp2/1.57.0-4ntqcoo
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gmake/4.4.1-xchit5a
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/ncurses/6.5-4n2uzha
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/xz/5.4.6-rwn7pno
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/zlib-ng/2.1.6-g2yruc3
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/libxml2/2.10.3-q6zmsq6
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/openssl/3.3.0-filwsx6
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/cuda/12.6.2-7ahvfr4
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/curl/8.7.1-v4za2y6
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/cmake/3.31.11-6b4ejcd
==> No binary for kokkos-4.6.02-7kzezpl3ileu3evxzyqjnqn2hl7clvfx found: installing from source
==> Installing kokkos-4.6.02-7kzezpl3ileu3evxzyqjnqn2hl7clvfx [20/21]
==> Using cached archive: /gpfs/scratch/abc123/spack/cache/_source-cache/archive/ba/baf1ebbe67abe2bbb8bb6aed81b4247d53ae98ab8475e516d9c87e87fa2422ce.tar.gz
==> No patches needed for kokkos
==> kokkos: Executing phase: 'cmake'
==> Error: InstallError: Kokkos requires +wrapper when using +cuda without %clang, %cce or +cmake_lang

/share/apps/rocky9/general/apps/spack-packages/2026.03.0/repos/spack_repo/builtin/packages/kokkos/package.py:404, in cmake_args:
        401        if spec.satisfies("~wrapper+cuda") and not (
        402            spec.satisfies("%clang") or spec.satisfies("%cce") or spec.satisfies("+cmake_lang")
        403        ):
  >>    404            raise InstallError(
        405                "Kokkos requires +wrapper when using +cuda without %clang, %cce or +cmake_lang"
        406            )
        407

See build log for details:
  /tmp/abc123/spack-stage/spack-stage-kokkos-4.6.02-7kzezpl3ileu3evxzyqjnqn2hl7clvfx/spack-build-out.txt

==> Warning: Skipping build of lammps-20250722.3-kdkfeu5ffioze5jff6kenjkhab374ezl since kokkos-4.6.02-7kzezpl3ileu3evxzyqjnqn2hl7clvfx failed
==> Error: lammps-20250722.3-kdkfeu5ffioze5jff6kenjkhab374ezl: Package was not installed
==> Error: Installation request failed.  Refer to reported errors for failing package(s).

Oh dear! But Spack has given us a clue. If we look at the Spack Packages page for KOKKOS:

https://packages.spack.io/package.html?name=kokkos

You can see:

KOKKOS nvcc-wrapper

So, we need to add ^kokkos+wrapper as well as +kokkos to our spec and install commands.

Let's check that in a new spec command:

spack spec output (click to expand)
$ spack -C ${HOME}/spack-config-templates/1.1.1 spec lammps +cuda cuda_arch=80 +kokkos ^kokkos+wrapper ^openmpi ^kokkos@4
 -   lammps@20250722.3~adios~amoeba~asphere~atc~awpmd~bocs~body~bpm~brownian~cg-dna~cg-spica~class2~colloid~colvars~compress~coreshell+cuda~cuda_mps~curl~dielectric~diffraction~dipole~dpd-basic~dpd-meso~dpd-react~dpd-smooth~drude~eff~electrode~extra-command~extra-compute~extra-dump~extra-fix~extra-molecule~extra-pair~fep~ffmpeg~granular~h5md~heffte~intel~interlayer~ipo~jpeg~kim+kokkos+kspace~latboltz~lepton+lib~machdyn~manifold+manybody~mc~mdi~meam~mesont~mgpt~misc~ml-hdnnp~ml-iap~ml-pace~ml-pod~ml-rann~ml-snap~ml-uf3~mofff+molecule~molfile+mpi~netcdf~opencl+openmp~openmp-package~opt~orient~peri~phonon~plugin~plumed~png~poems~ptm~python~qeq~qtb~reaction~reaxff~replica~rheo+rigid~rocm~scafacos~shock~smtbq~sph~spin~srd~tally~tools~uef~voronoi~vtk~yaff build_system=cmake build_type=Release cuda_arch:=80 fft=fftw3 fft_kokkos=fftw3 fftw_precision=double generator=make lammps_sizes=smallbig platform=linux os=rocky9 target=x86_64_v4 %c,cxx=gcc@12.2.0
[+]      ^cmake@3.31.11~doc+ncurses+ownlibs~qtgui build_system=generic build_type=Release platform=linux os=rocky9 target=x86_64_v4 %c,cxx=gcc@12.2.0
[^]          ^curl@8.7.1~gssapi~ldap~libidn2~librtmp~libssh~libssh2+nghttp2 build_system=autotools libs:=shared,static tls:=openssl platform=linux os=rocky9 target=x86_64_v4
[^]              ^nghttp2@1.57.0 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                  ^diffutils@3.10 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]              ^openssl@3.3.0~docs+shared build_system=generic certs=mozilla platform=linux os=rocky9 target=x86_64_v4
[^]                  ^ca-certificates-mozilla@2023-05-30 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]              ^perl@5.38.0+cpanm+opcode+open+shared+threads build_system=generic patches:=714e4d1 platform=linux os=rocky9 target=x86_64_v4
[^]                  ^berkeley-db@18.1.40+cxx~docs+stl build_system=autotools patches:=26090f4,b231fcc platform=linux os=rocky9 target=x86_64_v4
[^]                  ^bzip2@1.0.8~debug~pic+shared build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]                  ^gdbm@1.23 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                      ^readline@8.2 build_system=autotools patches:=bbf97f1 platform=linux os=rocky9 target=x86_64_v4
[^]              ^pkgconf@2.2.0 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]          ^ncurses@6.5~symlinks+termlib abi=none build_system=autotools patches:=7a351bc platform=linux os=rocky9 target=x86_64_v4
[^]          ^zlib-ng@2.1.6+compat+new_strategies+opt+pic+shared build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]      ^compiler-wrapper@1.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]      ^cuda@12.6.2~allow-unsupported-compilers~dev build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]          ^gcc-runtime@12.2.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]          ^libxml2@2.10.3+pic~python+shared build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]              ^xz@5.4.6~pic build_system=autotools libs:=shared,static platform=linux os=rocky9 target=x86_64_v4
[^]      ^fftw@3.3.10~mpi~openmp~pfft_patches+shared build_system=autotools precision:=double,float platform=linux os=rocky9 target=x86_64_v4
[e]          ^glibc@2.34 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[e]      ^gcc@12.2.0+binutils+bootstrap~graphite+libsanitizer~mold~nvptx~piclibs~profiled~strip build_system=autotools build_type=RelWithDebInfo languages:='c,c++,fortran' platform=linux os=rocky9 target=x86_64
[+]      ^gcc-runtime@12.2.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[e]      ^glibc@2.34 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]      ^gmake@4.4.1~guile build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]          ^gcc-runtime@11.4.1 build_system=generic platform=linux os=rocky9 target=x86_64_v4
 -       ^kokkos@4.6.02~aggressive_vectorization~alloc_async~cmake_lang~compiler_warnings+complex_align+cuda~cuda_constexpr~cuda_lambda~cuda_ldg_intrinsic~cuda_relocatable_device_code~cuda_uvm~debug~debug_bounds_check~debug_dualview_modify_check~deprecated_code~examples~hip_relocatable_device_code~hpx~hpx_async_dispatch~hwloc~ipo~memkind~numactl~openmp~openmptarget~pic~rocm+serial+shared~sycl~tests~threads~tuning+wrapper build_system=cmake build_type=Release cuda_arch=80 cxxstd=17 generator=make intel_gpu_arch=none platform=linux os=rocky9 target=x86_64_v4 %cxx=gcc@12.2.0
 -           ^kokkos-nvcc-wrapper@5.0.2 build_system=generic platform=linux os=rocky9 target=x86_64_v4 %cxx=gcc@12.2.0
[e]      ^openmpi@5.0.5+atomics~cuda~debug+gpfs~internal-hwloc~internal-libevent~internal-pmix~java~lustre~memchecker~openshmem~romio+rsh~static~two_level_namespace+vt+wrapper-rpath build_system=autotools fabrics:=none romio-filesystem:=none schedulers:=none platform=linux os=rocky9 target=x86_64_v4

It looks almost the same as our first spec command, but now ^kokkos+wrapper is listed as part of the "Input spec" and we are going to install the required kokkos-nvcc-wrapper dependency as well. Now, onto the install:

spack install output (click to expand)
$ spack -C ${HOME}/spack-config-templates/1.1.1 install -j ${SLURM_NTASKS} lammps +cuda cuda_arch=80 +kokkos ^kokkos+wrapper ^openmpi ^kokkos@4
[+] /usr (external glibc-2.34-xri56vcyzs7kkvakhoku3fefc46nw25y)
[+] /usr (external glibc-2.34-q2367nemoxqj6j3fg54cg4mjlkvc7f5n)
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gcc/12.2.0-6frskzg (external gcc-12.2.0-c6glrz75exefrjwq5gurxmxiqkc34ubt)
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/none-none/compiler-wrapper/1.0-oqjjbmb
[+] /share/apps/rocky9/general/libs/openmpi/gcc/14.2.0/5.0.5 (external openmpi-5.0.5-ccatyv2dkfmw7f433zsigue7ffe2mrfi)
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gcc-runtime/12.2.0-w77gg5r
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gcc-runtime/11.4.1-llid4hw
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/none-none/gcc-runtime/12.2.0-izdgkrf
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/fftw/3.3.10-tra2c2j
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/nghttp2/1.57.0-4ntqcoo
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gmake/4.4.1-xchit5a
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/zlib-ng/2.1.6-g2yruc3
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/ncurses/6.5-4n2uzha
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/xz/5.4.6-rwn7pno
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/openssl/3.3.0-filwsx6
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/libxml2/2.10.3-q6zmsq6
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/curl/8.7.1-v4za2y6
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/cuda/12.6.2-7ahvfr4
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/cmake/3.31.11-6b4ejcd
==> No binary for kokkos-nvcc-wrapper-5.0.2-d7eszlen7er2i2hanm34oj3ukthel3md found: installing from source
==> Installing kokkos-nvcc-wrapper-5.0.2-d7eszlen7er2i2hanm34oj3ukthel3md [20/22]
==> Fetching https://mirror.spack.io/_source-cache/archive/18/188817bb452ca805ee8701f1c5adbbb4fb83dc8d1c50624566a18a719ba0fa5e.tar.gz
    [100%]    1.79 MB @  150.6 MB/s
==> No patches needed for kokkos-nvcc-wrapper
==> kokkos-nvcc-wrapper: Executing phase: 'install'
==> kokkos-nvcc-wrapper: Successfully installed kokkos-nvcc-wrapper-5.0.2-d7eszlen7er2i2hanm34oj3ukthel3md
  Stage: 0.13s.  Install: 0.00s.  Post-install: 0.09s.  Total: 0.33s
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/kokkos-nvcc-wrapper/5.0.2-d7eszle
==> No binary for kokkos-4.6.02-ppgy2kahgypc4v472nfh4fjaxvockxy6 found: installing from source
==> Installing kokkos-4.6.02-ppgy2kahgypc4v472nfh4fjaxvockxy6 [21/22]
==> Using cached archive: /gpfs/scratch/abc123/spack/cache/_source-cache/archive/ba/baf1ebbe67abe2bbb8bb6aed81b4247d53ae98ab8475e516d9c87e87fa2422ce.tar.gz
==> No patches needed for kokkos
==> kokkos: Executing phase: 'cmake'
==> kokkos: Executing phase: 'build'
==> kokkos: Executing phase: 'install'
==> kokkos: Successfully installed kokkos-4.6.02-ppgy2kahgypc4v472nfh4fjaxvockxy6
  Stage: 0.08s.  Cmake: 6.60s.  Build: 21.35s.  Install: 0.51s.  Post-install: 0.27s.  Total: 29.00s
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/kokkos/4.6.02-ppgy2ka
==> No binary for lammps-20250722.3-3bjw4leherfvgs3mgmkrlon4zad5gthv found: installing from source
==> Installing lammps-20250722.3-3bjw4leherfvgs3mgmkrlon4zad5gthv [22/22]
==> Using cached archive: /gpfs/scratch/abc123/spack/cache/_source-cache/archive/07/07f487cc33fc8f2ec4a449b7bce570e52b5a46608075e0276d26e0e232511bef.tar.gz
==> No patches needed for lammps
==> lammps: Executing phase: 'cmake'
==> Error: ProcessError: Command exited with status 1:
    '/gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/cmake/3.31.11-6b4ejcd/bin/cmake' '-G' 'Unix Makefiles' '-DCMAKE_INSTALL_PREFIX:STRING=/gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/lammps/20250722.3-openmpi-5.0.5-3bjw4le' '-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON' '-DCMAKE_INSTALL_RPATH:STRING=/gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/lammps/20250722.3-openmpi-5.0.5-3bjw4le/lib;/gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/lammps/20250722.3-openmpi-5.0.5-3bjw4le/lib64' '-DCMAKE_PREFIX_PATH:STRING=/gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/cmake/3.31.11-6b4ejcd;/share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/none-none/compiler-wrapper/1.0-oqjjbmb;/share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/fftw/3.3.10-tra2c2j;/share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gmake/4.4.1-xchit5a;/gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/kokkos/4.6.02-ppgy2ka;/gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/kokkos-nvcc-wrapper/5.0.2-d7eszle;/share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/cuda/12.6.2-7ahvfr4;/share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/cuda/12.6.2-7ahvfr4/targets/x86_64-linux/lib/cmake;/gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/none-none/gcc-runtime/12.2.0-izdgkrf;/share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gcc-runtime/12.2.0-w77gg5r;/share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/libxml2/2.10.3-q6zmsq6;/share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/xz/5.4.6-rwn7pno;/share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/zlib-ng/2.1.6-g2yruc3;/share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gcc-runtime/11.4.1-llid4hw;/share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gcc/12.2.0-6frskzg;/share/apps/rocky9/general/libs/openmpi/gcc/14.2.0/5.0.5' '-DCMAKE_BUILD_TYPE:STRING=Release' '-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON' '-DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=OFF' '-DCMAKE_POLICY_DEFAULT_CMP0090:STRING=NEW' '-DCMAKE_FIND_USE_PACKAGE_REGISTRY:BOOL=OFF' '-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON' '-DBUILD_SHARED_LIBS:BOOL=ON' '' '-DBUILD_MPI:BOOL=ON' '-DBUILD_OMP:BOOL=ON' '-DBUILD_TOOLS:BOOL=OFF' '-DENABLE_TESTING:BOOL=OFF' '-DDOWNLOAD_POTENTIALS:BOOL=OFF' '-DEXTERNAL_KOKKOS:BOOL=ON' '-DFFT_KOKKOS:STRING=fftw3' '-DBUILD_LIB:BOOL=ON' '-DCMAKE_TUNE_FLAGS:STRING=-march=x86-64-v4 -mtune=generic' '-DLAMMPS_SIZES:STRING=smallbig' '-DWITH_JPEG:BOOL=OFF' '-DWITH_PNG:BOOL=OFF' '-DWITH_FFMPEG:BOOL=OFF' '-DWITH_CURL:BOOL=OFF' '-DPKG_ADIOS:BOOL=OFF' '-DPKG_AMOEBA:BOOL=OFF' '-DPKG_ASPHERE:BOOL=OFF' '-DPKG_ATC:BOOL=OFF' '-DPKG_AWPMD:BOOL=OFF' '-DPKG_BOCS:BOOL=OFF' '-DPKG_BODY:BOOL=OFF' '-DPKG_BPM:BOOL=OFF' '-DPKG_BROWNIAN:BOOL=OFF' '-DPKG_CG-DNA:BOOL=OFF' '-DPKG_CG-SPICA:BOOL=OFF' '-DPKG_CLASS2:BOOL=OFF' '-DPKG_COLLOID:BOOL=OFF' '-DPKG_COLVARS:BOOL=OFF' '-DPKG_COMPRESS:BOOL=OFF' '-DPKG_CORESHELL:BOOL=OFF' '-DPKG_DIELECTRIC:BOOL=OFF' '-DPKG_DIFFRACTION:BOOL=OFF' '-DPKG_DIPOLE:BOOL=OFF' '-DPKG_DPD-BASIC:BOOL=OFF' '-DPKG_DPD-MESO:BOOL=OFF' '-DPKG_DPD-REACT:BOOL=OFF' '-DPKG_DPD-SMOOTH:BOOL=OFF' '-DPKG_DRUDE:BOOL=OFF' '-DPKG_EFF:BOOL=OFF' '-DPKG_ELECTRODE:BOOL=OFF' '-DPKG_EXTRA-COMMAND:BOOL=OFF' '-DPKG_EXTRA-COMPUTE:BOOL=OFF' '-DPKG_EXTRA-DUMP:BOOL=OFF' '-DPKG_EXTRA-FIX:BOOL=OFF' '-DPKG_EXTRA-MOLECULE:BOOL=OFF' '-DPKG_EXTRA-PAIR:BOOL=OFF' '-DPKG_FEP:BOOL=OFF' '-DPKG_GRANULAR:BOOL=OFF' '-DPKG_H5MD:BOOL=OFF' '-DPKG_INTEL:BOOL=OFF' '-DPKG_INTERLAYER:BOOL=OFF' '-DPKG_KIM:BOOL=OFF' '-DPKG_KOKKOS:BOOL=ON' '-DPKG_KSPACE:BOOL=ON' '-DPKG_LATBOLTZ:BOOL=OFF' '-DPKG_LEPTON:BOOL=OFF' '-DPKG_MACHDYN:BOOL=OFF' '-DPKG_MANIFOLD:BOOL=OFF' '-DPKG_MANYBODY:BOOL=ON' '-DPKG_MC:BOOL=OFF' '-DPKG_MDI:BOOL=OFF' '-DPKG_MEAM:BOOL=OFF' '-DPKG_MESONT:BOOL=OFF' '-DPKG_MGPT:BOOL=OFF' '-DPKG_MISC:BOOL=OFF' '-DPKG_ML-HDNNP:BOOL=OFF' '-DPKG_ML-IAP:BOOL=OFF' '-DPKG_ML-PACE:BOOL=OFF' '-DPKG_ML-POD:BOOL=OFF' '-DPKG_ML-RANN:BOOL=OFF' '-DPKG_ML-SNAP:BOOL=OFF' '-DPKG_ML-UF3:BOOL=OFF' '-DPKG_MOFFF:BOOL=OFF' '-DPKG_MOLECULE:BOOL=ON' '-DPKG_MOLFILE:BOOL=OFF' '-DPKG_NETCDF:BOOL=OFF' '-DPKG_OPENMP:BOOL=OFF' '-DPKG_OPT:BOOL=OFF' '-DPKG_ORIENT:BOOL=OFF' '-DPKG_PERI:BOOL=OFF' '-DPKG_PHONON:BOOL=OFF' '-DPKG_PLUGIN:BOOL=OFF' '-DPKG_PLUMED:BOOL=OFF' '-DPKG_POEMS:BOOL=OFF' '-DPKG_PTM:BOOL=OFF' '-DPKG_PYTHON:BOOL=OFF' '-DPKG_QEQ:BOOL=OFF' '-DPKG_QTB:BOOL=OFF' '-DPKG_REACTION:BOOL=OFF' '-DPKG_REAXFF:BOOL=OFF' '-DPKG_RHEO:BOOL=OFF' '-DPKG_REPLICA:BOOL=OFF' '-DPKG_RIGID:BOOL=ON' '-DPKG_SCAFACOS:BOOL=OFF' '-DPKG_SHOCK:BOOL=OFF' '-DPKG_SMTBQ:BOOL=OFF' '-DPKG_SPH:BOOL=OFF' '-DPKG_SPIN:BOOL=OFF' '-DPKG_SRD:BOOL=OFF' '-DPKG_TALLY:BOOL=OFF' '-DPKG_UEF:BOOL=OFF' '-DPKG_VORONOI:BOOL=OFF' '-DPKG_VTK:BOOL=OFF' '-DPKG_YAFF:BOOL=OFF' '-DFFT:STRING=fftw3' '-DFFT_USE_HEFFTE:BOOL=OFF' '-DFFT_SINGLE:BOOL=OFF' '/tmp/abc123/spack-stage/spack-stage-lammps-20250722.3-3bjw4leherfvgs3mgmkrlon4zad5gthv/spack-src/cmake'

1 error found in build log:
     43    -- Found CUDAToolkit: /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/cuda/12.6.2-7ahvfr4/targets/x86_64-linux/include (fo
           und version "12.6.77")
     44    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
     45    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
     46    -- Found Threads: TRUE
     47    -- Enabled Kokkos devices: SERIAL;CUDA
     48    -- kokkos_launch_compiler is enabled globally. C++ compiler commands with -DKOKKOS_DEPENDENCE will be redirected to the appropriate compil
           er for Kokkos
  >> 49    CMake Error at Modules/Packages/KOKKOS.cmake:149 (message):
     50      The CUDA backend of Kokkos requires either KISS FFT or CUFFT.
     51    Call Stack (most recent call first):
     52      CMakeLists.txt:733 (include)
     53
     54
     55    -- Configuring incomplete, errors occurred!

See build log for details:
  /tmp/abc123/spack-stage/spack-stage-lammps-20250722.3-3bjw4leherfvgs3mgmkrlon4zad5gthv/spack-build-out.txt

We've now managed to compile kokkos-nvcc-wrapper and kokkos, but we have another error, and this is because the CUDA backend of Kokkos requires either KISS FFT or CUFFT, so we will specify fft_kokkos=kiss as well (the default is fft_kokkos=fftw3, hence why it failed):

spack spec output (click to expand)
$ spack -C ${HOME}/spack-config-templates/1.1.1 spec lammps +cuda cuda_arch=80 +kokkos fft_kokkos=kiss ^openmpi ^kokkos@4
-   lammps@20250722.3~adios~amoeba~asphere~atc~awpmd~bocs~body~bpm~brownian~cg-dna~cg-spica~class2~colloid~colvars~compress~coreshell+cuda~cuda_mps~curl~dielectric~diffraction~dipole~dpd-basic~dpd-meso~dpd-react~dpd-smooth~drude~eff~electrode~extra-command~extra-compute~extra-dump~extra-fix~extra-molecule~extra-pair~fep~ffmpeg~granular~h5md~heffte~intel~interlayer~ipo~jpeg~kim+kokkos+kspace~latboltz~lepton+lib~machdyn~manifold+manybody~mc~mdi~meam~mesont~mgpt~misc~ml-hdnnp~ml-iap~ml-pace~ml-pod~ml-rann~ml-snap~ml-uf3~mofff+molecule~molfile+mpi~netcdf~opencl+openmp~openmp-package~opt~orient~peri~phonon~plugin~plumed~png~poems~ptm~python~qeq~qtb~reaction~reaxff~replica~rheo+rigid~rocm~scafacos~shock~smtbq~sph~spin~srd~tally~tools~uef~voronoi~vtk~yaff build_system=cmake build_type=Release cuda_arch:=80 fft=fftw3 fft_kokkos=kiss fftw_precision=double generator=make lammps_sizes=smallbig platform=linux os=rocky9 target=x86_64_v4 %c,cxx=gcc@12.2.0
[+]      ^cmake@3.31.11~doc+ncurses+ownlibs~qtgui build_system=generic build_type=Release platform=linux os=rocky9 target=x86_64_v4 %c,cxx=gcc@12.2.0
[^]          ^curl@8.7.1~gssapi~ldap~libidn2~librtmp~libssh~libssh2+nghttp2 build_system=autotools libs:=shared,static tls:=openssl platform=linux os=rocky9 target=x86_64_v4
[^]              ^nghttp2@1.57.0 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                  ^diffutils@3.10 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]              ^openssl@3.3.0~docs+shared build_system=generic certs=mozilla platform=linux os=rocky9 target=x86_64_v4
[^]                  ^ca-certificates-mozilla@2023-05-30 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]              ^perl@5.38.0+cpanm+opcode+open+shared+threads build_system=generic patches:=714e4d1 platform=linux os=rocky9 target=x86_64_v4
[^]                  ^berkeley-db@18.1.40+cxx~docs+stl build_system=autotools patches:=26090f4,b231fcc platform=linux os=rocky9 target=x86_64_v4
[^]                  ^bzip2@1.0.8~debug~pic+shared build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]                  ^gdbm@1.23 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]                      ^readline@8.2 build_system=autotools patches:=bbf97f1 platform=linux os=rocky9 target=x86_64_v4
[^]              ^pkgconf@2.2.0 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]          ^ncurses@6.5~symlinks+termlib abi=none build_system=autotools patches:=7a351bc platform=linux os=rocky9 target=x86_64_v4
[^]          ^zlib-ng@2.1.6+compat+new_strategies+opt+pic+shared build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]      ^compiler-wrapper@1.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]      ^cuda@12.6.2~allow-unsupported-compilers~dev build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]          ^gcc-runtime@12.2.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]          ^libxml2@2.10.3+pic~python+shared build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]              ^xz@5.4.6~pic build_system=autotools libs:=shared,static platform=linux os=rocky9 target=x86_64_v4
[^]      ^fftw@3.3.10~mpi~openmp~pfft_patches+shared build_system=autotools precision:=double,float platform=linux os=rocky9 target=x86_64_v4
[e]          ^glibc@2.34 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[e]      ^gcc@12.2.0+binutils+bootstrap~graphite+libsanitizer~mold~nvptx~piclibs~profiled~strip build_system=autotools build_type=RelWithDebInfo languages:='c,c++,fortran' platform=linux os=rocky9 target=x86_64
[+]      ^gcc-runtime@12.2.0 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[e]      ^glibc@2.34 build_system=autotools platform=linux os=rocky9 target=x86_64_v4
[^]      ^gmake@4.4.1~guile build_system=generic platform=linux os=rocky9 target=x86_64_v4
[^]          ^gcc-runtime@11.4.1 build_system=generic platform=linux os=rocky9 target=x86_64_v4
[+]      ^kokkos@4.6.02~aggressive_vectorization~alloc_async~cmake_lang~compiler_warnings+complex_align+cuda~cuda_constexpr~cuda_lambda~cuda_ldg_intrinsic~cuda_relocatable_device_code~cuda_uvm~debug~debug_bounds_check~debug_dualview_modify_check~deprecated_code~examples~hip_relocatable_device_code~hpx~hpx_async_dispatch~hwloc~ipo~memkind~numactl~openmp~openmptarget~pic~rocm+serial+shared~sycl~tests~threads~tuning+wrapper build_system=cmake build_type=Release cuda_arch=80 cxxstd=17 generator=make intel_gpu_arch=none platform=linux os=rocky9 target=x86_64_v4 %cxx=gcc@12.2.0
[+]          ^kokkos-nvcc-wrapper@5.0.2 build_system=generic platform=linux os=rocky9 target=x86_64_v4 %cxx=gcc@12.2.0
[e]      ^openmpi@5.0.5+atomics~cuda~debug+gpfs~internal-hwloc~internal-libevent~internal-pmix~java~lustre~memchecker~openshmem~romio+rsh~static~two_level_namespace+vt+wrapper-rpath build_system=autotools fabrics:=none romio-filesystem:=none schedulers:=none platform=linux os=rocky9 target=x86_64_v4

With this final amended spec, the installation should complete without any further errors:

spack install output (click to expand)
$ spack -C ${HOME}/spack-config-templates/1.1.1 install -j ${SLURM_NTASKS} lammps +cuda cuda_arch=80 +kokkos fft_kokkos=kiss ^kokkos+wrapper ^openmpi ^kokkos@4
[+] /usr (external glibc-2.34-xri56vcyzs7kkvakhoku3fefc46nw25y)
[+] /usr (external glibc-2.34-q2367nemoxqj6j3fg54cg4mjlkvc7f5n)
[+] /share/apps/rocky9/general/libs/openmpi/gcc/14.2.0/5.0.5 (external openmpi-5.0.5-ccatyv2dkfmw7f433zsigue7ffe2mrfi)
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gcc/12.2.0-6frskzg (external gcc-12.2.0-c6glrz75exefrjwq5gurxmxiqkc34ubt)
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/none-none/compiler-wrapper/1.0-oqjjbmb
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gcc-runtime/12.2.0-w77gg5r
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gcc-runtime/11.4.1-llid4hw
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/none-none/gcc-runtime/12.2.0-izdgkrf
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/nghttp2/1.57.0-4ntqcoo
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/fftw/3.3.10-tra2c2j
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/ncurses/6.5-4n2uzha
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/xz/5.4.6-rwn7pno
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gmake/4.4.1-xchit5a
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/zlib-ng/2.1.6-g2yruc3
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/openssl/3.3.0-filwsx6
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/libxml2/2.10.3-q6zmsq6
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/curl/8.7.1-v4za2y6
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/cuda/12.6.2-7ahvfr4
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/cmake/3.31.11-6b4ejcd
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/kokkos-nvcc-wrapper/5.0.2-d7eszle
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/kokkos/4.6.02-ppgy2ka
==> No binary for lammps-20250722.3-dgkbyfmbhwopxhyzk3gtbtfetjqbfebw found: installing from source
==> Installing lammps-20250722.3-dgkbyfmbhwopxhyzk3gtbtfetjqbfebw [22/22]
==> Using cached archive: /gpfs/scratch/abc123/spack/cache/_source-cache/archive/07/07f487cc33fc8f2ec4a449b7bce570e52b5a46608075e0276d26e0e232511bef.tar.gz
==> No patches needed for lammps
==> lammps: Executing phase: 'cmake'
==> lammps: Executing phase: 'build'
==> lammps: Executing phase: 'install'
==> lammps: Successfully installed lammps-20250722.3-dgkbyfmbhwopxhyzk3gtbtfetjqbfebw
  Stage: 2.84s.  Cmake: 3.79s.  Build: 11m 8.96s.  Install: 2.39s.  Post-install: 0.46s.  Total: 11m 19.09s
[+] /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/lammps/20250722.3-openmpi-5.0.5-dgkbyfm

Let's now return to our spack find command:

spack find output
$ spack -C ${HOME}/spack-config-templates/1.1.1 find -x -p -v lammps
-- linux-rocky9-x86_64_v4 / %c,cxx=gcc@12.2.0 -------------------
lammps@20250722.3~adios~amoeba~asphere~atc~awpmd~bocs~body~bpm~brownian~cg-dna~cg-spica~class2~colloid~colvars~compress~coreshell~cuda~cuda_mps~curl~dielectric~diffraction~dipole~dpd-basic~dpd-meso~dpd-react~dpd-smooth~drude~eff~electrode~extra-command~extra-compute~extra-dump~extra-fix~extra-molecule~extra-pair~fep~ffmpeg~granular~h5md~heffte~intel~interlayer~ipo~jpeg~kim+kokkos+kspace~latboltz~lepton+lib~machdyn~manifold+manybody~mc~mdi~meam~mesont~mgpt~misc~ml-hdnnp~ml-iap~ml-pace~ml-pod~ml-rann~ml-snap~ml-uf3~mofff+molecule~molfile+mpi~netcdf~opencl+openmp~openmp-package~opt~orient~peri~phonon~plugin~plumed~png~poems~ptm~python~qeq~qtb~reaction~reaxff~replica~rheo+rigid~rocm~scafacos~shock~smtbq~sph~spin~srd~tally~tools~uef~voronoi~vtk~yaff build_system=cmake build_type=Release fft=fftw3 fft_kokkos=fftw3 fftw_precision=double generator=make lammps_sizes=smallbig               /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/lammps/20250722.3-openmpi-5.0.5-zmkeqef
lammps@20250722.3~adios~amoeba~asphere~atc~awpmd~bocs~body~bpm~brownian~cg-dna~cg-spica~class2~colloid~colvars~compress~coreshell+cuda~cuda_mps~curl~dielectric~diffraction~dipole~dpd-basic~dpd-meso~dpd-react~dpd-smooth~drude~eff~electrode~extra-command~extra-compute~extra-dump~extra-fix~extra-molecule~extra-pair~fep~ffmpeg~granular~h5md~heffte~intel~interlayer~ipo~jpeg~kim+kokkos+kspace~latboltz~lepton+lib~machdyn~manifold+manybody~mc~mdi~meam~mesont~mgpt~misc~ml-hdnnp~ml-iap~ml-pace~ml-pod~ml-rann~ml-snap~ml-uf3~mofff+molecule~molfile+mpi~netcdf~opencl+openmp~openmp-package~opt~orient~peri~phonon~plugin~plumed~png~poems~ptm~python~qeq~qtb~reaction~reaxff~replica~rheo+rigid~rocm~scafacos~shock~smtbq~sph~spin~srd~tally~tools~uef~voronoi~vtk~yaff build_system=cmake build_type=Release cuda_arch:=80 fft=fftw3 fft_kokkos=kiss fftw_precision=double generator=make lammps_sizes=smallbig  /gpfs/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/lammps/20250722.3-openmpi-5.0.5-dgkbyfm

-- linux-rocky9-x86_64_v4 / no compilers ------------------------
lammps@20230802.3~adios~amoeba~asphere~atc~awpmd~bocs~body~bpm~brownian~cg-dna~cg-spica~class2~colloid~colvars~compress~coreshell~cuda~cuda_mps~dielectric~diffraction~dipole~dpd-basic~dpd-meso~dpd-react~dpd-smooth~drude~eff~electrode~extra-compute~extra-dump~extra-fix~extra-molecule~extra-pair~fep~ffmpeg~granular~h5md~intel~interlayer~ipo~jpeg~kim~kokkos+kspace~latboltz~lepton+lib~machdyn~manifold+manybody~mc~meam~mesont~mgpt~misc~ml-hdnnp~ml-iap~ml-pod~ml-rann~ml-snap~mofff+molecule~molfile+mpi~netcdf~opencl+openmp~openmp-package~opt~orient~peri~phonon~plugin~plumed~png~poems~ptm~python~qeq~qtb~reaction~reaxff~replica+rigid~rocm~shock~smtbq~sph~spin~srd~tally~uef~voronoi~vtk~yaff build_system=cmake build_type=Release fftw_precision=double generator=make gpu_precision=mixed lammps_sizes=smallbig                      /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/lammps/20230802.3-openmpi-5.0.3-b27kssh
lammps@20230802.3~adios~amoeba~asphere~atc~awpmd~bocs~body~bpm~brownian~cg-dna~cg-spica~class2~colloid~colvars~compress~coreshell+cuda~cuda_mps~dielectric~diffraction~dipole~dpd-basic~dpd-meso~dpd-react~dpd-smooth~drude~eff~electrode~extra-compute~extra-dump~extra-fix~extra-molecule~extra-pair~fep~ffmpeg~granular~h5md~intel~interlayer~ipo~jpeg~kim~kokkos+kspace~latboltz~lepton+lib~machdyn~manifold+manybody~mc~meam~mesont~mgpt~misc~ml-hdnnp~ml-iap~ml-pod~ml-rann~ml-snap~mofff+molecule~molfile+mpi~netcdf~opencl+openmp~openmp-package~opt~orient~peri~phonon~plugin~plumed~png~poems~ptm~python~qeq~qtb~reaction~reaxff~replica+rigid~rocm~shock~smtbq~sph~spin~srd~tally~uef~voronoi~vtk~yaff build_system=cmake build_type=Release cuda_arch:=70,80,90 fftw_precision=double generator=make gpu_precision=mixed lammps_sizes=smallbig  /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/lammps/20230802.3-openmpi-5.0.3-zqtg4sr
==> 4 installed packages

So now we have LAMMPS with the KOKKOS package activated (+kokkos) and LAMMPS with the KOKKOS package activated (+kokkos) and CUDA (+cuda cuda_arch=80) personally, alongside the two centrally installed non-KOKKOS versions.

As long as we still have our specified private module path loaded using module use as specified in modules.yaml:

module use /gpfs/scratch/${USER}/spack/privatemodules/linux-rocky9-x86_64_v4

Then we should see our personal versions available for use:

Output from module avail
$ module avail -l lammps
- Package/Alias -----------------------.- Versions --------.- Last mod. -------
/gpfs/scratch/abc123/spack/privatemodules/linux-rocky9-x86_64_v4:
lammps-gpu/20250722.3-openmpi-5.0.5-cuda-12.6.2-gcc-12.2.0-kokkos2026/06/19 11:05:49
lammps/20250722.3-openmpi-5.0.5-gcc-12.2.0-kokkos           2026/06/18 17:08:30

/share/apps/rocky9/environmentmodules/apocrita-modules/spack:
lammps-gpu/20230802.3-openmpi-5.0.3-cuda-12.4.0-gcc-12.2.0  2026/06/18 10:02:13
lammps/20230802.3-openmpi-5.0.3-gcc-12.2.0                  2026/06/18 10:02:13

And indeed, we can load and use our personal version:

Use a GPU node for execution

As with compilation and installation. any GPU version of LAMMPS must also be executed on a GPU node, otherwise you will see the following error message as there will be no CUDA libraries present on the node:

lmp: error while loading shared libraries: libcuda.so.1: cannot open shared object file: No such file or directory
Output from module load (click to expand)
$ module load lammps-gpu/20250722.3-openmpi-5.0.5-cuda-12.6.2-gcc-12.2.0-kokkos
Loading lammps-gpu/20250722.3-openmpi-5.0.5-cuda-12.6.2-gcc-12.2.0-kokkos
  Loading requirement: cuda/12.6.2-gcc-12.2.0 openmpi/5.0.5-gcc-14.2.0

$ lmp -help

Large-scale Atomic/Molecular Massively Parallel Simulator - 22 Jul 2025 - Update 3

Usage example: lmp -var t 300 -echo screen -in in.alloy

List of command-line options supported by this LAMMPS executable:

-echo none/screen/log/both  : echoing of input script (-e)
-help                       : print this help message (-h)
-in none/filename           : read input from file or stdin (default) (-i)
-kokkos on/off ...          : turn KOKKOS mode on or off (-k)
-log none/filename          : where to send log output (-l)
-mdi '<mdi flags>'          : pass flags to the MolSSI Driver Interface
-mpicolor color             : which exe in a multi-exe mpirun cmd (-m)
-cite                       : select citation reminder style (-c)
-nocite                     : disable citation reminder (-nc)
-nonbuf                     : disable screen/logfile buffering (-nb)
-package style ...          : invoke package command (-pk)
-partition size1 size2 ...  : assign partition sizes (-p)
-plog basename              : basename for partition logs (-pl)
-pscreen basename           : basename for partition screens (-ps)
-restart2data rfile dfile ... : convert restart to data file (-r2data)
-restart2dump rfile dgroup dstyle dfile ...
                            : convert restart to dump file (-r2dump)
-restart2info rfile         : print info about restart rfile (-r2info)
-reorder topology-specs     : processor reordering (-r)
-screen none/filename       : where to send screen output (-sc)
-skiprun                    : skip loops in run and minimize (-sr)
-suffix gpu/intel/kk/opt/omp: style suffix to apply (-sf)
-var varname value          : set index style variable (-v)

OS: Linux "Rocky Linux 9.6 (Blue Onyx)" 5.14.0-570.39.1.el9_6.x86_64 x86_64

Compiler: GNU C++ 12.2.0 with OpenMP 4.5
C++ standard: C++17
Embedded fmt library version: 10.2.0
Embedded JSON class version: 3.12.0

MPI v3.1: Open MPI v5.0.5, package: Open MPI abc123@ddy60 Distribution, ident: 5.0.5, repo rev: v5.0.5, Jul 22, 2024

Accelerator configuration:

KOKKOS package API: CUDA Serial
KOKKOS package precision: double
Kokkos library version: 4.6.2

FFT information:

FFT precision  = double
FFT engine  = mpiFFT
FFT library = FFTW3
KOKKOS FFT engine  = mpiFFT
KOKKOS FFT library = KISS

Active compile time flags:

-DLAMMPS_GZIP
-DLAMMPS_SMALLBIG
sizeof(smallint): 32-bit
sizeof(imageint): 32-bit
sizeof(tagint):   32-bit
sizeof(bigint):   64-bit

Available compression formats:

Extension: .gz     Command: gzip
Extension: .bz2    Command: bzip2
Extension: .xz     Command: xz
Extension: .lzma   Command: xz


Installed packages:

KOKKOS KSPACE MANYBODY MOLECULE RIGID
(etc.)

We can see that KOKKOS appears in the listed "Accelerator configuration" and "Installed packages" sections as before, but this time using the "CUDA Serial" KOKKOS package API and "KOKKOS FFT library = KISS".

Summary

The above examples show just two of the many possible variants of LAMMPS that you can compile yourself. To compile additional variants, change the required parameters to (true) with + or (false) with ~ in spec and install commands, and remember Spack will always follow the defaults unless explicitly told otherwise.

You could, for example, spec and install a much more complex variant of LAMMPS such as:

lammps +adios +cuda cuda_arch=80 +jpeg +kokkos fft_kokkos=kiss +plumed ^kokkos+wrapper ^openmpi ^kokkos@4

which would compile with the Adios package activated, GPU support, JPEG support, the KOKKOS package activated with CUDA support and the PLUMED package activated. The more complex the variant, the less is likely to be already in upstream, so bear this in mind, as compilation and installation time may increase as well.