已合并
feat: add local_check.sh for local verification before PR #2984
feat: add local_check.sh for local verification before PR #2984
已合并
张旭创建于 5月27日
共 6 个文件变更+1246-17
@@ -15,6 +15,12 @@ op_category_list=$(perl -0777 -ne 'if (/set\(OPS_CATEGORY_LIST\s*(.*?)\)/s) { pr
15 15 
16IFS=' ' read -r -a op_categories <<< "$op_category_list"16IFS=' ' read -r -a op_categories <<< "$op_category_list"
17valid_dirs=()17valid_dirs=()
18+SOC_VERSION="ascend910b"
19+for arg in "$@"; do
20+ case "$arg" in
21+ --soc=*) SOC_VERSION="${arg#*=}" ;;
22+ esac
23+done
18pr_file=$(realpath "${1:-pr_filelist.txt}")24pr_file=$(realpath "${1:-pr_filelist.txt}")
19 25 
20for category in "${op_categories[@]}"26for category in "${op_categories[@]}"
@@ -84,9 +90,9 @@ done
84# run example for the modified op90# run example for the modified op
85for name in "${ops_name[@]}"91for name in "${ops_name[@]}"
86do92do
87- ./single/cann-ops-math-${name}_linux*.run --force93+ ./single/cann-ops-math-${name}_linux*.run --quiet --force
88- echo "[EXECUTE_COMMAND] bash build.sh --run_example $name eager cust --vendor_name=$name"94+ echo "[EXECUTE_COMMAND] bash build.sh --run_example $name eager cust --vendor_name=$name --soc=${SOC_VERSION}"
89- bash build.sh --run_example $name eager cust --vendor_name=$name95+ bash build.sh --run_example $name eager cust --vendor_name=$name --soc=${SOC_VERSION}
90 status=$?96 status=$?
91 if [ $status -ne 0 ]; then97 if [ $status -ne 0 ]; then
92 echo "${name} example fail"98 echo "${name} example fail"
@@ -9,15 +9,15 @@
9# ============================================================================9# ============================================================================
10 10 
11# 查找符合条件的二级目录:11# 查找符合条件的二级目录:
12-# 1. 一级目录由cmake/variables.cmake中的OP_CATEGORY_LIST直接提供12+# 1. 一级目录由cmake/variables.cmake中的OPS_CATEGORY_LIST直接提供
13# 2. 二级目录下需要包含/tests/ut/op_kernel文件夹13# 2. 二级目录下需要包含/tests/ut/op_kernel文件夹
14# 3. 构建出valid_dirs清单14# 3. 构建出valid_dirs清单
15 15 
16current_dir=$(pwd)16current_dir=$(pwd)
17variables_cmake="cmake/variables.cmake"17variables_cmake="cmake/variables.cmake"
18pr_file=$(realpath "${1:-pr_filelist.txt}")18pr_file=$(realpath "${1:-pr_filelist.txt}")
19-# 提取 OP_CATEGORY_LIST 的值19+# 提取 OPS_CATEGORY_LIST 的值
20-op_category_list=$(grep -oP 'set\(OP_CATEGORY_LIST\s*\K".*"' $current_dir/$variables_cmake | sed 's/"//g')20+op_category_list=$(grep -oP 'set\(OPS_CATEGORY_LIST\s*\K".*"' $current_dir/$variables_cmake | sed 's/"//g')
21IFS=' ' read -r -a op_categories <<< "$op_category_list"21IFS=' ' read -r -a op_categories <<< "$op_category_list"
22 22 
23#op_categories=("activation" "conv" "foreach" "vfusion" "index" "loss" "matmul" "norm" "optim" "pooling" "quant" "rnn" "control")23#op_categories=("activation" "conv" "foreach" "vfusion" "index" "loss" "matmul" "norm" "optim" "pooling" "quant" "rnn" "control")
@@ -83,7 +83,7 @@ for name in "${ops_name[@]}"
83do83do
84 for soc_version in "${supportedSocVersion[@]}"84 for soc_version in "${supportedSocVersion[@]}"
85 do85 do
86- echo "[EXECUTE_COMMAND] bash build.sh -u --opkernel --ops=$name --cov --soc=$soc_version"86+ echo "[EXECUTE_COMMAND] bash build.sh -u --opkernel --ops=$name --cov --soc=$soc_version --cann_3rd_lib_path=${ASCEND_3RD_LIB_PATH} -j16"
87 bash build.sh -u --opkernel --ops=$name --cov --soc=$soc_version --cann_3rd_lib_path=${ASCEND_3RD_LIB_PATH} -j1687 bash build.sh -u --opkernel --ops=$name --cov --soc=$soc_version --cann_3rd_lib_path=${ASCEND_3RD_LIB_PATH} -j16
88 status=$?88 status=$?
89 if [ $status -ne 0 ]; then89 if [ $status -ne 0 ]; then
@@ -99,7 +99,7 @@ if [[ "$found_mirror_update" == "true" ]]; then
99 operator_list_950=("${calc_ops_950[@]}")99 operator_list_950=("${calc_ops_950[@]}")
100 for name in "${operator_list_950[@]}"100 for name in "${operator_list_950[@]}"
101 do101 do
102- echo "[EXECUTE_COMMAND] bash build.sh -u --opapi --ophost --ops=$name --soc=ascend950"102+ echo "[EXECUTE_COMMAND] bash build.sh -u --opapi --ophost --ops=$name --soc=ascend950 --cann_3rd_lib_path=${ASCEND_3RD_LIB_PATH} -j16"
103 bash build.sh -u --opapi --ophost --ops=$name --soc=ascend950 --cann_3rd_lib_path=${ASCEND_3RD_LIB_PATH} -j16103 bash build.sh -u --opapi --ophost --ops=$name --soc=ascend950 --cann_3rd_lib_path=${ASCEND_3RD_LIB_PATH} -j16
104 status=$?104 status=$?
105 if [ $status -ne 0 ]; then105 if [ $status -ne 0 ]; then
@@ -14,6 +14,12 @@ variables_cmake="cmake/variables.cmake"
14op_category_list=$(perl -0777 -ne 'if (/set\(OPS_CATEGORY_LIST\s*(.*?)\)/s) { print $1 }' "$current_dir/$variables_cmake" | grep -oP '"[^"]+"' | sed 's/"//g' | xargs)14op_category_list=$(perl -0777 -ne 'if (/set\(OPS_CATEGORY_LIST\s*(.*?)\)/s) { print $1 }' "$current_dir/$variables_cmake" | grep -oP '"[^"]+"' | sed 's/"//g' | xargs)
15IFS=' ' read -r -a op_categories <<< "$op_category_list"15IFS=' ' read -r -a op_categories <<< "$op_category_list"
16valid_dirs=()16valid_dirs=()
17+SOC_VERSION="ascend910b"
18+for arg in "$@"; do
19+ case "$arg" in
20+ --soc=*) SOC_VERSION="${arg#*=}" ;;
21+ esac
22+done
17pr_file=$(realpath "${1:-pr_filelist.txt}")23pr_file=$(realpath "${1:-pr_filelist.txt}")
18 24 
19for category in "${op_categories[@]}"25for category in "${op_categories[@]}"
@@ -93,12 +99,12 @@ do
93 rm -rf build99 rm -rf build
94 rm -rf build_out100 rm -rf build_out
95 if [[ "${REPOSITORY_NAME}" == "ops-math-dev" ]]; then101 if [[ "${REPOSITORY_NAME}" == "ops-math-dev" ]]; then
96- echo "bash build.sh --pkg --vendor_name=$name --ops=$name --cann_3rd_lib_path=${ASCEND_3RD_LIB_PATH} -j16"102+ echo "bash build.sh --pkg --vendor_name=$name --ops=$name --soc=${SOC_VERSION} --cann_3rd_lib_path=${ASCEND_3RD_LIB_PATH} -j16"
97- bash build.sh --pkg --vendor_name=$name --ops=$name --cann_3rd_lib_path=${ASCEND_3RD_LIB_PATH} -j16103+ bash build.sh --pkg --vendor_name=$name --ops=$name --soc=${SOC_VERSION} --cann_3rd_lib_path=${ASCEND_3RD_LIB_PATH} -j16
98 status=$?104 status=$?
99 elif [[ "${REPOSITORY_NAME}" == "ops-math" ]]; then105 elif [[ "${REPOSITORY_NAME}" == "ops-math" ]]; then
100- echo "bash build.sh --pkg --vendor_name=$name --ops=$name --cann_3rd_lib_path=${ASCEND_3RD_LIB_PATH} -j16"106+ echo "bash build.sh --pkg --vendor_name=$name --ops=$name --soc=${SOC_VERSION} --cann_3rd_lib_path=${ASCEND_3RD_LIB_PATH} -j16"
101- bash build.sh --pkg --vendor_name=$name --ops=$name --cann_3rd_lib_path=${ASCEND_3RD_LIB_PATH} -j16107+ bash build.sh --pkg --vendor_name=$name --ops=$name --soc=${SOC_VERSION} --cann_3rd_lib_path=${ASCEND_3RD_LIB_PATH} -j16
102 status=$? 108 status=$?
103 fi109 fi
104 if [[ $status -ne 0 ]]; then110 if [[ $status -ne 0 ]]; then
@@ -117,20 +117,20 @@ execute_run_file() {
117 117 
118if [ ${#builtin_ops_name[@]} -gt 0 ]; then118if [ ${#builtin_ops_name[@]} -gt 0 ]; then
119 builtin_ops_str=$(IFS=,; echo "${builtin_ops_name[*]}")119 builtin_ops_str=$(IFS=,; echo "${builtin_ops_name[*]}")
120- build_cmd="bash build.sh --pkg --ops=$builtin_ops_str --soc=ascend950 -j16 --cann_3rd_lib_path=/home/jenkins/opensource"120+ build_cmd="bash build.sh --pkg --ops=$builtin_ops_str --soc=ascend950 -j16 --cann_3rd_lib_path=${CANN_3RD_LIB_PATH}"
121 run_build_command "$build_cmd"121 run_build_command "$build_cmd"
122 execute_run_file "custom"122 execute_run_file "custom"
123fi123fi
124 124 
125if [ ${#experimental_ops_name[@]} -gt 0 ]; then125if [ ${#experimental_ops_name[@]} -gt 0 ]; then
126 experimental_ops_str=$(IFS=,; echo "${experimental_ops_name[*]}")126 experimental_ops_str=$(IFS=,; echo "${experimental_ops_name[*]}")
127- build_cmd="bash build.sh --pkg --experimental --ops=$experimental_ops_str --soc=ascend950 -j16 --cann_3rd_lib_path=/home/jenkins/opensource"127+ build_cmd="bash build.sh --pkg --experimental --ops=$experimental_ops_str --soc=ascend950 -j16 --cann_3rd_lib_path=${CANN_3RD_LIB_PATH}"
128 run_build_command "$build_cmd"128 run_build_command "$build_cmd"
129 execute_run_file "custom"129 execute_run_file "custom"
130fi130fi
131 131 
132if [ ${build_all} -eq 1 ]; then132if [ ${build_all} -eq 1 ]; then
133- build_cmd="bash build.sh --pkg --jit --soc=ascend950 -j16 --cann_3rd_lib_path=/home/jenkins/opensource"133+ build_cmd="bash build.sh --pkg --jit --soc=ascend950 -j16 --cann_3rd_lib_path=${CANN_3RD_LIB_PATH}"
134 run_build_command "$build_cmd"134 run_build_command "$build_cmd"
135 execute_run_file "builtin"135 execute_run_file "builtin"
136fi136fi
@@ -182,7 +182,7 @@ if [[ "$SKIP_BUILD" == "FALSE" ]]; then
182 exit 1182 exit 1
183 fi183 fi
184 echo "[cannsim] Installing: ${RUN_PKG}"184 echo "[cannsim] Installing: ${RUN_PKG}"
185- ${RUN_PKG}185+ ${RUN_PKG} --force
186 186 
187 STAGE2_END=$(date +%s)187 STAGE2_END=$(date +%s)
188 STAGE2_ELAPSED=$((STAGE2_END - STAGE2_START))188 STAGE2_ELAPSED=$((STAGE2_END - STAGE2_START))
@@ -202,7 +202,7 @@ echo "------------------------------------------------------------"
202STAGE3_START=$(date +%s)202STAGE3_START=$(date +%s)
203 203 
204export LD_LIBRARY_PATH="${VENDOR_LIB_DIR}:${LD_LIBRARY_PATH}"204export LD_LIBRARY_PATH="${VENDOR_LIB_DIR}:${LD_LIBRARY_PATH}"
205-bash build.sh --run_example ${OP_NAME} eager cust --noexec --vendor_name=${VENDOR_NAME}205+bash build.sh --run_example ${OP_NAME} eager cust --vendor_name=${VENDOR_NAME} --noexec
206 206 
207EXECUTABLE="${PROJECT_ROOT}/build/test_aclnn_${OP_NAME}"207EXECUTABLE="${PROJECT_ROOT}/build/test_aclnn_${OP_NAME}"
208if [[ ! -f "$EXECUTABLE" ]]; then208if [[ ! -f "$EXECUTABLE" ]]; then