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 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
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