How to compile OpenCL on Ubuntu?

前端 未结 4 1637
有刺的猬
有刺的猬 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:47

    Things that worked for me in Ubuntu 16.04

    I have installed openCL on:

    SandyBridge CPU: cpu only

    IvyBridge GPU

    Nvidia GTX 950

    install packets

    Generic ubuntu packages for OpenCL

    Basic installation sudo apt install ocl-icd-libopencl1 sudo apt install opencl-headers sudo apt install clinfo

    Package that allows to compile OpenCL code (1.2 I think)

    Needed to link and compile sudo apt install ocl-icd-opencl-dev

    For Intel GT core

    Package that enables runnig openCL on Intel GT, IvyBridge and up

    sudo apt install beignet

    For SandyBridge Intel CPU and possible others

    Download this file OpenCL™ Runtime 16.1.1 for Intel® Core™ and Intel® Xeon® Processors for Ubuntu* (64-bit) On https://software.intel.com/en-us/articles/opencl-drivers#latest_linux_SDK_release

    Install packages for turning rpm to deb sudo apt-get install -y rpm alien libnuma1

    Untar downloaded file tar -xvf opencl_runtime_16.1.1_x64_ubuntu_6.4.0.25.tgz cd opencl_runtime_16.1.1_x64_ubuntu_6.4.0.25/rpm/ Turn rpm files to deb fakeroot alien --to-deb opencl-1.2-base-6.4.0.25-1.x86_64.rpm fakeroot alien --to-deb opencl-1.2-intel-cpu-6.4.0.25-1.x86_64.rpm Install .deb packages sudo dpkg -i opencl-1.2-base_6.4.0.25-2_amd64.deb sudo dpkg -i opencl-1.2-intel-cpu_6.4.0.25-2_amd64.deb Touch local config file sudo touch /etc/ld.so.conf.d/intelOpenCL.conf Open the file sudo vim /etc/ld.so.conf.d/intelOpenCL.conf and add the line

    /opt/intel/opencl-1.2-6.4.0.25/lib64/clinfo

    Create a vendors dir and add intel.icd sudo mkdir -p /etc/OpenCL/vendors sudo ln /opt/intel/opencl-1.2-6.4.0.25/etc/intel64.icd /etc/OpenCL/vendors/intel64.icd sudo ldconfig

    test if this worked

    clinfo should list your devices Dowload this file

    https://codeload.github.com/hpc12/tools/tar.gz/master

    Run this code to make sure everything works tar xzvf tools-master.tar.gz cd tools-master make ./print-devices ./cl-demo 1000 10 This should print out GOOD in the end

    For Nvidia

    install nvidia drivers (I used 370), this should include all the runtime dirvers

提交回复
热议问题