.. so I assume some of you bravehearts would’ve tried the earlier post about getting pocl to work on an ARM chromebook. I mentioned there that initially, –disable-icd is a better option.
In this post, I’ll outline how to get Khronos ICD Loader working with pocl (thanks to )
[Assumptions: my pocl directory is ~/code/pocl; and I unpack khronos ICD loader into ~/code/icd - please adjust according to your environment]
- Download and unpack the Khronos ICD Loader from here: http://www.khronos.org/registry/cl/
- Connect CL headers from the include directory of your pocl working area (eg ~/code/pocl/include) , to the ‘inc’ directory in the location where you unpacked
- Either copy:
- cp -rf ~/code/pocl/include/CL ~/code/icd/inc
- OR, you could create soft link as well, like this:
- cd ~/code/icd/inc; ln -s ~/code/pocl/include/CL .
- Either copy:
- CD to the icd loader directory [eg ~/code/icd], and apply a patch thus:
- patch -p1 < ~/code/pocl/tools/patches/khronos-icd-loader.patch
- Build it with ‘make’
- Copy the loader to a library search path:
- sudo cp bin/libOpenCL* /usr/lib
Now, you should be able to tell the pocl build system to allow overriding the ICD search path with OCL_ICD_VENDORS environment variable like this:
Now you can adapt your pocl configure to –enable-icd :)
: make sure you connect the pocl CL headers *only*; the others don’t seem to work for me
pocl , is a portable Open CL implementation.
During some fun-at-work last week, we [Tom and I] decided to play around with it a bit. We thought of using it over others, since it is a good community-driven project, and also because it was already running on another ARM platform (pandaboard).
Since we had recently started using Ubuntu on our ARM chromebooks, this seemed like the perfect dev platform to experiment on!
It soon turned out that there are some mismatches, so although we were able to build it, we had some trouble running most of the example tests.. – clCreateBuffer was failing!
Tom suggested that there might be flag-mismatch issues, for example with float-abi, etc between clang and C. Some more digging revealed that indeed, that seemed to be the issue: the target for llvm / clang was not being set correctly, and so clang / llvm would take defaults (I *really don’t understand* why llvm would default to an ARMv4 machine!!), which wouldn’t match up with the chromebook environment.
Also, it seems since some time Ubuntu on ARM has started using the gnueabihf (hard float) toolchain by default, so the flags had to be adjusted. Not just that, if the CL kernel compilation was broken down into multiple steps, we had to make sure all steps had same (or similar, eg in case of ld) flags to ensure compatibility.
I, being a comparative n00b on most things userspace, took some time to figure out the changes that were required to get pocl working on the chromebook, but in the end, some success, and a merge-request to the pocl upstream community followed :)
So, here are the current steps needed to build pocl on ARM chromebook:
[my environment: pocl from trunk + my changes : 0.8-pre; ubuntu 13.04, running on ARM chromebook; llvm/clang: 3.3svn version, taken from trunk last week of April, 2013]
1. Export the symbols required:
export POCL_BUILDING=1 export CLFLAGS="-mcpu=cortex-a9 -mfloat-abi=hard -mfpu=neon" export TARGET_CLANG_FLAGS="-mcpu=cortex-a9 -mfloat-abi=hard -mfpu=neon" export HOST_CLANG_FLAGS="-mcpu=cortex-a9 -mfloat-abi=hard -mfpu=neon"
* If you’re using a released tarball of the pocl source and not the trunk version from bazaar, exporting POCL_BUILDING is not needed.
2. configure, thus:
./configure --host=armv7l-unknown-linux-gnueabihf --disable-icd --enable-debug --enable-testsuites=all
you could potentially leave out –enable-debug, but –enable-testsuites is recommended; –disable-icd makes it easier to debug in case of any issues. (another post coming up on setting a dummy ICD)
‘check’ will make make create and execute the testsuite as well.
That’s all! Go ahead, and Enjoy!
Oh, and by the way, if you’re interested in similar work on things like general purpose computing on GPUs on ARM SoC devices, you could also join the linaro-gpgpu list.
: The list can be found at http://lists.linaro.org/mailman/listinfo/linaro-gpgpu