LAMMPS
Introduction
Large-scale Atomic/Molecular Massively Parallel Simulator (LAMMPS) is a classical molecular dynamics code. LAMMPS can simulate solid-state materials (metals, semiconductors), soft matter (biomolecules, polymers), and coarse-grained or mesoscopic systems. LAMMPS runs on single processors or in parallel using message-passing techniques with spatial decomposition of the simulation domain. The code is designed to be easy to modify or extend with new functionality.
Running LAMMPS in HPCC
Submitting a LAMMPS job to Nocona
There are two LAMMPS modules in Nocona: NAMD built against GCC 14.2.0 and LAMMPS built against AOCC 4.2.0.
Create a job submission script with the following content as a reference:
#!/bin/bash
#SBATCH --job-name=lmp_nocona
#SBATCH --partition=nocona
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=32
#SBATCH --cpus-per-task=4
#SBATCH --output=%N.%j.out
#SBATCH --error=%N.%j.err
module load gcc/14.2.0 openmpi/5.0.5 lammps/20240829-mpi-omp
# The most efficient way of running LAMMPS on Nocona nodes with AMD architecture
# is to leverage the multi-processing and multi-threading features in LAMMPS. In order to
# do that, we go with 32 MPI processes per node (out of 128), and after mapping each process
#to L3cache, we let them spawn 4 OpenMP threads across four CPU cores that share the
# same L3cache:
export OMP_NUM_THREADS=4
mpirun --map-by l3cache lmp -in in.lj
#!/bin/bash
#SBATCH --job-name=lmp_nocona
#SBATCH --partition=nocona
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=32
#SBATCH --cpus-per-task=4
#SBATCH --output=%N.%j.out
#SBATCH --error=%N.%j.err
module load aocc/4.2.0 openmpi/5.0.5 lammps/20240829-mpi-omp
# The most efficient way of running LAMMPS on Nocona nodes with AMD architecture
# is to leverage the multi-processing and multi-threading features in LAMMPS. In order to
# do that, we go with 32 MPI processes per node (out of 128), and after mapping each process
#to L3cache, we let them spawn 4 OpenMP threads across four CPU cores that share the
# same L3cache:
export OMP_NUM_THREADS=4
mpirun --map-by l3cache lmp -in in.lj
Submitting a LAMMPS job to Quanah
Create a job submission script with the following content as a reference:
#!/bin/bash
#SBATCH --job-name=lmp_quanah
#SBATCH --partition=quanah
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=36
#SBATCH --output=%N.%j.out
#SBATCH --error=%N.%j.err
module load gcc/14.2.0 openmpi/4.1.6 lammps/20240829-mpi-omp
mpirun --bind-to core lmp -in in.lj
Submitting a LAMMPS job to Matador
The available LAMMPS instances on GPU partitions come from the official Nvidia NGC LAMMPS container.
Note: The latest supported version of Nvidia NGC LAMMPS container on Matador partition with V100 GPUs is 15Jun2023.
#!/bin/bash
#SBATCH --job-name=lammps_gpus
#SBATCH --output=%x.o%j
#SBATCB --error=%x.e%j
#SBATCH --partition=matador
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=2 # Start with 1 MPI rank per GPU
#SBATCH --cpus-per-task=2 # CPU OpenMP threads per MPI rank
#SBATCH --gpus-per-node=2 # 1 GPU per MPI rank
#SBATCH --time=10:00:00
module load lammps/15Jun2023_gpu
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
export OMP_PROC_BIND=spread
export OMP_PLACES=threads
# Run pw.x (-npool should divide your k-points and usually match GPU count)
srun --mpi=pmi2 lmp -k on g 2 t $SLURM_CPUS_PER_TASK -sf kk \
-pk kokkos newton on neigh half -in in.lammps
Key Container & V100 Tuning Notes
-
MPI Handshake (
pmi2): The NGC container includes internal OpenMPI built withpmi2andpmix3support. Do not load a host OpenMPI module—let Slurm'ssrun --mpi=pmi2interface directly with the container's MPI. -
KOKKOS GPU Count (
g 2): The-k on g 2flag tells KOKKOS how many GPUs exist per node, matching--gpus-per-node=2and--ntasks-per-node=2. If you scale to 2 nodes with 2 V100s each (--nodes=2,--ntasks-per-node=2), keepg 2as2. -
GPU-Aware MPI Fallback: Because the container uses its internal MPI stack alongside host InfiniBand/drivers, if multi-GPU or multi-node runs crash during MPI communication, add
gpu/aware offto-pk kokkos(-pk kokkos newton on neigh half gpu/aware off).
Then submit this job using the sbatch command. Please make sure to edit the following Slurm parameters as needed:
Number of nodes (--nodes): If you want to scale out your job to run across multiple worker nodes.
Number of MPI tasks (--ntasks-per-node): We recommend setting this parameter to the maximum number of available CPU cores
per node on each partition.
Wall time (--time): If your job wont take longer than 10 hours, leave it as it is. Adjust the wall time
based on how long you estimate your job will take.
Please contact HPCC support at hpccsupport@ttu.edu if you have any questions.
High Performance Computing Center
-
Phone
806.742.4350 -
Email
hpccsupport@ttu.edu