-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf90cc0
commit cdbdf54
Showing
38 changed files
with
531 additions
and
315 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: 'Benchmark' | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
self: | ||
name: Georgia Tech | Phoenix (NVHPC) | ||
if: github.repository == 'MFlowCode/MFC' | ||
strategy: | ||
matrix: | ||
device: ['cpu', 'gpu'] | ||
runs-on: | ||
group: phoenix | ||
labels: self-hosted | ||
steps: | ||
- name: Clone - PR | ||
uses: actions/checkout@v3 | ||
with: | ||
path: pr | ||
|
||
- name: Clone - Master | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: henryleberre/MFC | ||
ref: master | ||
path: master | ||
|
||
- name: Bench (Master v. PR) | ||
run: | | ||
(cd pr && bash .github/workflows/phoenix/submit.sh .github/workflows/phoenix/bench.sh ${{ matrix.device }}) & | ||
(cd master && bash .github/workflows/phoenix/submit.sh .github/workflows/phoenix/bench.sh ${{ matrix.device }}) & | ||
wait %1 && wait %2 | ||
- name: Generate Comment | ||
run: | | ||
COMMENT_MSG=`python3 .github/workflows/phoenix/compare.py master/bench-${{ matrix.device }}.yaml pr/bench-${{ matrix.device }}.yaml` | ||
echo "COMMENT_MSG=\"$COMMENT_MSG\"" >> $GITHUB_ENV | ||
- name: Post Comment | ||
run: echo "$COMMENT_MSG" | ||
|
||
- name: Archive Logs | ||
uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: logs-${{ matrix.device }} | ||
path: | | ||
pr/bench-${{ matrix.device }}-* | ||
master/bench-${{ matrix.device }}-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
|
||
pull_request: | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
docs: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Lint | ||
run: ./mfc.sh lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
n_ranks=$(nproc) | ||
|
||
if [ "$job_device" == "gpu" ]; then | ||
n_ranks=$(nvidia-smi -L | wc -l) # number of GPUs on node | ||
gpu_ids=$(seq -s ' ' 0 $(($n_ranks-1))) # 0,1,2,...,gpu_count-1 | ||
device_opts="--gpu -g $gpu_ids" | ||
fi | ||
|
||
./mfc.sh bench -j $(nproc) -o "$job_slug.yaml" -- -b mpirun $device_opts -n $n_ranks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import argparse | ||
|
||
import yaml | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument('master', metavar="MASTER", type=str) | ||
parser.add_argument('pr', metavar="PR", type=str) | ||
|
||
args = parser.parse_args() | ||
|
||
def load_cases(filepath): | ||
raw = yaml.safe_load(open(filepath)) | ||
|
||
cases = { case["slug"]: case for case in raw["cases"] } | ||
|
||
for target in ["pre_process", "simulation"]: | ||
for case in cases: | ||
cases[case][target] = cases[case][target]["runtime"][target] | ||
|
||
return cases | ||
|
||
master, pr = load_cases(args.master), load_cases(args.pr) | ||
|
||
master_keys = set(master.keys()) | ||
pr_keys = set(pr.keys()) | ||
|
||
missing_cases = master_keys.symmetric_difference(pr_keys) | ||
|
||
if len(missing_cases) > 0: | ||
print("**Warning:** The following cases are **missing** from master or this PR:\n") | ||
|
||
for case in missing_cases: | ||
print(f" - {case}.") | ||
|
||
print("") | ||
|
||
speedups = {} | ||
|
||
for case in master_keys.intersection(pr_keys): | ||
speedups[case] = { | ||
"pre_proess": pr[case]["pre_process"] / master[case]["pre_process"], | ||
"simulation": pr[case]["simulation"] / master[case]["simulation"], | ||
} | ||
|
||
avg_speedup = sum([ speedups[case]["simulation"] for case in speedups ]) / len(speedups) | ||
|
||
print(f"""\ | ||
**[Benchmark Results]** Compared to Master, this PR's `simulation` is on average **~{avg_speedup:0.2f}x faster**. | ||
| **Case** | **Master** | **PR** | **Speedup** | | ||
| -------- | ---------- | ------ | ----------- |\ | ||
""") | ||
|
||
for case in sorted(speedups.keys()): | ||
speedup = speedups[case] | ||
|
||
print(f"| {case} | {master[case]['simulation']:0.2f}s | {pr[case]['simulation']:0.2f}s | {speedups[case]['simulation']:0.2f}x |") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
usage() { | ||
echo "Usage: $0 [script.sh] [cpu|gpu]" | ||
} | ||
|
||
if [ ! -z "$1" ]; then | ||
sbatch_script_contents=`cat $1` | ||
else | ||
usage | ||
exit 1 | ||
fi | ||
|
||
sbatch_cpu_opts="\ | ||
#SBATCH -p cpu-small # partition | ||
#SBATCH --ntasks-per-node=24 # Number of cores per node required | ||
#SBATCH --mem-per-cpu=2G # Memory per core\ | ||
" | ||
|
||
sbatch_gpu_opts="\ | ||
#SBATCH -CV100-16GB | ||
#SBATCH -G2\ | ||
" | ||
|
||
if [ "$2" == "cpu" ]; then | ||
sbatch_device_opts="$sbatch_cpu_opts" | ||
elif [ "$2" == "gpu" ]; then | ||
sbatch_device_opts="$sbatch_gpu_opts" | ||
else | ||
usage | ||
exit 1 | ||
fi | ||
|
||
job_slug="`basename "$1" | sed 's/\.sh$//' | sed 's/[^a-zA-Z0-9]/-/g'`-$2" | ||
|
||
sbatch <<EOT | ||
#!/bin/bash | ||
#SBATCH -Jshb-$job_slug # Job name | ||
#SBATCH --account=gts-sbryngelson3 # charge account | ||
#SBATCH -N1 # Number of nodes required | ||
$sbatch_device_opts | ||
#SBATCH -t 04:00:00 # Duration of the job (Ex: 15 mins) | ||
#SBATCH -q embers # QOS Name | ||
#SBATCH -o$job_slug.out # Combined output and error messages file | ||
#SBATCH -W # Do not exit until the submitted job terminates. | ||
set -e | ||
set -x | ||
cd "\$SLURM_SUBMIT_DIR" | ||
echo "Running in $(pwd):" | ||
job_slug="$job_slug" | ||
job_device="$2" | ||
. ./mfc.sh load -c p -m $2 | ||
$sbatch_script_contents | ||
EOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
build_opts="" | ||
if [ "$job_device" == "gpu" ]; then | ||
build_opts="--gpu" | ||
fi | ||
|
||
./mfc.sh build -j $(nproc) $build_opts | ||
|
||
n_test_threads=$(nproc) | ||
|
||
if [ "$job_device" == "gpu" ]; then | ||
gpu_count=$(nvidia-smi -L | wc -l) # number of GPUs on node | ||
gpu_ids=$(seq -s ' ' 0 $(($gpu_count-1))) # 0,1,2,...,gpu_count-1 | ||
device_opts="-g $gpu_ids" | ||
n_test_threads=`expr $gpu_count \* 2` | ||
fi | ||
|
||
./mfc.sh test -a -j $n_test_threads $device_opts -- -b mpirun -f --bind-to none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
- slug: 3D_shockdroplet | ||
path: examples/3D_shockdroplet/case.py | ||
args: [] | ||
- slug: 3D_sphbubcollapse | ||
path: examples/3D_sphbubcollapse/case.py | ||
args: [] | ||
- slug: 3D_turb_mixing | ||
path: examples/3D_turb_mixing/case.py | ||
args: [] |
Oops, something went wrong.