Skip to content

Commit

Permalink
Added srun example for LAMMPS-gpu with multiple mpi threads per gpu
Browse files Browse the repository at this point in the history
RuiApostolo committed May 29, 2024

Verified

This commit was signed with the committer’s verified signature.
JLLeitschuh Jonathan Leitschuh
1 parent 322bfd0 commit 157c60b
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion docs/software-packages/lammps.md
Original file line number Diff line number Diff line change
@@ -69,7 +69,7 @@ forcefield/fix are available for GPU, a vast majority is, and more are
added with each new version. Check the LAMMPS documentation for GPU
compatibility with a specific command.

For example, the following script will run a LAMMPS MD job using 2 GPUs
For example, the following script will run a LAMMPS MD job using 2 GPUs, 1 MPI thread per GPU:

```bash
#!/bin/bash --login
@@ -94,6 +94,36 @@ module load lammps-gpu
srun lmp -sf gpu -pk gpu 2 -in input.file -l log.file
```

to increase the number of cores-per-gpu used, either use [OpenMP](https://docs.lammps.org/Speed_omp.html)
or increase the number of MPI threads, using the `--ntasks` and `--ntasks-per-node` SBATCH flags:


```bash
#!/bin/bash --login

# Slurm job options (name, compute nodes, job time)
#SBATCH --job-name=lammps_Example
#SBATCH --time=00:20:00
#SBATCH --nodes=1
#SBATCH --gres=gpu:2

# Replace [budget code] below with your project code (e.g. t01)
#SBATCH --account=[budget code]
# Replace [partition name] below with your partition name (e.g. standard,gpu)
#SBATCH --partition=[partition name]
# Replace [qos name] below with your qos name (e.g. standard,long,gpu)
#SBATCH --qos=[qos name]

# Load LAMMPS module
module load lammps-gpu

# --ntasks and --ntasks-per-node should be up to 10 x number of gpus requested.
export PARAMS=" --ntasks-per-node=20 --ntasks=20 --exclusive"
# Run using input in in.test
srun ${PARAMS} lmp -sf gpu -pk gpu 2 -in in.ethanol_optimized
```


## Compiling LAMMPS on Cirrus

Compile instructions for LAMMPS on Cirrus can be found on GitHub:

0 comments on commit 157c60b

Please sign in to comment.