mjmworks

OpenCL on Debian Wheezy

OpenCL on x86 CPU Debian Wheezy

To skip straight to the steps that I followed click here

My experience

First I read some documents at Part-OpenCL-Portable-Parallelism and Introductory-Tutorial-to-OpenCL which interested me greatly, this is where I started to get bogged down in jargon however and it took a while to work out exactly what was going on.

A brief synopsis of OpenCl

OpenCl is a library that enables a program to compile another program so that it can be run on various hardware be it a GPU or CPU on some system or other, it is designed to make use of parallel execution and optimize for the type of program i.e. data parallel or task parallel.
A typical example program uses the OpenCl library which needs to be installed on the compiling computer.
The program can check using the OpenCl library API which devices the host can supply, such as your graphics card or local cpu.
Each of these devices must have a driver installed which in effect maps the opencl program API to the native code on the GPU or CPU (or mixture of both depending on the capabilities of the devices). OpenCl also needs a loader to load these device drivers.
The program then loads the other program source which looks similar to C99 code, it generally has a .cl extension.
It then compiles this source code into a kernel for the devices that the host has available. It then queues the kernel to be run by the devices, and communicates with the devices or threads using events to send in data or receive data.

The problems

Here I list the problems I had whilst trying out various samples. I had opened synaptic package manager on my linux box:
Linux zelazny 3.2.0-4-686-pae #1 SMP Debian 3.2.57-3 i686 GNU/Linux
Debian Wheezy version 7.5 

and installed the following packages:
nvidia-opencl-icd
nvidia-opencl-common
opencl-headers
ocl-icd-opencl-dev
ocl-icd-libopencl1

I then went through one of the example programs listed above. example
Before compiling I made sure I had the cl.hpp file referenced available here: http://www.khronos.org/registry/cl/
All ok so far.
Success!!!! Run the program ./hello
./hello
Platform number is: 1
Platform is by: Advanced Micro Devices, Inc.
Hello World
Success!!! since the nvidia packages were doing \"not a lot\" I removed them recompiled and tested and all seemed to work.

The Distilled Steps

Enjoy.
I hope this has been helpful to somebody, and thanks to the authors of the articles I link to for their help.
Back to work.......