这里写目录标题
1 问题 [CLDNN ERROR]. clGetPlatformIDs error -1001
如果你在使用openVINO时候遇到这个问题,其实是少做了一步操作。当然前提是你已经可以把CPU的跑起来了,这说明你的搭建是没有问题,只是GPU少操作了一步而已哈。
2 使用openVINO下GPU,务必是intel的核显或集显,nvidia是不行的。
下面我正在使用intel的uhd630,符合要求。
3 安装OpenCL的驱动程序
安装完毕,用GPU推理就没有问题了,这里就不展示,下面看看这个脚本。
cd /opt/intel/openvino/install_dependencies
sudo -E ./install_NEO_OCL_driver.sh
注意,可能遇到的问题,从脚本的执行顺序来看,
- 可能会在卸载老版本驱动出现问题,可以尝试
sudo apt-get remove/purge xxx
,脚本用的purge(配置文件一起删除) - 由于是dpkg管理的,很容易出现安装新包的依赖问题,记得使用
sudo apt-get -f install
4 观察GPU使用率
sudo apt-get install intel-gpu-tools
sudo intel_gpu_top
5 install_NEO_OCL_driver.sh
这个shell脚本写的很实在,有兴趣可以仔细看看。
从大体方面,可以知道如下内容
- 仅支持centos/ubuntu两个操作系统
- 对操作系统进行检查,centos7及以上,ubuntu16或者18
- 要求使用root权限运行脚本,一般都是这样子的(可能会安装一些包或者是设置相关配置问题)
- 接下来的安装,就两个操作系统分开执行对应的函数。这里以ubuntu为例
- 检查系统是否已经安装了
intel-opencl
、intel-ocloc intel-gmmlib
、intel-igc-core
、intel-igc-opencl
,如果已经安装了,会直接卸载。如果没有继续执行。 - 安装依赖包,包括
libnuma1、 ocl-icd-libopencl1
两个 - 正式安装所需要的4个包
- 将用户加入video group
其他细节可以参考。
#!/bin/bash
# Copyright (c) 2018 - 2019 Intel Corporation
#
# 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.
#
# Installs the Graphics Driver for OpenCL on Linux.
#
# Usage: sudo -E ./install_NEO_OCL_driver.sh
#
# Supported platforms:
# 6th, 7th, 8th or 9th generation Intel® processor with Intel(R)
# Processor Graphics Technology not previously disabled by the BIOS
# or motherboard settings
#
EXIT_FAILURE=1
PKGS=
CENTOS_MINOR=
UBUNTU_VERSION=
DISTRO=
_install_prerequisites_centos()
{
# yum doesn't accept timeout in seconds as parameter
echo
echo "Note: if yum becomes non-responsive, try aborting the script and run:"
echo " sudo -E $0"
echo
CMDS=("yum -y install tar libpciaccess numactl-libs"
"yum -y groupinstall 'Development Tools'"
"yum -y install rpmdevtools openssl openssl-devel bc numactl ocl-icd ocl-icd-devel")
for cmd in "${CMDS[@]}"; do
echo $cmd
eval $cmd
if [[ $? -ne 0 ]]; then
echo ERROR: failed to run $cmd >&2
echo Problem \(or disk space\)? >&2
echo . Verify that you have enough disk space, and run the script again. >&2
exit $EXIT_FAILURE
fi
done
}
_install_prerequisites_ubuntu()
{
CMDS=("apt-get -y update"
"apt-get -y install libnuma1 ocl-icd-libopencl1")
for cmd in "${CMDS[@]}"; do
echo $cmd
eval $cmd
if [[ $? -ne 0 ]]; then
echo ERROR: failed to run $cmd >&2
echo Problem \(or disk space\)? >&2
echo " sudo -E $0" >&2
echo 2. Verify that you have enough disk space, and run the script again. >&2
exit $EXIT_FAILURE
fi
done
}
install_prerequisites()
{
if [[ $DISTRO == "centos" ]]; then
echo Installing prerequisites...
_install_prerequisites_centos
elif [[ $DISTRO == "ubuntu" ]]; then
echo Installing prerequisites...
_install_prerequisites_ubuntu
else
echo Unknown OS
fi
}
_deploy_rpm()
{
# On a CentOS 7.2 machine with Intel Parallel Composer XE 2017
# installed we got conflicts when trying to deploy these rpms.
# If that happens to you too, try again with:
# IGFX_RPM_FLAGS="--force" sudo -E ./install_NEO_OCL_driver.sh install
#
cmd="rpm $IGFX_RPM_FLAGS -ivh --nodeps --force $1"
echo $cmd
eval $cmd
}
_deploy_deb()
{
cmd="dpkg -i $1"
echo $cmd
eval $cmd
}
_install_user_mode_centos()
{
_deploy_rpm "intel*.rpm"
if [[ $? -ne 0 ]]; then
echo ERROR: failed to install rpms $cmd error >&2
echo Make sure you have enough disk space or fix the problem manually and try again. >&2
exit $EXIT_FAILURE
fi
}
_install_user_mode_ubuntu()
{
_deploy_deb "intel*.deb"
if [[ $? -ne 0 ]]; then
echo ERROR: failed to install rpms $cmd error >&2
echo Make sure you have enough disk space or fix the problem manually and try again. >&2
exit $EXIT_FAILURE
fi
}
install_user_mode()
{
echo "Installing user mode driver..."
if [[ $DISTRO == "centos" ]]; then
_install_user_mode_centos
else
_install_user_mode_ubuntu
fi
}
_uninstall_user_mode_centos()
{
echo Looking for previously installed user-mode driver...
PACKAGES=("intel-opencl"
"intel-ocloc"
"intel-gmmlib"
"intel-igc-core"
"intel-igc-opencl")
for package in "${PACKAGES[@]}"; do
echo "rpm -qa | grep $package"
found_package=$(rpm -qa | grep $package)
if [[ $? -eq 0 ]]; then
echo Found installed user-mode driver, performing uninstall...
cmd="rpm -e --nodeps ${found_package}"
echo $cmd
eval $cmd
if [[ $? -ne 0 ]]; then
echo ERROR: failed to uninstall existing user-mode driver. >&2
echo Please try again manually and run the script again. >&2
exit $EXIT_FAILURE
fi
fi
done
}
_uninstall_user_mode_ubuntu()
{
echo Looking for previously installed user-mode driver...
PACKAGES=("intel-opencl"
"intel-ocloc"
"intel-gmmlib"
"intel-igc-core"
"intel-igc-opencl")
for package in "${PACKAGES[@]}"; do
found_package=$(dpkg-query -W -f='${binary:Package}\n' ${package})
if [[ $? -eq 0 ]]; then
echo Found $found_package installed, uninstalling...
dpkg --purge $found_package
if [[ $? -ne 0 ]]; then
echo "ERROR: unable to remove $found_package" >&2
echo " please resolve it manually and try to launch the script again." >&2
exit $EXIT_FAILURE
fi
fi
done
}
uninstall_user_mode()
{
if [[ $DISTRO == "centos" ]]; then
_uninstall_user_mode_centos
else
_uninstall_user_mode_ubuntu
fi
}
_is_package_installed()
{
if [[ $DISTRO == "centos" ]]; then
cmd="rpm -qa | grep $1"
else
cmd="dpkg-query -W -f='${binary:Package}\n' $pkg"
fi
echo $cmd
eval $cmd
}
version_gt() {
# check if first version is greater than second version
test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1";
}
summary()
{
kernel_version=$(uname -r)
echo
echo Installation completed successfully.
echo
echo Next steps:
echo "Add OpenCL users to the video group: 'sudo usermod -a -G video USERNAME'"
echo " e.g. if the user running OpenCL host applications is foo, run: sudo usermod -a -G video foo"
echo " Current user has been already added to the video group"
echo
# ask to install kernel 4.14 if current kernel version < 4.13 (GPU NEO driver supports only kernels 4.13.x and higher)
if version_gt "4.13" "$kernel_version" ; then
echo "Install 4.14 kernel using install_4_14_kernel.sh script and reboot into this kernel"
echo
fi
echo "If you use 8th Generation Intel® Core™ processor, you will need to add:"
echo " i915.alpha_support=1"
echo " to the 4.14 kernel command line, in order to enable OpenCL functionality for this platform."
echo
}
check_root_access()
{
if [[ $EUID -ne 0 ]]; then
echo "ERROR: you must run this script as root." >&2
echo "Please try again with "sudo -E $0", or as root." >&2
exit $EXIT_FAILURE
fi
}
add_user_to_video_group()
{
local real_user=$(logname 2>/dev/null || echo ${SUDO_USER:-${USER}})
echo
echo Adding $real_user to the video group...
usermod -a -G video $real_user
if [[ $? -ne 0 ]]; then
echo WARNING: unable to add $real_user to the video group >&2
fi
}
_check_distro_version()
{
if [[ $DISTRO == centos ]]; then
CENTOS_MINOR=$(sed 's/CentOS Linux release 7\.\([[:digit:]]\+\).\+/\1/' /etc/centos-release)
if [[ $? -ne 0 ]]; then
echo ERROR: failed to obtain CentOS version minor. >&2
echo This script is supported only on CentOS 7 and above. >&2
exit $EXIT_FAILURE
fi
elif [[ $DISTRO == ubuntu ]]; then
UBUNTU_VERSION=$(lsb_release -r -s)
if [[ $UBUNTU_VERSION != '18.04' && $UBUNTU_VERSION != '16.04' ]]; then
echo "Warning: This runtime can be installed only on Ubuntu 18.04 or Ubuntu 16.04."
echo "More info https://github.com/intel/compute-runtime/releases" >&2
exit "Installation of Intel Compute Runtime interrupted"
fi
fi
}
distro_init()
{
if [[ -f /etc/centos-release ]]; then
DISTRO="centos"
elif [[ -f /etc/lsb-release ]]; then
DISTRO="ubuntu"
fi
_check_distro_version
}
install()
{
uninstall_user_mode
install_prerequisites
install_user_mode
add_user_to_video_group
}
main()
{
echo "Intel OpenCL graphics driver installer"
distro_init
check_root_access
install
summary
}
[[ "$0" == "$BASH_SOURCE" ]] && main "$@"