Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

Assign to GPU Failed

SC_Huang
Beginner
2,830 Views

I was trying to run the sample and assign the model to CPU,GPU and MYRIAD,

It's fine when using "CPU" and "MYRIAD", but when i was using "GPU", the following error had occurred.

#/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/samples/build/intel64/Release$ ./security_barrier_camera_sample -i ../../../../../demo/car_1.bmp -m ../../../../../intel_models/vehicle-license-plate-detection-barrier-0007/FP16/vehicle-license-plate-detection-barrier-0007.xml -d GPU
InferenceEngine:
    API version ............ 1.0
    Build .................. 10478
[ INFO ] Parsing input parameters
[ INFO ] Reading input
[ INFO ] Loading plugin GPU
[ ERROR ] Cannot find plugin to use :Tried load plugin : clDNNPlugin,  error: Plugin clDNNPlugin cannot be loaded: cannot load plugin: clDNNPlugin from ../../../lib/intel64: Cannot load library '../../../lib/intel64/libclDNNPlugin.so': ../../../lib/intel64/libclDNNPlugin.so: cannot open shared object file: No such file or directory, skipping
cannot load plugin: clDNNPlugin from : Cannot load library 'libclDNNPlugin.so': libclDNN64.so: cannot open shared object file: No such file or directory, skipping

But when i run the demo "demo_security_barrier_camera.sh" and configured the target_device="GPU", the clDNNPlugin can be loaded successfully and the "security_barrier_camera_sample" can work!

So Why i can't assign to GPU by using "./security_barrier_camera_sample -i ../../../../../demo/car_1.bmp -m ../../../../../intel_models/vehicle-license-plate-detection-barrier-0007/FP16/vehicle-license-plate-detection-barrier-0007.xml -d GPU"

 

 

 

0 Kudos
1 Solution
rachel_r_Intel
Employee
2,830 Views

We has found a solution to the above problem:

[ ERROR ] failed to create engine: clGetPlatformIDs error -1001

Install OpenCl dependency:

root@intel-desktop:/opt/intel/computer_vision_sdk/install_dependencies# ./install_NEO_OCL_driver.sh

Thanks

View solution in original post

0 Kudos
9 Replies
CLu1
Novice
2,830 Views

Hi

I found a solution, maybe you could try it.

$ sudo -E su
# source /opt/intel/computer_vision_sdk/bin/setupvars.sh

# ./security_barrier_camera_sample -i ../../../../../demo/car_1.bmp -m ../../../../../intel_models/vehicle-license-plate-detection-barrier-0007/FP16/vehicle-license-plate-detection-barrier-0007.xml -d GPU

0 Kudos
Severine_H_Intel
Employee
2,830 Views

Hi Huang, 

We will need a bit more details in order to help you. First, what are your GPU and CPU? Can you explain more how did you change the target hardware from CPU to GPU for the demo script? Did you change the code inside the script file (going from -d CPU to -d GPU) or something else? 

Thank you,

Severine

0 Kudos
SC_Huang
Beginner
2,830 Views

My CPU is Intel Corei7-7700 with Intel® HD Graphics 630.

I just changed the target_device form CPU to GPU as below.

#!/bin/bash

error() {
    local code="${3:-1}"
    if [[ -n "$2" ]];then
        echo "Error on or near line $1: $2; exiting with status ${code}"
    else
        echo "Error on or near line $1; exiting with status ${code}"
    fi
    exit "${code}" 
}
trap 'error ${LINENO}' ERR

ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ROOT_DIR=$ROOT_DIR/..

if [[ $EUID -ne 0 ]]; then
    echo "ERROR: to install CV SDK dependencies, you must run this script as root." >&2
    echo "Please try again with "sudo -E $0", or as root." >&2
    exit 1
fi
#################
target_device="GPU"
target_image_path="$ROOT_DIR/demo/car_1.bmp"

run_again="Then run the script again\n\n"
dashes="\n\n###################################################\n\n"

if [[ -f /etc/centos-release ]]; then
    DISTRO="centos"
elif [[ -f /etc/lsb-release ]]; then
    DISTRO="ubuntu"
fi

if [[ $DISTRO == "centos" ]]; then
    rpm -Uvh --force http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm || true
    sudo -E yum install -y epel-release
    sudo -E yum install -y ffmpeg gstreamer-plugins-base
