一、准备环境
1.linux配置qnn sdk
(1)下载qnn sdk
https://qpm.qualcomm.com/#/main/tools/details/qualcomm_ai_engine_direct
(2)下载qpm3
https://softwarecenter.qualcomm.com/#/catalog/item/3097f479-8993-11ea-9571-06074a401742
(3)安装QPM:sudo dpkg -i QualcommPackageManager3.3.0.105.0.Linux-x86.deb
(4)登录QPM,用户名就是注册的邮箱
qpm-cli --login 邮箱
(5)激活要安装的软件license
qpm-cli --license-activate qualcomm_ai_engine_direct
(6)提取QNN SDK。SDK放在/opt/qcom/aistack/qnn/.
qpm-cli --extract qualcomm_ai_engine_direct.2.24.0.240626.Linux-AnyCPU.qik
(7) (optional) 直接用qpm-cli去下载,而不需要从网页下载.qik文件。
qpm-cli --extract qualcomm_ai_engine_direct
(8) (optional) 查看可用的QNN版本号
qpm-cli --info qualcomm_ai_engine_direct
(9)(optional) 下载特定版本的QNN SDK
qpm-cli --extract qualcomm_ai_engine_direct -v 2.24.0.240626
(10) 指定安装位置。
二、安装依赖
1.安装python依赖
python3 -m pip install --upgrade pip
chmod a+x qnn-v2.13.0/bin/check-python-dependency
./qnn-v2.13.0/bin/check-python-dependency
pip install tensorflow -i https://pypi.tuna.tsinghua.edu.cn/simple
2.安装linux依赖
bash qnn-v2.13.0/bin/check-linux-dependency.sh
3.安装onnx
pip install onnx
4.设置QNN_SDK_ROOT, PYTHONPATH, PATH, LD_LIBRARY_PATH
source qnn-v2.13.0/bin/envsetup.sh
5. 检查是否配置成功
qnn-net-run --version
6.下载安装make, Android NDK version r25c.
apt install make
apt install wget unzip
wget https://dl.google.com/android/repository/android-ndk-r25c-linux.zip
unzip android-ndk-r25c-linux.zip
设置环境变量:
# export ANDROID_NDK_ROOT=<PATH-TO-NDK>
export ANDROID_NDK_ROOT=<PATH-TO-NDK>
export PATH=${ANDROID_NDK_ROOT}:${PATH}
7. 检查环境是否配置完成
chmod a+x ${QNN_SDK_ROOT}/bin/envcheck
${QNN_SDK_ROOT}/bin/envcheck -a
到目前为止,我们的Linux QNN SDK最基本的配置完成了。