#!/bin/bash
gen_op() {
if [[ -z "$GENOP_NAME" ]] || [[ -z "$GENOP_TYPE" ]]; then
echo "Error: op_class or op_name is not set."
usage "genop"
fi
echo $dotted_line
echo "Start to create the initial directory for ${GENOP_NAME} under ${GENOP_TYPE}"
local python_cmd=""
if command -v python3 &>/dev/null; then
python_cmd="python3"
elif command -v python &>/dev/null; then
python_cmd="python"
fi
if [ -n "${python_cmd}" ]; then
${python_cmd} "${BASE_PATH}/scripts/opgen/opgen_standalone.py" -t ${GENOP_TYPE} -n ${GENOP_NAME} -p ${GENOP_BASE}
echo "Create the initial directory for ${GENOP_NAME} under ${GENOP_TYPE} success"
return $?
fi
}
gen_aicpu_op() {
if [[ -z "$GENOP_NAME" ]] || [[ -z "$GENOP_TYPE" ]]; then
echo "Error: op_class or op_name is not set."
usage "genop"
fi
echo $dotted_line
echo "Start to create the AI CPU initial directory for ${GENOP_NAME} under ${GENOP_TYPE}"
local python_cmd=""
if command -v python3 &>/dev/null; then
python_cmd="python3"
elif command -v python &>/dev/null; then
python_cmd="python"
fi
if [ -n "${python_cmd}" ]; then
${python_cmd} "${BASE_PATH}/scripts/opgen/opgen_standalone.py" -t ${GENOP_TYPE} -n ${GENOP_NAME} -p ${GENOP_BASE} -v aicpu
echo "Create the AI CPU initial directory for ${GENOP_NAME} under ${GENOP_TYPE} success"
return $?
else
echo "Please install Python to generate op project framework."
fi
}