elif [[ $DISTRO == "ubuntu" ]]; then
    printf "Run sudo -E apt -y install cmake libpng12-dev libcairo2-dev libpango1.0-dev libglib2.0-dev libgtk2.0-dev libgstreamer0.10-dev libswscale-dev libavcodec-dev libavformat-dev\n\n"
    sudo -E apt update
    sudo -E apt -y install cmake libpng12-dev libcairo2-dev libpango1.0-dev libglib2.0-dev libgtk2.0-dev libgstreamer0.10-dev libswscale-dev libavcodec-dev libavformat-dev
fi

# Step 4. Build samples
printf "${dashes}"
printf "Build Inference Engine samples\n\n"

if [[ -z "${INTEL_CVSDK_DIR}" ]]; then
    printf "\n\nINTEL_CVSDK_DIR environment variable is not set. Trying to run ./setvars.sh to set it. \n"
    
    if [ -e "$ROOT_DIR/inference_engine/bin/setvars.sh" ]; then # for Intel Deep Learning Deployment Toolkit package
        setvars_path="$ROOT_DIR/inference_engine/bin/setvars.sh"
    elif [ -e "$ROOT_DIR/../bin/setupvars.sh" ]; then # for Intel CV SDK package
        setvars_path="$ROOT_DIR/../bin/setupvars.sh"
    elif [ -e "$ROOT_DIR/../setupvars.sh" ]; then # for GO SDK package
        setvars_path="$ROOT_DIR/../setupvars.sh"
    else
        printf "Error: setvars.sh is not found\n"
    fi 
    if ! source $setvars_path ; then
        printf "Unable to run ./setvars.sh. Please check its presence. ${run_again}"
        exit 1
    fi
fi

cvsdk_install_dir="${INTEL_CVSDK_DIR}"

samples_path="${cvsdk_install_dir}/deployment_tools/inference_engine/samples"
cd $samples_path

if ! command -v cmake &>/dev/null; then
    printf "\n\nCMAKE is not installed. It is required to build Inference Engine samples. Please install it. ${run_again}"
    exit 1
fi

build_dir="${ROOT_DIR}/inference_engine/samples/build"
if [ ! -e "$build_dir/intel64/Release/security_barrier_camera_sample" ]; then
    mkdir -p $build_dir
    cd $build_dir
    cmake -DCMAKE_BUILD_TYPE=Release ..
    make -j8
else
    printf "\n\nTarget folder ${build_dir} already exists. Skipping samples building."
    printf "If you want to rebuild samples, remove the entire ${build_dir} folder. ${run_again}"
fi

# Step 5. Run samples
printf "${dashes}"
printf "Run Inference Engine security_barrier_camera sample\n\n"

binaries_dir="${cvsdk_install_dir}/deployment_tools/inference_engine/samples/build/intel64/Release"
cd $binaries_dir

printf "Run ./security_barrier_camera_sample -d $target_device -i $target_image_path -m $ROOT_DIR/intel_models/vehicle-license-plate-detection-barrier-0007/FP32/vehicle-license-plate-detection-barrier-0007.xml -m_va $ROOT_DIR/intel_models/vehicle-attributes-recognition-barrier-0039/FP32/vehicle-attributes-recognition-barrier-0039.xml -m_lpr $ROOT_DIR/intel_models/license-plate-recognition-barrier-0001/FP32/license-plate-recognition-barrier-0001.xml\n\n"

./security_barrier_camera_sample -d $target_device -i $target_image_path -m "$ROOT_DIR/intel_models/vehicle-license-plate-detection-barrier-0007/FP32/vehicle-license-plate-detection-barrier-0007.xml" -m_va "$ROOT_DIR/intel_models/vehicle-attributes-recognition-barrier-0039/FP32/vehicle-attributes-recognition-barrier-0039.xml" -m_lpr "$ROOT_DIR/intel_models/license-plate-recognition-barrier-0001/FP32/license-plate-recognition-barrier-0001.xml"

printf "${dashes}"
printf "Demo completed successfully.\n\n"

 

0 Kudos
Severine_H_Intel
Employee
2,830 Views

Hi Huang, 

