How to compile OpenCL on Ubuntu?

前端 未结 4 1633
有刺的猬
有刺的猬 2020-12-01 12:58

Question: What is needed headers and drivers are needed and where would I get them for compiling open CL on ubuntu using gcc/g++?


Info: for a while now I\'ve b

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-01 13:58

    I've recently used similar process on a clean build on linux, setting up OpenCL with an NVIDIA card.

    Steps I took:

    1 - install the NVIDIA driver.

    2 - install the CUDA tool kit - (follwing the steps in the guide, there are many ways to do it, but I used the .deb installer, guide can be found here: http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/)

    3 - using apt-get install the OpenCL headers. Command: sudo apt-get install opencl-headers

    Using the : CL/opencl.h header I was able to compile C/C++ code using gcc/g++ and the flag: -lOpenCL

    Explaination of steps

    1 - Self explanatory

    2 - The CUDA toolkit also installs the OpenCL library (libOpencl.so) but not the header (at least not on my system)

    3 - hence the header can be installed with apt-get. The header files get stored in the /usr/include/CL directory

提交回复
热议问题