zivid / zivid-ros

Official ROS driver for Zivid 3D cameras
BSD 3-Clause "New" or "Revised" License
62 stars 46 forks source link

An OpenCL error occurred: clBuildProgram failed #78

Closed akocabas closed 2 years ago

akocabas commented 2 years ago

I get the following error when I start the node in a docker container:

Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://1-3659:45857/

SUMMARY
========

PARAMETERS
 * /camera/zivid/zivid_camera/frame_id: zivid_optical_frame
 * /camera/zivid/zivid_camera/serial_number: 22295FBA
 * /rosdistro: noetic
 * /rosversion: 1.15.14

NODES
  /camera/zivid/
    zivid_camera (zivid_camera/zivid_camera_node)

ROS_MASTER_URI=http://localhost:11311

process[camera/zivid/zivid_camera-1]: started with pid [855]
[ INFO] [1668478790.951814691]: Creating a nodelet::Loader
[ INFO] [1668478790.959547132]: Initializing nodelet with 12 worker threads.
[ INFO] [1668478790.960818215]: Loading nodelet 'zivid_camera/nodelet'
[ INFO] [1668478791.039600360]: Zivid ROS driver version 2.3.0
[ INFO] [1668478791.039654439]: Node's namespace is '/camera/zivid'
[ INFO] [1668478791.039679921]: Built towards Zivid Core version 2.8.0+891708ba-1
[ INFO] [1668478791.039699521]: Running with Zivid Core version 2.8.0+891708ba-1
[ INFO] [1668478793.093512247]: 1 cameras found
[ INFO] [1668478793.093611658]: Searching for camera with serial number '22295FBA' ...
[ INFO] [1668478793.136979503]: { Camera info: { Model: zividOnePlusMedium, Model Name: Zivid One Plus M, Serial Number: 22295FBA, Hardware Revision: 3.2, Firmware Version: 1.9.2+6f0325da, USB Path: na, Network Path: na, Internal camera id: 1204475, Projector firmware tag: ZIVID 1.0.5 } }
[ INFO] [1668478793.137039165]: Connecting to camera '22295FBA'
[ERROR] [1668478795.557401863]: Failed to initialize camera driver. Exception: "An OpenCL error occurred: clBuildProgram failed

This may indicate a problem with your OpenCL device and driver, or an incompatibility between the compute kernels and your OpenCL implementation. Try updating your drivers, verify that your OpenCL device and driver supports OpenCL 1.2, and install any pending operating system updates.

For more help, visit the Zivid Knowledge Base at https://support.zivid.com.

[CL_BUILD_PROGRAM_FAILURE]"
[FATAL] [1668478795.557547763]: Failed to load nodelet 'zivid_camera/nodelet'!
[camera/zivid/zivid_camera-1] process has died [pid 855, exit code 1, cmd /home/catkin_ws/devel/lib/zivid_camera/zivid_camera_node __name:=zivid_camera __log:=/root/.ros/log/c2dc39ac-648b-11ed-bdb5-f077c3d6518c/camera-zivid-zivid_camera-1.log].
log file: /root/.ros/log/c2dc39ac-648b-11ed-bdb5-f077c3d6518c/camera-zivid-zivid_camera-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete
done

System

NULL platform behavior clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) NVIDIA CUDA clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) Success [NV] clCreateContext(NULL, ...) [default] Success [NV] clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) No platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) No platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM) Invalid device type for platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL) No platform

ICD loader properties ICD loader Name OpenCL ICD Loader ICD loader Vendor OCL Icd free software ICD loader Version 2.2.11 ICD loader Profile OpenCL 2.1 NOTE: your OpenCL library only supports OpenCL 2.1, but some installed platforms support OpenCL 3.0. Programs using 3.0 features may crash or behave unexpectedly

### Output of nvdia-smi

+-----------------------------------------------------------------------------+ | NVIDIA-SMI 520.56.06 Driver Version: 520.56.06 CUDA Version: 11.8 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 Quadro RTX 3000 Off | 00000000:01:00.0 On | N/A | | N/A 48C P8 12W / N/A | 240MiB / 6144MiB | 28% Default | | | | N/A | +-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| +-----------------------------------------------------------------------------+

### These commands are run in the Dockerfile

RUN apt-get install -y \ unzip \ tar \ curl \ xz-utils \ ocl-icd-libopencl1 \ opencl-headers \ clinfo

make opencl available in docker container (zivid)

RUN mkdir -p /etc/OpenCL/vendors && \ echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd ENV NVIDIA_VISIBLE_DEVICES all ENV NVIDIA_DRIVER_CAPABILITIES compute,utility

Install Zivid SDK

RUN wget https://www.zivid.com/hubfs/softwarefiles/releases/2.8.0+891708ba-1/u20/zivid-telicam-driver_3.0.1.1-3_amd64.deb \ https://www.zivid.com/hubfs/softwarefiles/releases/2.8.0+891708ba-1/u20/zivid_2.8.0+891708ba-1_amd64.deb \ https://www.zivid.com/hubfs/softwarefiles/releases/2.8.0+891708ba-1/u20/zivid-studio_2.8.0+891708ba-1_amd64.deb \ https://www.zivid.com/hubfs/softwarefiles/releases/2.8.0+891708ba-1/u20/zivid-tools_2.8.0+891708ba-1_amd64.deb RUN apt install ./zivid-telicam-driver_3.0.1.1-3_amd64.deb \ ./zivid_2.8.0+891708ba-1_amd64.deb \ ./zivid-studio_2.8.0+891708ba-1_amd64.deb \ ./zivid-tools_2.8.0+891708ba-1_amd64.deb

RUN /bin/bash -c ". /opt/ros/noetic/setup.bash \ && cd catkin_ws/src \ && git clone https://github.com/zivid/zivid-ros.git \ && cd zivid-ros \ && git checkout a04aebf \ && cd ../.. \ && rosdep update \ && rosdep install --from-paths src --ignore-src -r -y \ && catkin build"


Can you help me solve this problem? 
Thanks in advance.
akocabas commented 2 years ago

The problem doesn't occur if Nvidia driver and cuda versions are downgraded. Using Driver Version: 510.85.02 and CUDA Version: 11.6 solved the problem in my case. This is more like a Nvidia issue than a Zivid issure. Therefore i'm closing this.