加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
run_pgo.sh 5.27 KB
一键复制 编辑 原始数据 按行查看 历史
xliu 提交于 2023-07-14 02:57 . !80 split fasta case
#!/bin/bash
declare -A testSets
testSets["arrayAccess"]="./ts-swift-workload/array-access/ts/"
testSets["fannkuc-redux"]="./ts-swift-workload/array-access/ts/"
testSets["fastarepeat"]="./ts-swift-workload/array-access/ts/"
testSets["fastarandom1"]="./ts-swift-workload/array-access/ts/"
testSets["fastarandom2"]="./ts-swift-workload/array-access/ts/"
testSets["mandelbrot"]="./ts-swift-workload/array-access/ts/"
testSets["spectralnorm"]="./ts-swift-workload/array-access/ts/"
testSets["threeDCube"]="./ts-swift-workload/array-access/ts/"
testSets["threeDRaytrace"]="./ts-swift-workload/array-access/ts/"
testSets["Method_Call"]="./ts-swift-workload/function-call/ts/"
testSets["Normal_Call"]="./ts-swift-workload/function-call/ts/"
testSets["Pointer_Call"]="./ts-swift-workload/function-call/ts/"
testSets["StaticFunc_Call"]="./ts-swift-workload/function-call/ts/"
testSets["nbody"]="./ts-swift-workload/nbody/ts/"
testSets["cocos"]="./ts-swift-workload/cocos/ts/"
testSets["bitops"]="./ts-swift-workload/numerical-calculation/ts/"
testSets["cordic"]="./ts-swift-workload/numerical-calculation/ts/"
testSets["numericalComputation"]="./ts-swift-workload/numerical-calculation/ts/"
testSets["binarySearchFloat"]="./ts-swift-workload/numerical-calculation/ts/"
testSets["binarySearchInteger"]="./ts-swift-workload/numerical-calculation/ts/"
testSets["partialSum"]="./ts-swift-workload/numerical-calculation/ts/"
testSets["propertyaccess2"]="./ts-swift-workload/property-access/ts/"
testSets["splay"]="./ts-swift-workload/splay/ts/"
sdk_path="../.."
ark_js_vm="ark_js_vm"
toolspath=./toolspath.txt
if [ -s "$toolspath" ]; then
while IFS= read -r line; do
if [[ $line == *--tools-path\ * ]]; then
sdk_path="${line#*--tools-path\ }"
fi
if [[ $line == *--ark_js_vm\ * ]]; then
ark_js_vm="${line#*--ark_js_vm\ }"
fi
if [[ $line == *--es2abc\ * ]]; then
es2abc="${line#*--es2abc\ }"
fi
if [[ $line == *--ark_aot_compiler\ * ]]; then
ark_aot_compiler="${line#*--ark_aot_compiler\ }"
fi
done < "toolspath.txt"
fi
arg_name=""
true="true"
false="false"
run_count=1
date=$(date +'%Y%m%d%H%M%S')
function help_explain(){
echo "[--help,--h]"
echo "[--date <date>]"
echo "[--run-count <count>]"
echo "[--case <case-name>]"
echo "[--build]"
echo "[--excel]"
}
if [ -z "$1" ]; then
echo "No input provided."
else
for arg in "$@"; do
case $arg_name in
"--case")
arg_name=""
case_name=$arg
;;
"--date")
arg_name=""
date=$arg
;;
"--run-count")
arg_name=""
run_count=$arg
;;
esac
case $arg in
"--h")
help_explain
exit
;;
"--help")
help_explain
exit
;;
"--build")
build="true"
;;
"--case")
arg_name=$arg
;;
"--date")
arg_name=$arg
;;
"--excel")
excel="true"
;;
"--run-count")
arg_name=$arg
;;
esac
done
fi
pgo2path="pgo_build/${date}"
$es2abc $sdk_path/arkcompiler/ets_runtime/ecmascript/ts_types/lib_ark_builtins.d.ts --type-extractor --type-dts-builtin --module --merge-abc --extension=ts --output $sdk_path/arkcompiler/ets_runtime/ecmascript/ts_types/lib_ark_builtins.d.abc
function build_pgo(){
local ts_file=$1$2.ts
local file_name=$2
local abc_file=${pgo2path}/${file_name}.abc
${file_name}
${es2abc} ${ts_file} --type-extractor --module --merge-abc --extension=ts --output ${pgo2path}/${file_name}.abc
${ark_js_vm} --log-level=info --enable-pgo-profiler=true --compiler-opt-inlining=true --compiler-pgo-profiler-path=./${pgo2path}/${file_name}.ap --log-level=info --asm-interpreter=true --entry-point=${file_name} ${abc_file}
${ark_aot_compiler} --log-level=info --enable-pgo-profiler=true --builtins-dts=${sdk_path}/arkcompiler/ets_runtime/ecmascript/ts_types/lib_ark_builtins.d.abc --compiler-pgo-profiler-path=./${pgo2path}/${file_name}.ap --aot-file=./${pgo2path}/${file_name} ${abc_file}
}
function run_pgo(){
local file_name=$1
local abc_file=${pgo2path}/${file_name}.abc
echo ${file_name}
${ark_js_vm} --entry-point=${file_name} --aot-file=./${pgo2path}/${file_name} ${abc_file}
}
if [[ "$build" = "true" ]]; then
if [ ! -d $pgo2path ];then
mkdir -p $pgo2path
fi
if [ -z "$case_name" ]; then
for key in ${!testSets[@]}; do
build_pgo ${testSets[${key}]} ${key}
done
else
build_pgo ${testSets[${case_name}]} ${case_name}
fi
fi
if [ ! -d $pgo2path ];then
echo "${pgo2path} No such file or directory"
exit
fi
if [[ "$excel" = "true" ]]; then
if [ -z "$case_name" ]; then
for key in ${!testSets[@]}; do
python pgo2excel.py --case-dir $pgo2path --run-case $key --run-count $run_count --ark_js_vm $ark_js_vm
done
else
python pgo2excel.py --case-dir $pgo2path --run-case $case_name --run-count $run_count --ark_js_vm $ark_js_vm
fi
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化