#!/bin/bash
source get_threadnum_with_op.sh
main() {
echo "[INFO]execute file: $0"
if test $# -lt 3; then
echo "[ERROR]input error"
echo "[ERROR]bash $0 {op_type} {soc_version} {output_path} {opc_info_csv}(optional)"
exit 1
fi
local op_type=$1
local soc_version=$2
local output_path=$3
local enable_mssanitizer=$4
local enable_debug=$5
local enable_oom=$6
local enable_dump_cce=$7
local workdir=$(
cd $(dirname $0)
pwd
)
local task_path=$output_path/opc_cmd
test -d "$task_path/" || mkdir -p $task_path/
local lock_file="$output_path/.$soc_version.cleaned.lock"
if [[ ! -f "$lock_file" ]]; then
rm -f $task_path/*.sh
touch "$lock_file" || {
echo "[WARNING] Failed to create lock file"
}
fi
local bisheng_flags=$8
local kernel_template_input=$9
result=$(bash build_binary_opc_gen_task.sh $op_type $soc_version $output_path $task_path $enable_mssanitizer $enable_debug $enable_oom $enable_dump_cce $bisheng_flags $kernel_template_input)
local gen_res=$?
if [ $gen_res -ne 0 ]; then
echo -e "[ERROR] [$op_type]build binary single op gen task failed with ErrorCode[$gen_res]."
echo -e "Command executed: build_binary_single_op_gen_task.sh $op_type $soc_version $output_path $task_path $enable_mssanitizer $enable_debug $enable_oom $enable_dump_cce $bisheng_flags $kernel_template_input"
echo -e "Error output: \n $result"
return
fi
echo "$result"
}
set -o pipefail
main "$@"