使用集合诚KMDA-3301 OpenVINO CPU和GPU 算法加速,用GPU加速时,调动不起来。写下解决过程,以备后用。
调动GPU 报错:
terminate called after throwing an instance of 'InferenceEngine::GeneralError'
what(): Failed to create plugin /opt/intel/openvino_2021/deployment_tools/inference_engine/lib/intel64/libclDNNPlugin.so for device GPU
Please, check your environment
[CLDNN ERROR]. clGetPlatformIDs error -1001
先查 openvino环境配置
openvinotoolkit/openvino
得知没有显卡驱动:
$ cd /opt/intel/openvino_2021/install_dependencies/
$ sudo -E ./install_NEO_OCL_driver
使用原脚本下载时,所有 neo 目录下的文件可能下载不全,导致安装失败
这时修改下载方式
_download_packages_ubuntu()
{
case $INSTALL_DRIVER_VERSION in
"19.41.14441")
curl -L -O https://github.com/intel/compute-runtime/releases/download/19.41.14441/intel-gmmlib_19.3.2_amd64.deb
curl -L -O https://github.com/intel/compute-runtime/releases/download/19.41.14441/intel-igc-core_1.0.2597_amd64.deb
curl -L -O https://github.com/intel/compute-runtime/releases/download/19.41.14441/intel-igc-opencl_1.0.2597_amd64.deb
curl -L -O https://github.com/intel/compute-runtime/releases/download/19.41.14441/intel-opencl_19.41.14441_amd64.deb
curl -L -O https://github.com/intel/compute-runtime/releases/download/19.41.14441/intel-ocloc_19.41.14441_amd64.deb
;;
"20.35.17767")
#curl -L -O https://github.com/intel/compute-runtime/releases/download/20.35.17767/intel-gmmlib_20.2.4_amd64.deb
#curl -L -O https://github.com/intel/compute-runtime/releases/download/20.35.17767/intel-igc-core_1.0.4756_amd64.deb
#curl -L -O https://github.com/intel/compute-runtime/releases/download/20.35.17767/intel-igc-opencl_1.0.4756_amd64.deb
#curl -L -O https://github.com/intel/compute-runtime/releases/download/20.35.17767/intel-opencl_20.35.17767_amd64.deb
#curl -L -O https://github.com/intel/compute-runtime/releases/download/20.35.17767/intel-ocloc_20.35.17767_amd64.deb
#curl -L -O https://github.com/intel/compute-runtime/releases/download/20.35.17767/intel-level-zero-gpu_1.0.17767_amd64.deb
wget https://github.com/intel/compute-runtime/releases/download/20.35.17767/intel-gmmlib_20.2.4_amd64.deb
wget https://github.com/intel/compute-runtime/releases/download/20.35.17767/intel-igc-core_1.0.4756_amd64.deb
wget https://github.com/intel/compute-runtime/releases/download/20.35.17767/intel-igc-opencl_1.0.4756_amd64.deb
wget https://github.com/intel/compute-runtime/releases/download/20.35.17767/intel-opencl_20.35.17767_amd64.deb
wget https://github.com/intel/compute-runtime/releases/download/20.35.17767/intel-ocloc_20.35.17767_amd64.deb
wget https://github.com/intel/compute-runtime/releases/download/20.35.17767/intel-level-zero-gpu_1.0.17767_amd64.deb
;;
"21.29.20389")
return 0
;;
*)
echo "ERROR: Unrecognized driver ${INSTALL_DRIVER_VERSION}."
echo "Available values: ${AVAILABLE_DRIVERS[*]}"
exit $EXIT_WRONG_ARG
esac
}
and
_verify_checksum_ubuntu()
{
case $INSTALL_DRIVER_VERSION in
"19.41.14441")
curl -L -O https://github.com/intel/compute-runtime/releases/download/19.41.14441/ww41.sum
sha256sum -c ww41.sum
;;
"20.35.17767")
#curl -L -O https://github.com/intel/compute-runtime/releases/download/20.35.17767/ww35.sum
wget https://github.com/intel/compute-runtime/releases/download/20.35.17767/ww35.sum
sha256sum -c ww35.sum
;;
"21.29.20389")
return 0
;;
*)
echo "ERROR: Unrecognized driver ${INSTALL_DRIVER_VERSION}."
echo "Available values: ${AVAILABLE_DRIVERS[*]}"
exit $EXIT_WRONG_ARG
esac
}
then:
groups
sudo usermod -a -G video
sudo usermod -a -G ls
如果有原先的驱动,得先删除
参考OpenVINO安装之安装openCL
sudo apt purge intel-opencl
这时仍然不能调用GPU ,咨询Intel工程师得知内核得 5.8 以上,而原来内核是
$ uname -r
5.4.0-84-generic
$ uname -a
Linux t-Default-string 5.4.0-84-generic #94~18.04.1-Ubuntu SMP Thu Aug 26 23:17:46 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
这时有两种方法解决内核问题:
参考 在ubuntu18.04上更新内核
ubuntu18.04.4更换内核版本
make[1]: *** No rule to make target 'debian/canonical-certs.pem', needed by 'certs/x509_certificate_list'. Stop.
Makefile:1837: recipe for target 'certs' failed
make: *** [certs] Error 2
参考:
内核错误: No rule to make target ‘debian/canonical-certs.pem‘, needed by ‘certs/x509_certificate_list‘
Makefile:1194: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1
sudo apt install dwarves
sed: can't read modules.order: No such file or directory
Makefile:1452: recipe for target '_modinst_' failed
make: *** [_modinst_] Error 2
参考 Linux内核编译错误
编译成功后重启
这时不能正常开机,只能升级系统。
升级系统后按上面重装显卡驱动
编译代码时报错:
CMake Error at CMakeLists.txt:3 (project) :
No CMAKE_CXX_COMPILER could be found.
参考:
ubuntu20.04 cmake编译出错:No CMAKE_CXX_COMPILER could be found.
sudo apt install -y build-essential
这时系统是