Bastian Köcher Ubuntu Intel OpenCL 16.1 Install Script

Created by Bastian Köcher
#based on
#this might work on other DEB based distros, YMMV
#prereqs: wget, rpm2cpio, cpio, clinfo (for testing), and no other conflicting OpenCL drivers
#Get this file
#or this one

#unpack the tarball
tar xvf opencl_runtime_16.1_x64_ubuntu_5.2.0.10002.tgz

#unpack the rpms
#according to, we don't need all of them unpacked
#basically, just the ICD itself
rpm2cpio opencl_runtime_16.1_x64_ubuntu_5.2.0.10002/rpm/opencl-1.2-intel-cpu- | cpio -idmv

#stub out the directory structure for the deb package as a staging area
#some of these steps are from here
mkdir opencl-driver-intel-cpu
cd opencl-driver-intel-cpu
mkdir DEBIAN
mkdir -p etc/OpenCL/vendors
mkdir -p usr/lib/x86_64-linux-gnu/OpenCL/vendors/intel
mkdir -p usr/share/doc/opencl-driver-intel-cpu
cd ..

#put the right description of the package in the right place
#from the blog post with my modifications
#version number is from the filename
cat <<'EOF' >>  opencl-driver-intel-cpu/DEBIAN/control
Package: opencl-driver-intel-cpu
Section: libs
Priority: optional
Architecture: amd64
Depends: ocl-icd-libopencl1 (>= 2.0), libnuma1
Maintainer: Your Name 
Description: Intel OpenCL CPU implementation
 This package provides Intel OpenCL implementation which can utilize Intel Core processors.

#copy over the documentation into the deb staging area
cp opt/intel/opencl-1.2-* opencl-driver-intel-cpu/usr/share/doc/opencl-driver-intel-cpu/

#the icd registry could be copied from opt/intel/opencl-1.2- 
#but it's wrong anyway and we'd have to change it, handle this later

#now put the libs where they go in the staging area
cp opt/intel/opencl-1.2-* opencl-driver-intel-cpu/usr/lib/x86_64-linux-gnu/OpenCL/vendors/intel/

#now deal with that icd registry
cat <<'EOF' >>  opencl-driver-intel-cpu/etc/OpenCL/vendors/intel64.icd

#finally build the deb package
dpkg-deb --build opencl-driver-intel-cpu

#and install it
sudo dpkg --install opencl-driver-intel-cpu.deb
sudo apt-get install -f
sudo ldconfig
clinfo #this verifies it installed correctly
rm -rf opencl-driver-intel-cpu opencl_runtime_16.1_x64_ubuntu_5.2.0.10002*
rm -rf opt

Comments (2)

  1. Raj Bhattacharjea

    Now that Intel officially supports OpenCL Runtime 16.1 on Ubuntu, you don't have to do these tricks to get it to install. Running "" or "" from the tarball downloaded in this script works just fine.