forked from microsoft/onnxruntime
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
collect the configs for rocblas miopen and tensile
- Loading branch information
root
committed
Nov 16, 2023
1 parent
b0b514f
commit 76642d2
Showing
4 changed files
with
84 additions
and
6 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
35 changes: 35 additions & 0 deletions
35
onnxruntime/python/tools/transformers/models/llama2/llama2_config.sh
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,35 @@ | ||
#!/bin/bash | ||
N_GPU=1 | ||
|
||
bash sample_run.sh $N_GPU --export --optimize --merge | ||
|
||
MODEL_NAME=ort-llama2-7b-${N_GPU}gpu | ||
LOGFILE=$MODEL_NAME.log | ||
|
||
export ROCBLAS_LAYER=2 | ||
bash sample_run.sh $N_GPU --optimize --merge --custom-gen --benchmark --ort 2>&1 | tee ${MODEL_NAME}_rocblas_configs.log | ||
sed -i '/\[[0-9]+,[0-9]+\]<stderr>:/d' ${MODEL_NAME}_rocblas_configs.log | ||
grep -o "rocblas-bench.*" ${MODEL_NAME}_rocblas_configs.log | sort -u &> unique_rocblas_configs_$MODEL_NAME.log | ||
unset ROCBLAS_LAYER | ||
|
||
export MIOPEN_ENABLE_LOGGING_CMD=1 | ||
bash sample_run.sh $N_GPU --optimize --merge --custom-gen --benchmark --ort 2>&1 | tee ${MODEL_NAME}_miopen_configs.log | ||
sed -i '/\[[0-9]+,[0-9]+\]<stderr>:/d' ${MODEL_NAME}_miopen_configs.log | ||
grep "MIOpenDriver " ${MODEL_NAME}_miopen_configs.log | sed -e 's/.*]//' | sort -u &> unique_miopen_configs_$MODEL_NAME.log | ||
unset MIOPEN_ENABLE_LOGGING_CMD | ||
|
||
export TENSILE_DB=0x8000 # dump Tensile kernel names | ||
bash sample_run.sh $N_GPU --optimize --merge --custom-gen --benchmark --ort 2>&1 | tee ${MODEL_NAME}_tensile_configs.log | ||
sed -i '/\[[0-9]+,[0-9]+\]<stderr>:/d' | ||
grep "Running kernel: " ${MODEL_NAME}_tensile_configs.log | sort -u &> unique_kernel_names_$MODEL_NAME.log | ||
unset TENSILE_DB | ||
|
||
# export HIPBLASLT_LOG_LEVEL=2 | ||
# unset HIPBLASLT_LOG_LEVEL | ||
|
||
echo "========================Math lib profiling done" | ||
|
||
export RCCL_MSCCL_ENABLE=0 | ||
NCCL_LOGFILE=$MODEL_NAME-NCCL.log | ||
HSA_FORCE_FINE_GRAIN_PCIE=1 NCCL_DEBUG=INFO NCCL_DEBUG_SUBSYS=INIT,COLL ./sample_run.sh $N_GPU --optimize --merge --custom-gen --benchmark --ort 2>&1 | tee $NCCL_LOGFILE | ||
python /workspace/nccl-rccl-parser/rccl_nccl_parser.py --nccl-debug-log $NCCL_LOGFILE --output-script-name unique_nccl_configs_$MODEL_NAME.log --unique |
43 changes: 43 additions & 0 deletions
43
onnxruntime/python/tools/transformers/models/llama2/parse_log.py
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,43 @@ | ||
import os | ||
import glob | ||
|
||
logList = glob.glob('ort-llama2*gpu.log') | ||
print(logList) | ||
|
||
for logFile in logList[:1]: | ||
print("============================") | ||
print("processing", logFile) | ||
rocblasLines=set() | ||
miopenLines=set() | ||
tensileLines=set() | ||
|
||
with open(logFile) as file: | ||
for line in file: | ||
# print(line) | ||
if "rocblas-bench" in line: | ||
rocblasLines.add(line[14:]) | ||
if "MIOpenDriver" in line: | ||
miopenLines.add(line[14:]) | ||
if "Running kernel" in line: | ||
tensileLines.add(line[14:]) | ||
|
||
print(len(rocblasLines)) | ||
print(len(miopenLines)) | ||
print(len(tensileLines)) | ||
|
||
rocblasLines = list(rocblasLines) | ||
print(rocblasLines) | ||
miopenLines = list(miopenLines) | ||
tensileLines = list(tensileLines) | ||
|
||
rocblasFileName = "unique_rocblas_configs_" + logFile | ||
miopenFileName = "unique_miopen_configs_" + logFile | ||
tensileFileName = "unique_tensile_configs_" + logFile | ||
|
||
# outFiles = [rocblasFileName, miopenFileName, tensileFileName] | ||
# outLines = [rocblasLines, miopenLines, tensileLines] | ||
|
||
# for outFileName, outLine in zip(outFiles, outLines): | ||
# with open(outFileName, 'w') as f: | ||
# for line in outLine: | ||
# f.write(f"{line}") |
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