#!/bin/bash
source get_threadnum_with_op.sh
main() {
echo "[INFO] excute 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 cmake_build_type=$4
local enable_oom=$5
local dump_cce=$6
local enable_mssanitizer=$7
local bisheng_flags="${8#*=}"
local kernel_template_input="${9#*=}"
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
result=$(bash build_binary_opc_gen_task.sh $op_type $soc_version $output_path $task_path $cmake_build_type $enable_oom $dump_cce $enable_mssanitizer bisheng_flags=$bisheng_flags kernel_template_input=$kernel_template_input)
local gen_res=$?
if [ $gen_res -ne 0 ]; then
echo -e "[ERROR] [$op_type]build_binary_opc_gen_task failed with ErrorCode[$gen_res]."
echo -e "Command executed: build_binary_opc_gen_task.sh $op_type $soc_version $output_path $task_path $cmake_build_type $enable_oom $dump_cce $enable_mssanitizer bisheng_flags=$bisheng_flags kernel_template_input=$kernel_template_input"
echo -e "Error output: \n $result"
return
fi
echo "$result"
}
set -o pipefail
main "$@"