Skip to content

Commit

Permalink
add lammps example
Browse files Browse the repository at this point in the history
  • Loading branch information
marconetto committed Jul 15, 2024
1 parent c876a88 commit 11b9a72
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,17 @@ The example for this app ([files
here](https://github.com/Azure/hpcadvisor/tree/main/examples/namd/)) is based on
installation using the binary from NAMD official website.


## LAMMPS

Large-scale Atomic/Molecular Massively Parallel Simulator (LAMMPS) is
a molecular dynamics simulator designed to model particles in a variety of
scientific and engineering applications. Developed by Sandia National
Laboratories, it is highly scalable, so one can run it on single processors or
in parallel using message-passing techniques. LAMMPS uses spatial-decomposition
techniques to partition the simulation domain into small 3D sub-domains, one of
which is assigned to each processor.

The example for this app ([files
here](https://github.com/Azure/hpcadvisor/tree/main/examples/lammps/)) is based
on installation using [EESSI](https://www.eessi.io/).
64 changes: 64 additions & 0 deletions examples/lammps/appsetup_lammps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env bash

set -x

APP_EXE_PATH="${AZ_BATCH_NODE_MOUNTS_DIR}/data/"
echo "APP_EXE_PATH=$APP_EXE_PATH"

function setup_data {
echo "Downloading data for lammps"
wget https://www.lammps.org/inputs/in.lj.txt

}

function generate_run_script {

cat <<EOF >run_app.sh
#!/bin/bash
set -x
cd \$AZ_TASKRUN_DIR
echo "Execution directory: \$(pwd)"
source /cvmfs/software.eessi.io/versions/2023.06/init/bash
module load LAMMPS
which mpirun
which lmp
cp ../in.lj.txt .
NP=\$((\$NODES*\$PPN))
export UCX_NET_DEVICES=mlx5_ib0:1
input_file="in.lj.txt"
new_x=10
new_y=10
new_z=10
sed -i "s/variable\s\+x\s\+index\s\+[0-9]\+/variable x index \$new_x/" \$input_file
sed -i "s/variable\s\+y\s\+index\s\+[0-9]\+/variable y index \$new_y/" \$input_file
sed -i "s/variable\s\+z\s\+index\s\+[0-9]\+/variable z index \$new_z/" \$input_file
time mpirun -np \$NP lmp -i in.lj.txt
###
log_file="log.lammps"
if grep -q "Total wall time:" "\$log_file"; then
echo "Simulation completed successfully."
exit 0
else
echo "Simulation did not complete successfully."
exit 1
fi
EOF
chmod +x run_app.sh
}

cd "$APP_EXE_PATH" || exit
setup_data
generate_run_script
3 changes: 3 additions & 0 deletions examples/lammps/plotfilterlammps.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"appname": "lammps"
}
Binary file added plots_20240712132757/plot_1_exectime_vs_cost.pdf
Binary file not shown.

0 comments on commit 11b9a72

Please sign in to comment.