Skip to content

Commit

Permalink
add ncu tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
lcy-seso committed Sep 13, 2024
1 parent 23b8a00 commit 41f0ee5
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 0 deletions.
26 changes: 26 additions & 0 deletions artifacts/run_all_ncu_cutlass.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
ncu_dir="/home/sosp/env/spack/opt/spack/linux-ubuntu22.04-zen2/gcc-11.4.0/cuda-12.4.0-ypujjdfaen2zwiplopzke4ud33wddscv/bin"

root_dir=$(pwd)
log_dir="$root_dir/logs"
exe_path="cutlass/build/examples/41_fused_multi_head_attention/41_fused_multi_head_attention_fixed_seqlen"

nheads=8
batch_size=32
head_size=128
length=1024

if [ ! -f cutlass_attn ]; then
ln -s $exe_path cutlass_attn
fi

# 1. ncu test the mha benchmark
echo "NCU profiling mha benchmark"
$ncu_dir/ncu --section "MemoryWorkloadAnalysis" \
--csv --set full cutlass_attn --nheads="$nheads" \
--batch_size=$batch_size \
--head_size=$head_size \
--head_size_v=$head_size \
--seq_length="$length" \
--seq_length_kv=$length \
--causal=false > $log_dir/cutlass_attention_ncu.csv
13 changes: 13 additions & 0 deletions artifacts/run_all_ncu_flash2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
ncu_dir="/home/sosp/env/spack/opt/spack/linux-ubuntu22.04-zen2/gcc-11.4.0/cuda-12.4.0-ypujjdfaen2zwiplopzke4ud33wddscv/bin"

root_dir=$(pwd)
log_dir="$root_dir/logs"
benchmark_dir="FractalTensor/benchmarks"
mha_dir="$benchmark_dir/multi-head_attention/baseline"

# 1. ncu test the mha benchmark
echo "NCU profiling mha benchmark"
$ncu_dir/ncu --section "MemoryWorkloadAnalysis" \
--csv --set full python3 $stack_rnn_path/$mha_dir/test_pt_model.py > $log_dir/flash2_attention_ncu.csv

19 changes: 19 additions & 0 deletions artifacts/run_all_ncu_ft.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
ncu_dir="/home/sosp/env/spack/opt/spack/linux-ubuntu22.04-zen2/gcc-11.4.0/cuda-12.4.0-ypujjdfaen2zwiplopzke4ud33wddscv/bin"

root_dir=$(pwd)
log_dir="$root_dir/logs"
benchmark_dir="FractalTensor/benchmarks"

# 1. ncu test the mha benchmark
echo "NCU profiling mha benchmark"
mha_dir="$benchmark_dir/multi-head_attention/fractaltensor/build"
mha_exe="$mha_dir/main"
$ncu_dir/ncu --section "MemoryWorkloadAnalysis" \
--csv --set full $mha_exe > $log_dir/ft_attention_ncu.csv

# 2. ncu test the bigbird benchmark
bigbird_dir="$benchmark_dir/blocked_sparse_attention/fractaltensor/build"
echo "NCU profiling BigBird benchmark"
$ncu_dir/ncu --section "MemoryWorkloadAnalysis" \
--csv --set full $bigbird_dir/bigbird > $log_dir/ft_bigbird_ncu.csv
15 changes: 15 additions & 0 deletions artifacts/run_all_ncu_pt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
ncu_dir="/home/sosp/env/spack/opt/spack/linux-ubuntu22.04-zen2/gcc-11.4.0/cuda-12.4.0-ypujjdfaen2zwiplopzke4ud33wddscv/bin"

root_dir=$(pwd)
log_dir="$root_dir/logs"
benchmark_dir="FractalTensor/benchmarks"
mha_dir="$benchmark_dir/multi-head_attention/baseline"

bigbird_dir="$benchmark_dir/blocked_sparse_attention/pytorch"

# 2. ncu test the bigbird benchmark
echo "NCU profiling BigBird benchmark"
$ncu_dir/ncu --section "MemoryWorkloadAnalysis" \
--csv --set full python3 $bigbird_dir/main.py > $log_dir/pt_bigbird_ncu.csv

20 changes: 20 additions & 0 deletions artifacts/run_all_ncu_triton.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
ncu_dir="/home/sosp/env/spack/opt/spack/linux-ubuntu22.04-zen2/gcc-11.4.0/cuda-12.4.0-ypujjdfaen2zwiplopzke4ud33wddscv/bin"

root_dir=$(pwd)
log_dir="$root_dir/logs"
benchmark_dir="FractalTensor/benchmarks"
mha_dir="$benchmark_dir/multi-head_attention/baseline"

# 1. ncu test the mha benchmark
echo "NCU profiling mha benchmark"
$ncu_dir/ncu --section "MemoryWorkloadAnalysis" \
--csv --set full python3 $stack_rnn_path/$mha_dir/test_triton_model.py > $log_dir/triton_attention_ncu.csv


bigbird_dir="$benchmark_dir/blocked_sparse_attention/triton"
# 2. ncu test the bigbird benchmark
echo "NCU profiling BigBird benchmark"
$ncu_dir/ncu --section "MemoryWorkloadAnalysis" \
--csv --set full python3 $bigbird_dir/main.py \
--default_test > $log_dir/triton_bigbird_ncu.csv

0 comments on commit 41f0ee5

Please sign in to comment.