• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2#this might work on other DEB based distros, YMMV
3#prereqs: wget, rpm2cpio, cpio, clinfo (for testing), and no other conflicting OpenCL drivers
4#Get this file
5#https://software.intel.com/en-us/articles/opencl-drivers#philinux
6#http://registrationcenter.intel.com/irc_nas/4181/opencl_runtime_14.2_x64_4.5.0.8.tgz
7#or this one http://registrationcenter.intel.com/irc_nas/5193/opencl_runtime_15.1_x64_5.0.0.57.tgz
8#wget http://registrationcenter.intel.com/irc_nas/4181/opencl_runtime_14.2_x64_4.5.0.8.tgz
9wget http://registrationcenter.intel.com/irc_nas/5193/opencl_runtime_15.1_x64_5.0.0.57.tgz
10
11#unpack the tarball
12tar xvf opencl_runtime_15.1_x64_5.0.0.57.tgz
13
14#unpack the rpms
15#according to http://mhr3.blogspot.com/2013/06/opencl-on-ubuntu-1304.html, we don't need all of them unpacked
16#basically, just the ICD itself
17rpm2cpio opencl_runtime_15.1_x64_5.0.0.57/rpm/opencl-1.2-intel-cpu-5.0.0.57-1.x86_64.rpm | cpio -idmv
18
19#stub out the directory structure for the deb package as a staging area
20#some of these steps are from here http://mhr3.blogspot.com/2013/06/opencl-on-ubuntu-1304.html
21mkdir opencl-driver-intel-cpu
22cd opencl-driver-intel-cpu
23mkdir DEBIAN
24mkdir -p etc/OpenCL/vendors
25mkdir -p usr/lib/x86_64-linux-gnu/OpenCL/vendors/intel
26mkdir -p usr/share/doc/opencl-driver-intel-cpu
27cd ..
28
29#put the right description of the package in the right place
30#from the blog post with my modifications
31#version number is from the filename
32cat <<'EOF' >>  opencl-driver-intel-cpu/DEBIAN/control
33Package: opencl-driver-intel-cpu
34Version: 5.0.0.57
35Section: libs
36Priority: optional
37Architecture: amd64
38Depends: ocl-icd-libopencl1 (>= 2.0), libnuma1
39Maintainer: Your Name
40Description: Intel OpenCL CPU implementation
41 This package provides Intel OpenCL implementation which can utilize Intel Core processors.
42EOF
43
44#copy over the documentation into the deb staging area
45cp opt/intel/opencl-1.2-5.0.0.57/doc/* opencl-driver-intel-cpu/usr/share/doc/opencl-driver-intel-cpu/
46
47#the icd registry could be copied from opt/intel/opencl-1.2-5.0.0.57/etc/intel64.icd
48#but it's wrong anyway and we'd have to change it, handle this later
49
50#now put the libs where they go in the staging area
51cp opt/intel/opencl-1.2-5.0.0.57/lib64/* opencl-driver-intel-cpu/usr/lib/x86_64-linux-gnu/OpenCL/vendors/intel/
52
53#now deal with that icd registry
54cat <<'EOF' >>  opencl-driver-intel-cpu/etc/OpenCL/vendors/intel64.icd
55/usr/lib/x86_64-linux-gnu/OpenCL/vendors/intel/libintelocl.so
56EOF
57
58#finally build the deb package
59dpkg-deb --build opencl-driver-intel-cpu
60
61#and install it
62sudo dpkg --install opencl-driver-intel-cpu.deb
63sudo apt-get install -f
64sudo ldconfig
65clinfo #this verifies it installed correctly
66#cleanup
67rm -rf opencl-driver-intel-cpu opencl_runtime_15.1_x64_5.0.0.57*
68