Skip to content

Using OpenCL with Intel GPU on Linux #109

@kohrt

Description

@kohrt

Thanks to the work of @masterhui, we have instructions to get OpenCL running on Intel GPUs using Beignet. I think this is useful for many people here too. The original thread is code-iai/iai_kinect2#11.

Known configuration

Dependencies for Beignet

For Beignet the following depencies have to be installed manually:

  • ocl-icd-dev
  • ocl-icd-libopencl1
  • libdrm / libdrm-dev
  • llvm-3.5 / llvm-3.5-dev
  • clang-3.5 / clang-3.5-dev
  • libegl1-mesa-dev
  • libedit-dev

Building Beignet

Download and compile the Beignet v1.0 release from source (there is a Beignet_v0.3 binary for Trusty, but it is very old, buggy and slow)

Additional steps (if needed):
  • Error "clang: not found":

    sudo ln -s /usr/lib/llvm-3.5/bin/clang /usr/bin/clang
    
  • Known Beignet issue with Kernel 3.15/3.16 (see Beignet readme); fix is to disable cmd_parser:

    sudo su
    echo 0 > /sys/module/i915/parameters/enable_cmd_parser
    
  • To get 100% pass rate on the Beignet unit tests you may have to:

    • Execute directly on hw: ssh-session might not work
    • Execute as root

Note: Both previous points have to to with the fact that no x-server was installed. Apparently this will be fixed in a future release of Beignet.

Results on Intel i7-3840QM (mobile hardware)

  • ~100 fps on the OpenCLDepthPacketProcessor (compared to < 5 fps on same hardware using CPU-based depth registration!)

    ...
    [OpenCLDepthPacketProcessor] avg. time: 10.1716ms -> ~98.3129Hz
    [TurboJpegRgbPacketProcessor] avg. time: 16.0787ms -> ~62.194Hz
    ...
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions