diff --git a/benchmarks/lammps-nvidia/.gitignore b/benchmarks/lammps-nvidia/.gitignore new file mode 100644 index 0000000..dad979a --- /dev/null +++ b/benchmarks/lammps-nvidia/.gitignore @@ -0,0 +1,4 @@ +lammps.sif +log.lammps +out.* +logs/ \ No newline at end of file diff --git a/benchmarks/lammps-nvidia/README.md b/benchmarks/lammps-nvidia/README.md new file mode 100644 index 0000000..7fba52c --- /dev/null +++ b/benchmarks/lammps-nvidia/README.md @@ -0,0 +1,3 @@ +'run.sh' and 'install.sh' assume that conda is on the path. You may need to modify to load conda. + +`submit.sh` is a simple test script to submit on Bridges-2. \ No newline at end of file diff --git a/benchmarks/lammps-nvidia/get_performance.py b/benchmarks/lammps-nvidia/get_performance.py new file mode 100644 index 0000000..9fce2c8 --- /dev/null +++ b/benchmarks/lammps-nvidia/get_performance.py @@ -0,0 +1,32 @@ +import os +import json +import yaml + +out = {} +nextline = False +logfile = 'log.lammps' +path = '' +if not os.path.isfile(logfile): + path = 'benchmarks/lammps-allegro' +f = open(os.path.join(path,logfile)) +for line in f.readlines(): + if 'Performance' in line: + print(line) + out['raw1'] = line + _, p1, u1, p2, u2 = line.split(' ') + out['simulation length'] = float(p1) + out['simulation length units'] = u1[:-1] + out['timesteps/s'] = float(p2) + nextline = True + elif nextline: + print(line) + out['raw2'] = line + out['utilization'] = line.split(' ')[0] + nextline = False + +f.close() + +with open( + os.path.join(path,'out.yaml'),'w' +) as fl: + yaml.dump(out,fl) \ No newline at end of file diff --git a/benchmarks/lammps-nvidia/in.lj.txt b/benchmarks/lammps-nvidia/in.lj.txt new file mode 100644 index 0000000..01e12ef --- /dev/null +++ b/benchmarks/lammps-nvidia/in.lj.txt @@ -0,0 +1,30 @@ +# 3d Lennard-Jones melt + +variable x index 1 +variable y index 1 +variable z index 1 + +variable xx equal 20*$x +variable yy equal 20*$y +variable zz equal 20*$z + +units lj +atom_style atomic + +lattice fcc 0.8442 +region box block 0 ${xx} 0 ${yy} 0 ${zz} +create_box 1 box +create_atoms 1 box +mass 1 1.0 + +velocity all create 1.44 87287 loop geom + +pair_style lj/cut 2.5 +pair_coeff 1 1 1.0 1.0 2.5 + +neighbor 0.3 bin +neigh_modify delay 0 every 20 check no + +fix 1 all nve + +run 100 diff --git a/benchmarks/lammps-nvidia/install.sh b/benchmarks/lammps-nvidia/install.sh new file mode 100755 index 0000000..8906047 --- /dev/null +++ b/benchmarks/lammps-nvidia/install.sh @@ -0,0 +1,7 @@ +chmod +x run.sh + +mkdir logs + +conda create -n env python=3.9 +conda activate env +conda install pyyaml \ No newline at end of file diff --git a/benchmarks/lammps-nvidia/run.sh b/benchmarks/lammps-nvidia/run.sh new file mode 100755 index 0000000..0741f28 --- /dev/null +++ b/benchmarks/lammps-nvidia/run.sh @@ -0,0 +1,19 @@ +#!/usr/bin/bash + +set -e; set -o pipefail + +# Build SIF, if it doesn't exist +if [[ ! -f lammps.sif ]]; then + singularity build lammps.sif docker://nvcr.io/hpc/lammps:29Oct2020 +fi + +readonly gpus_per_node=$(( SLURM_NTASKS / SLURM_JOB_NUM_NODES )) + +echo "Running Lennard Jones 8x8x8 example on ${SLURM_NTASKS} GPUS..." +# echo "Running 2NN MEAM example on ${SLURM_NTASKS} GPUS..." +srun --mpi=pmi2 \ +singularity run --nv -B ${PWD}:/host_pwd lammps.sif \ +lmp -k on g ${gpus_per_node} -sf kk -pk kokkos cuda/aware on neigh full comm device binsize 2.8 -var x 8 -var y 8 -var z 8 -in /host_pwd/in.lj.txt + +conda activate env +python get_performance.py \ No newline at end of file diff --git a/benchmarks/lammps-nvidia/submit.sh b/benchmarks/lammps-nvidia/submit.sh new file mode 100644 index 0000000..58fed7a --- /dev/null +++ b/benchmarks/lammps-nvidia/submit.sh @@ -0,0 +1,16 @@ +#!/usr/bin/bash + +#SBATCH -t 00-01:00 +#SBATCH -J lammps_benchmark +#SBATCH -o logs/output.%j +#SBATCH -e logs/error.%j +#SBATCH -p GPU-shared +#SBATCH -N 1 +#SBATCH --ntasks=1 +#SBATCH --gpus=v100-32:1 +#SBATCH --mem-per-gpu=50000 +#SBATCH --mail-user=eannevel@andrew.cmu.edu + +module load anaconda3 + +./run.sh \ No newline at end of file