I reproduced your problem and, as mentioned by Collins earlier in the thread, the solution is to setup the environment variables using the command: 

source /opt/intel/computer_vision_sdk/bin/setupvars.sh

As you can see in the script "demo_security_barrier_camera.sh", this was called at line 54.

This needs to be executed every time you open a new terminal to execute OpenVINO commands. To avoid to repeat this, you can optionally add a command to your .bashrc file to permanently set the environment variables required to compile and run OpenVINO™ toolkit applications.

Open .bashrc:

cd ~ 

sudo nano .bashrc 

Add the following command at the bottom of .bashrc:   

source/opt/intel/computer_vision_sdk/bin/setupvars.sh 

Save and close the file by typing CTRL+X, Y, and then ENTER.

Best, 

Severine

 

0 Kudos
rachel_r_Intel
Employee
2,830 Views

I encountered the same problem when I assigned the model to the "GPU".

intel@intel-desktop:/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/samples/build/intel64/Release$ sudo ./classification_sample -d GPU -i /opt/intel/computer_vision_sdk/deployment_tools/demo/../demo/car.png -m /root/openvino_models/ir/squeezenet1.1/squeezenet1.1.xml
[ INFO ] InferenceEngine:
    API version ............ 1.2
    Build .................. 13911
[ INFO ] Parsing input parameters
[ INFO ] Loading plugin
[ ERROR ] Cannot find plugin to use :Tried load plugin : clDNNPlugin,  error: Plugin clDNNPlugin cannot be loaded: cannot load plugin: clDNNPlugin from : Cannot load library 'libclDNNPlugin.so': libclDNN64.so: cannot open shared object file: No such file or directory, skipping
cannot load plugin: clDNNPlugin from ../../../lib/intel64: Cannot load library '../../../lib/intel64/libclDNNPlugin.so': ../../../lib/intel64/libclDNNPlugin.so: cannot open shared object file: No such file or directory, skipping
cannot load plugin: clDNNPlugin from : Cannot load library 'libclDNNPlugin.so': libclDNN64.so: cannot open shared object file: No such file or directory, skipping


I tried the solution mentioned by Collins, then another error had occurred :

intel@intel-desktop:/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/samples/build/intel64/Release$ sudo -E su

root@intel-desktop:/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/samples/build/intel64/Release# source /opt/intel/computer_vision_sdk/bin/setupvars.sh
[setupvars.sh] OpenVINO environment initialized
root@intel-desktop:/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/samples/build/intel64/Release# ./classification_sample -d GPU -i /opt/intel/computer_vision_sdk/deployment_tools/demo/../demo/car.png -m /root/openvino_models/ir/squeezenet1.1/squeezenet1.1.xml
[ INFO ] InferenceEngine:
    API version ............ 1.2
    Build .................. 13911
[ INFO ] Parsing input parameters
[ INFO ] Loading plugin

    API version ............ 1.2
    Build .................. cldnn/GEN_GPU_clDNN_ci-main_cldnn-main-03988_artifacts.zip
    Description ....... clDNNPlugin
[ INFO ] Loading network files:
    /root/openvino_models/ir/squeezenet1.1/squeezenet1.1.xml
    /root/openvino_models/ir/squeezenet1.1/squeezenet1.1.bin
[ INFO ] Preparing input blobs
[ WARNING ] Image is resized from (787, 259) to (227, 227)
[ INFO ] Batch size is 1
[ INFO ] Preparing output blobs
[ INFO ] Loading model to the plugin
[ ERROR ] failed to create engine: clGetPlatformIDs error -1001

Also, when i run the demo "./demo_squeezenet_download_convert_run.sh" and configured the target="GPU", the same problem had occurred and "./demo_squeezenet_download_convert_run.sh" can't work!

target="GPU"

 

0 Kudos
rachel_r_Intel
Employee
2,831 Views

We has found a solution to the above problem:

[ ERROR ] failed to create engine: clGetPlatformIDs error -1001

Install OpenCl dependency:

root@intel-desktop:/opt/intel/computer_vision_sdk/install_dependencies# ./install_NEO_OCL_driver.sh

Thanks

0 Kudos
BBi
Beginner
2,830 Views

I also encountered this problem. How can solve this problem?

