1 Star 1 Fork 204

zhongluping/tpc_c_cplusplus

forked from OpenHarmony-SIG/tpc_c_cplusplus
关闭
 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
HPKBUILD 2.99 KB
一键复制 编辑 原始数据 按行查看 历史
zhongluping 提交于 2024-10-29 12:06 +08:00 . 修改onnxruntime编译动态库
# Copyright (c) 2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Contributor: zhongluping <278527840@qq.com>
# Maintainer: zhongluping <278527840@qq.com>
pkgname=onnxruntime
pkgver=v1.18.2
pkgrel=0
pkgdesc="ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator."
url="https://github.com/microsoft/onnxruntime"
archs=("arm64-v8a")
license=("MIT license")
depends=()
makedepends=()
source="https://github.com/microsoft/onnxruntime/archive/refs/tags/v1.18.2.tar.gz"
autounpack=true
downloadpackage=true
patchflag=true
builddir=$pkgname-${pkgver:1}
packagename=$builddir.tar.gz
prepare() {
mkdir -p $builddir/$ARCH-build
if [ $patchflag == true ]
then
cd $builddir
## 此patch主要修改了3处地方(这些修改可能造成的风险需用户自行判断):
## 1. OH不支持pthread_setaffinity_np接口,该接调用逻辑的地方增加一个非OHOS平台
## 2. OH当前不支持 bfloat16_t类型,以向上兼容的方式将此类型定义为float32_t
## 3. vst1q_bf16(对应bfloat16_t)修改为vst1q_f32vim(对应float32_t)
patch -p1 < ../onnxruntime_pkg.patch
patchflag=false
cd $OLDPWD
fi
}
## cmake 时需要花费时间拉取依赖库,请保持网络良好
## 测试中使用到了cpuinfo相关接口,部分接口在OH中不支持导致编译失败,故将CPUINFO以及测试关闭。(CPUINFO关闭可能造成的风险需用户自行判断)
build() {
cd $builddir/$ARCH-build
${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DOHOS_ARCH=$ARCH -DCMAKE_ASM_FLAGS="-Wno-unused-command-line-argument" \
-DCMAKE_CXX_FLAGS="-Wno-unused-command-line-argument -Wno-shorten-64-to-32" -DCMAKE_C_FLAGS="-Wno-unused-command-line-argument "\
-Donnxruntime_ENABLE_CPU_FP16_OPS=OFF -DCPUINFO_BUILD_PKG_CONFIG=OFF -DBUILD_TESTING=OFF -DBUILD_GMOCK=OFF \
-Dprotobuf_USE_EXTERNAL_GTEST=OFF -Donnxruntime_BUILD_SHARED_LIB=ON \
-Donnxruntime_ENABLE_CPUINFO=OFF -Donnxruntime_BUILD_UNIT_TESTS=OFF -Donnxruntime_CROSS_COMPILING=ON ../cmake/ -L > `pwd`/build.log 2>&1
# 编译
make VERBOSE=1 >> `pwd`/build.log 2>&1
ret=$?
cd $OLDPWD
return $ret
}
package() {
cd $builddir
make -C $ARCH-build install VERBOSE=1 >> `pwd`/$ARCH-build/build.log 2>&1
cd $OLDPWD
}
check() {
echo "The test must be on an OpenHarmony device!"
## test has be closed!
}
# 清理环境
cleanbuild() {
rm -rf ${PWD}/$builddir # ${PWD}/$packagename
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhong-luping/tpc_c_cplusplus.git
git@gitee.com:zhong-luping/tpc_c_cplusplus.git
zhong-luping
tpc_c_cplusplus
tpc_c_cplusplus
fix_other

搜索帮助