-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun_sample.sh
More file actions
executable file
·55 lines (43 loc) · 2.76 KB
/
run_sample.sh
File metadata and controls
executable file
·55 lines (43 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Copyright 2023. All Rights Reserved.
# Author: Bruce-Lee-LY
# Date: 20:42:28 on Sun, Feb 12, 2023
#
# Description: run sample script
#!/bin/bash
set -euo pipefail
WORK_PATH=$(cd $(dirname $0) && pwd) && cd $WORK_PATH
rm -rf log ncu && mkdir -p log ncu
# $1: M, $2: N, $3: K
evaluate_gemm() {
echo "Evaluating $1 * $2 * $3"
$WORK_PATH/output/bin/benchmark_gemm -M=$1 -N=$2 -K=$3 -alpha=1.0 -beta=0.0 -is_bf16=false -warmup_iterations=1 -profiling_iterations=10 -sleep_duration=100 -enable_check=false > log/gemm_${1}_${2}_${3}.log 2>&1
sleep 3
}
# $1: M, $2: N, $3: K
ncu_gemm() {
echo "NCU $1 * $2 * $3"
sudo ncu --set full --target-processes all --force-overwrite -o ncu/gemm_${1}_${2}_${3} $WORK_PATH/output/bin/benchmark_gemm -M=$1 -N=$2 -K=$3 -alpha=1.0 -beta=0.0 -is_bf16=false -warmup_iterations=1 -profiling_iterations=1 -sleep_duration=100 -enable_check=false > log/ncu_gemm_${1}_${2}_${3}.log 2>&1
sleep 3
}
# $1:N, $2: K
benchmark_gemm() {
Ms=(1 2 4 8 16 32 64 128 256 512 1024 2048 3072 4096 5120 6144 7168 8192)
N=$1
K=$2
for M in ${Ms[@]};
do
evaluate_gemm $M $N $K
# ncu_gemm $M $N $K
done
}
# FP16
nohup $WORK_PATH/output/bin/benchmark_gemm -M=512 -N=2048 -K=1024 -alpha=1.0 -beta=0.0 -is_bf16=false -warmup_iterations=1 -profiling_iterations=10 -sleep_duration=100 -enable_check=true > log/gemm_512_2048_1024.log 2>&1 &
# sudo ncu --set full --target-processes all --force-overwrite -o ncu/gemm_512_2048_1024 $WORK_PATH/output/bin/gemm -M=512 -N=2048 -K=1024 -alpha=1.0 -beta=0.0 -is_bf16=false -warmup_iterations=1 -profiling_iterations=1 -sleep_duration=100 -enable_check=false > log/ncu_gemm_512_2048_1024.log 2>&1
# BF16
# nohup $WORK_PATH/output/bin/benchmark_gemm -M=512 -N=2048 -K=1024 -alpha=1.0 -beta=0.0 -is_bf16=true -warmup_iterations=1 -profiling_iterations=10 -sleep_duration=100 -enable_check=true > log/gemm_512_2048_1024.log 2>&1 &
# sudo ncu --set full --target-processes all --force-overwrite -o ncu/gemm_512_2048_1024 $WORK_PATH/output/bin/gemm -M=512 -N=2048 -K=1024 -alpha=1.0 -beta=0.0 -is_bf16=true -warmup_iterations=1 -profiling_iterations=1 -sleep_duration=100 -enable_check=false > log/ncu_gemm_512_2048_1024.log 2>&1
# beta == 1
# nohup $WORK_PATH/output/bin/benchmark_gemm -M=512 -N=2048 -K=1024 -alpha=1.0 -beta=1.0 -is_bf16=false -warmup_iterations=1 -profiling_iterations=10 -sleep_duration=100 -enable_check=true > log/gemm_512_2048_1024.log 2>&1 &
# sudo ncu --set full --target-processes all --force-overwrite -o ncu/gemm_512_2048_1024 $WORK_PATH/output/bin/gemm -M=512 -N=2048 -K=1024 -alpha=1.0 -beta=0.0 -is_bf16=false -warmup_iterations=1 -profiling_iterations=1 -sleep_duration=100 -enable_check=false > log/ncu_gemm_512_2048_1024.log 2>&1
# benchmark_gemm 4096 4096
# benchmark_gemm 8192 8192