6 Star 22 Fork 10

算能 / tpu-mlir

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
build.sh 1.43 KB
一键复制 编辑 原始数据 按行查看 历史
man.lu 提交于 2023-09-14 00:51 . add check tests and unit tests
#!/bin/bash
set -e
if [[ -z "$INSTALL_PATH" ]]; then
echo "Please source envsetup.sh firstly."
exit 1
fi
echo "BUILD_PATH: $BUILD_PATH"
echo "INSTALL_PATH: $INSTALL_PATH"
echo "BUILD_FLAG: $BUILD_FLAG"
function config_debug()
{
cmake -G Ninja \
-B ${BUILD_PATH} \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS=-ggdb \
-DTPUMLIR_USE_LLD=ON \
-DTPUMLIR_INCLUDE_TESTS=ON \
-DCMAKE_INSTALL_PREFIX=${INSTALL_PATH} \
${PROJECT_ROOT}
}
function config_release()
{
cmake -G Ninja \
-B ${BUILD_PATH} \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_CXX_FLAGS=-O2 \
-DTPUMLIR_USE_LLD=ON \
-DTPUMLIR_INCLUDE_TESTS=ON \
-DCMAKE_INSTALL_PREFIX=${INSTALL_PATH} \
${PROJECT_ROOT}
}
# prepare install/build dir
if [ "$1" = "DEBUG" ]; then
rm -rf ${INSTALL_PATH}
config_debug
else
rm -rf ${INSTALL_PATH}
config_release
fi
cpu_num=`cat /proc/stat | grep cpu[0-9] -c`
cmake --build $BUILD_PATH --target install -j${cpu_num}
# Clean up some files for release build
if [ "$1" = "RELEASE" ]; then
# build doc
./release_doc.sh
# strip mlir tools
pushd $INSTALL_PATH
find ./ -name "*.so" ! -name "*_kernel_module.so" | xargs strip
ls bin/* | xargs strip
find ./ -name "*.a" | xargs rm
popd
fi
C++
1
https://gitee.com/sophgo/tpu-mlir.git
git@gitee.com:sophgo/tpu-mlir.git
sophgo
tpu-mlir
tpu-mlir
master

搜索帮助