OpenCL On ubuntu 16.04, Intel Sandy Bridge CPU
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
Command to list your devices
clinfo
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
Usefull linkes I have used to put this together
https://wiki.tiker.net/OpenCLHowTo http://korniychuk.org.ua/instruction/how-to-use-opencl-on-ubuntu-16-04/ https://laanwj.github.io/2016/05/06/opencl-ubuntu1604.html https://software.intel.com/en-us/articles/opencl-drivers#latest_linux_SDK_release https://software.intel.com/en-us/forums/opencl/topic/285869 https://streamcomputing.eu/blog/2011-06-24/install-opencl-on-debianubuntu-orderly/ https://software.intel.com/en-us/forums/opencl/topic/390630 https://stackoverflow.com/questions/16977216/opencl-compile-on-linux
As per Intel's support site, OpenCL is not supported on 2nd gen (Sandy Bridge) Core processors.
You will need a 3rd gen (Ivy Bridge) or newer CPU to use OpenCL 1.2, or a 7th gen (Kaby Lake) to have the option to use OpenCL 2.0 with the Intel GPU (I am not sure what is currently supported in the drivers available for Linux).