LAMMPS : Compiling Kokkos package with CUDA in Ubuntu

Hello, I’m trying to compile the Kokkos package with CUDA in Ubuntu 24.04 version.
While compiling, I’ve faced some problems and would like to get some help.

The GPU of my computer is NVIDIA GeForce RTX 4090 and would like to compile with the Kokkos package to accelerate my simulation(which uses the MEAM potential).

I have downloaded Ubuntu 24.04 and installed the following programs in Ubuntu.
g++ 13.3.0
gcc 13.3.0
make 4.3
openssl 3.4.2
cmake 4.1.1
openmpi 5.0.8
CUDA 12.6
LAMMPS-22Jul2025 stable.tar.gz

I have made a “build” folder inside the LAMMPS-22Jul2025 and have compiled as follows.

cmake -C …/cmake/presets/basic.cmake -C …/cmake/presets/kokkos-cuda.cmake …/cmake

cmake -D Kokkos_ENABLE_CUDA=yes -D Kokkos_ENABLE_OPENMP=yes -D PKG_KOKKOS=yes -D PKG_MEAM=on -D PKG_MOLECULE=on -D PKG_OPENMP=yes -D GPU_API=cuda -D GPU_ARCH=sm_89 …/cmake

make -j30

And have set the path of the lmp executable to the
“/.bashrc”
as said in this documentation “8.6.7. Using LAMMPS on Windows 10 with WSL — LAMMPS documentation

Now I have made a separate folder inside LAMMPS-22Jul2025 called “My-sim” to put my input script and run my simulation

However as I run the simulation using this command from this documentation “7.4.3. KOKKOS package — LAMMPS documentation
“mpirun -np 2 lmp_kokkos_cuda_openmpi -k on g 2 -sf kk -in in.lj”

It gives an error as below.
"prterun was unable to find the specified executable file, and therefore did
not launch the job. This error was first reported for process rank
0; it may have occurred for other processes as well.

NOTE: A common cause for this error is misspelling a prterun command
line parameter option (remember that prterun interprets the first
unrecognized command line token as the executable).

Node: DESKTOP-NAME
Executable: lmp_kokkos_cuda_openmpi"

Well, changing the “lmp_kokkos_cuda_openmpi” to “lmp” runs my simulation.
I’m just confused whether it is fine to run it by using the “lmp” and how could I know whether the simulation is using my GPU for calculation.

1 Like

My understanding is that, if you are compiling with cmake, then the executable name is always lmp no matter what options are used.

1 Like

Not always, you can set the executable suffix with -D LAMMPS_MACHINE=<some string>. See. 3.5. Basic build options — LAMMPS documentation
But few people use that option.

1 Like