the issue info is as below---

Run Inference Engine security_barrier_camera demo

Run ./security_barrier_camera_demo -d GPU -d_va GPU -d_lpr GPU -i /opt/intel/computer_vision_sdk/deployment_tools/demo/../demo/car_1.bmp -m /opt/intel/computer_vision_sdk/deployment_tools/demo/../intel_models/vehicle-license-plate-detection-barrier-0106/FP32/vehicle-license-plate-detection-barrier-0106.xml -m_va /opt/intel/computer_vision_sdk/deployment_tools/demo/../intel_models/vehicle-attributes-recognition-barrier-0039/FP32/vehicle-attributes-recognition-barrier-0039.xml -m_lpr /opt/intel/computer_vision_sdk/deployment_tools/demo/../intel_models/license-plate-recognition-barrier-0001/FP32/license-plate-recognition-barrier-0001.xml 

[ INFO ] InferenceEngine: 
	API version ............ 1.4
	Build .................. 17328
[ INFO ] Parsing input parameters
[ INFO ] Capturing video streams from the video files or loading images
[ INFO ] Files were added: 1
[ INFO ]     /opt/intel/computer_vision_sdk/deployment_tools/demo/../demo/car_1.bmp
[ INFO ] Number of input image files: 1
[ INFO ] Number of input video files: 0
[ INFO ] Number of input channels:    1
[ INFO ] Loading plugin GPU

	API version ............ 1.4
	Build .................. 17328
	Description ....... clDNNPlugin
[ INFO ] Loading network files for VehicleDetection
[ INFO ] Batch size is forced to  1
[ INFO ] Checking Vehicle Detection inputs
[ INFO ] Checking Vehicle Detection outputs
[ INFO ] Loading Vehicle Detection model to the GPU plugin
[ ERROR ] failed to create engine: clGetPlatformIDs error -1001
Error on or near line 150; exiting with status 1

 

0 Kudos
BBi
Beginner
2,830 Views

in addition: i setup the environment variables permanently by using the command:

source /opt/intel/computer_vision_sdk/bin/setupvars.sh

the demoes are successful on CPU, but failed on GPU when use the cmdline like this : ./demo_security_barrier_camera.sh -d GPU

[ INFO ] Parsing input parameters

[ INFO ] Capturing video streams from the video files or loading images

[ INFO ] Files were added: 1

[ INFO ]     /opt/intel/computer_vision_sdk/deployment_tools/demo/../demo/car_1.bmp

[ INFO ] Number of input image files: 1

[ INFO ] Number of input video files: 0

[ INFO ] Number of input channels:    1

[ INFO ] Loading plugin GPU

 

        API version ............ 1.4

        Build .................. 17328

        Description ....... clDNNPlugin

[ INFO ] Loading network files for VehicleDetection

[ INFO ] Batch size is forced to  1

[ INFO ] Checking Vehicle Detection inputs

[ INFO ] Checking Vehicle Detection outputs

[ INFO ] Loading Vehicle Detection model to the GPU plugin

[ ERROR ] failed to create engine: clGetPlatformIDs error -1001

Error on or near line 150; exiting with status 1

ps:

my computer info :  i7-8550u @RX 550  win10

toolkit : l_openvino_toolkit_p_R4_2018.4.420.tgz

installed Linux barret-VM 4.8.0-36-generic #36~16.04.1-Ubuntu SMP Sun Feb 5 09:39:57 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux by virtualbox

0 Kudos
nikos1
Valued Contributor I
2,830 Views

Hi Barret,

> my computer info :  i7-8550u @RX 550  win10

> installed Linux barret-VM 4.8.0-36-generic #36~16.04.1-Ubuntu SMP Sun Feb 5 09:39:57 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux by virtualbox

Interesting! Are you running a Linux VM on a Windows 10 host?  If this is the case it may be difficult for the VM to see the GPU device so you may not be able to run -d GPU. Unless you have GPU passthrough ( https://www.virtualbox.org/manual/ch09.html )

In any case the error comes from OpenCL ( CL_PLATFORM_NOT_FOUND_KHR ) as it cannot find any platforms or devices to run clDNN.

What is the output of clinfo?

Cheers,

Nikos

0 Kudos
Reply