#!/bin/bash
current_dir=$(pwd)
variables_cmake="cmake/variables.cmake"
op_category_list=$(grep -oP 'set\(OP_CATEGORY_LIST\s*\K".*"' $current_dir/$variables_cmake | sed 's/"//g')
IFS=' ' read -r -a op_categories <<< "$op_category_list"
valid_dirs=()
pr_file=$(realpath "${1:-pr_filelist.txt}")
for category in "${op_categories[@]}"
do
first_level="$current_dir/$category"
if [ -d "$first_level" ]; then
for second_level in "$first_level"/*/
do
examples_dir="$second_level""examples"
if [ -d "$examples_dir" ]; then
if ls "$examples_dir"/test_aclnn_* 1> /dev/null 2> /dev/null; then
dir_name=$(basename "$second_level")
valid_dirs+=("$dir_name")
fi
fi
done
fi
done
ops_name=()
mapfile -t lines < ${pr_file}
for file_path in "${lines[@]}"
do
file_path=$(echo "$file_path" | xargs)
if [ -z "$file_path" ]; then
continue
fi
if [[ "$file_path" == *.md ]]; then
continue
fi
for dir in "${valid_dirs[@]}"
do
if [[ "$file_path" == *"/$dir/"* ]]; then
if [[ ! " ${ops_name[@]} " =~ " $dir " ]]; then
ops_name+=("$dir")
fi
break
fi
done
if [[ "$file_path" == "scripts/ci/mirror_update_time.txt" ]]; then
image_ops_910b=("grid_sample" "upsample_nearest3d" "upsample_linear1d" "upsample_bicubic2d" "grid_sampler2_d_grad")
objdetec_ops_910b=("iou_v2")
operator_list_910b=("${image_ops_910b[@]}" "${objdetec_ops_910b[@]}")
image_ops_950=("resize_bilinear_v2" "resize_nearest_neighbor_v2" "resize_bicubic_v2" "resize_linear")
objdetec_ops_950=("iou_v2")
operator_list_950=("${image_ops_950[@]}" "${objdetec_ops_950[@]}")
for op in "${operator_list_910b[@]}"; do
op_exists=0
for existing_op in "${ops_name[@]}"; do
if [ "$existing_op" = "$op" ]; then
op_exists=1
break
fi
done
if [ "$op_exists" -eq 0 ]; then
ops_name+=("$op")
fi
done
fi
done
for name in "${ops_name[@]}"
do
echo "--------------------------------"
echo "${name}"
./single/cann-ops-cv-${name}-linux.*.run
echo "[EXECUTE_COMMAND] bash build.sh --run_example $name eager cust --vendor_name=$name"
bash build.sh --run_example $name eager cust --vendor_name=$name
status=$?
if [ $status -ne 0 ]; then
echo "${name} example fail"
exit 1
fi
done