Installing and using Portable Computing Language (PoCL)

PoCL, a perfect companion for Portable Apps?

Update August’13: 0.8 has been released

PoCL stands for Portable Portable Computing Language and the goal is to make a full and open source implementation of OpenCL 1.2 for LLVM.

This is about installing and using PoCL on Ubuntu 64. If you want to put some effort to build it on Windows, you will certainly help the project. See also this TODO for version 0.8, if you want to help out (or want to know its current state). Not all functionality is implemented, but the project progresses using test-driven development – using the samples in the SDKs as a base.


They are eager for collaboration, so new backends can be added. For what I’ve seen this project is one of the best starts for new OpenCL-drivers. First because of the work that already has been done (implement by example), second because it’s an active open source project (continuous post-development), third because of the MIT-license (permits reuse within proprietary software). Here at StreamHPC we keep a close eye on the project.

On a normal desktop it has only one device and that’s the CPU. It has backends for several other types of CPUs (check ./lib/kernel in the source):

  • ARM
  • Cell SPU
  • Powerpc
  • Powerpc64
  • x86_64

Also the TCE libraries can be used as backend. The maturity of each backend differs.

More support is coming. For instance Radeon via the R600 project, but PoCL first needs to support LLVM 3.3 for that.

It is also a good start to build drivers for your own processor (contact us for letting us assist you in building such backend, see Supporting OpenCL on your own hardware for some related info)


Download from here.

In order to build PoCL 0.8, you need the following support libraries and tools:

* LLVM & Clang 3.2 or 3.3
* gcc or a compatible compiler
* GNU make
* libtool dlopen wrapper files (e.g. libltdl3-dev in Debian)
* pthread (should be installed by default)
* hwloc v1.0 or newer (e.g. libhwloc-dev)

With above information you can make ./configure happy. The project does not compile with the AMD-provided OpenCL ICD (amd-libopencl1). Install ocl-icd-libopencl1 for correct behaviour.

If you’re ready, run ./configure. The results end with something like:

Using LLVM version 3.2 from /usr/lib/llvm-3.2

ICD extension: enabled
Warning: ocl-icd not found.
‘make check’ might fail if it is run before ‘make install’ unless
your ICD loader supports the OCL_ICD_VENDORS environment variable
please consult
for details.

Enabling direct linking with libpocl.

Using vecmathlib math builtins.
Enabled device drivers: basic pthreads
Enabled testsuites:

Do a “make”, then a “make test”. The latter will take a LOT of time.

To install do a “make install”.

Using PoCL

There are two methods. One is hard-linking it to OCL, and the second is using the ICD. The first is perfect for truly portable software, while the latter is better for testing and installed by default.

You need to make sure the pocl-library is found:

export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH

Or add it to your ldconfig.

The results of clinfo:

Platform Profile:                 FULL_PROFILE
Platform Version:                 OpenCL 1.2 pocl 0.8rc6
Platform Name:                 Portable Computing Language
Platform Vendor:                 The pocl project
Platform Extensions:                 cl_khr_icd

And we are set to compare to Intel’s and AMD’s OpenCL implementation.


Let me know if you’d like to see specific benchmarks. Nothing shared for now.

One thought on “Installing and using Portable Computing Language (PoCL)

  1. extraymond

    So in future, can we benefit from the r600g driver which can expose the
    opencl potential to execute program like luxrender via pocl?

    If that is a go, its gonna be a real big push toward foss and professional programs!
    Is AMD involved in pocl? Sounds like a cool place to push HSA!

Comments are closed.