echelon


Embedded OpenCL Hardware

For quite some time I have been looking for a suitable development device to do GPGPU on ARM embedded hardware. My requirements are inexpensive, ARM platform, running Linux, shared memory between CPU and GPU with GPGPU capable drivers as well as GPGPU libraries available (OpenCL or CUDA). I plan to add such a device to my small zoo of machines that compile and test my accelerator programming library Aura. Here are the options I considered:

There are other boards with GPUs that can run OpenCL. Among them is for example the pandaboard ES. Unfortunately it is difficult or rather impossible to obtain OpenCL drivers and libraries for these. I picked the ODROID-XU3 since I could order it from a local supplier here in Germany. 3 days after placing the order it arrived. It comes with no accessories except for a power supply and a plastic case. So I ordered a 16GB micro SD card with the board since SD cards are cheaper than eMMC.

ul
My Odroid-XU3

Installing and booting the operating system was a breeze. I chose the Ubuntu 14.04 LTS server from the Odroid download page, since an X server is not necessary for my undertakings. I plugged the SD card into my Notebook and followed the instructions.

# /dev/sdX represents the micro SD card in this example
cd ~/Downloads
md5sum ubuntu-14.04lts-server-odroid-xu3-20140902.img.xz
# compare md5 from website
xz -d ubuntu-14.04lts-server-odroid-xu3-20140902.img.xz
# make sure the card is not mounted
sudo umount -f /dev/sdX
# fill the card with zeros (optional)
sudo dd if=/dev/zero of=/dev/sdX bs=4M
# copy the image
sudo dd if=/home/USER/Downloads/ubuntu-14.04lts-server-odroid-xu3-20140902.img of=/dev/sdX bs=4M
sync

I then proceeded with resizing the root file system for the file system to fill the entire SD card. I used gparted for this. I’m not sure if this was necessary (or even a good idea) but I wanted to make sure I had enough room to install libraries and tools, compile things and store test data. Before I could boot from the SD card, I had to switch the boot mode selector in the right position. By default it was set to eMMc boot (left switch was on) so I switched the left switch to off. I put the SD card in the board, connected it to my router, connected the power-supply et voilà: it booted up (it has a nice RGB led that lights up in all colors during boot). I then checked if the router issued an IP number (it did) and proceeded with logging into the system via SSH using the root user and the password odroid.

The gcc suite was already preinstalled with the image I used, the same was true for git. I installed cmake and downloaded the latest boost libraries. Building the libraries I needed (thread, system, test, chrono, atomic) took about 10 minutes. I could not find any libOpenCL file on the system so I figured I hat to install those myself. I found a comprehensive howto explaining how OpenCL can be installed on a chromebook that had the correct link to the ARM Mali download site. I downloaded MALI-T62x for fbdev from 13th of August 2014 and extracted the contents of the file to /usr/lib. I could obtain the OpenCL header files from here.

I cloned my library and tried to build the unit tests. The linker complained about missing OpenCL functions (all of them were missing). After a short investigation I now conclude that for OpenCL to work on this board, I need to link both libOpenCL.so and libmali.so. After I added the Mali library to the build file, everything compiled and all unit tests passed. Yay!

An update:
Playing more with the system I discovered that only root can run OpenCL code. Turns out a chmod a+rwx /dev/mali0 fixes that.



8 Comments »

#1 kosmonaut_pirx wrote on February 19, 2015:

hello,
maybe it’s helpful to note that only Release r4p0-02rel0 seems to work with current hardkernel kernel. Other Release r5p0-06rel0 and Release r4p1-00rel0 listed at Mali site do not work, due to no opencl device available then. Tested fbdev versions only, using opencv and jtr.
regards

#2 user wrote on March 22, 2015:

Hello
ur blog is very helpful. I am having a few doubts.
I am running XU3 in Android. When I run openCL app it tells that “opencl functions are missing”. I have got the libopencl.so file with the sdk and i also hv the opencl headers at the appropriate place. But i cant find the libmali.so. Any clues? Thanks in advance

#3 Sebastian Schaetz wrote on March 22, 2015:

Hi user, did you download everything from http://malideveloper.arm.com/develop-for-mali/features/mali-t6xx-gpu-user-space-drivers/ ?

#4 user wrote on March 23, 2015:

Thanks for reply. I saw that but i want for “ODROID-XU3” and the platforms dont specify support for it. Is it ok? If do Then i just extract to /usr/lib right ? How should i clone the library and link the two .so?
Thanks

#5 Sebastian Schaetz wrote on March 23, 2015:

That is ok though, it is the same GPU. Check out this blog article for specifics http://community.arm.com/groups/arm-mali-graphics/blog/2014/12/18/installing-opencl-on-chromebook-2-in-30-minutes You can link to the library by just passing -lmali or something similar to your compiler.

I updated the blog to reference the correct blog article.

#6 user wrote on March 23, 2015:

Thanks. I have downloaded the library but $chown root /fbdev/* But it gives me error saying:permission denied. I tried with sudo but no use.Any clues ?
Also i need not download opencl headers since i am having them in sdk and can copy it to /usr/include/cl ?
Thanks

#7 user wrote on March 23, 2015:

Hello I hv copied the files to /usr/lib.
The problem is link both libOpenCL.so and libmali.so. do u have any ideas?
Also i dont have any dev/mali0 to run “chmod a+rwx /dev/mali0” . Can uplse help?

#8 Sebastian Schaetz wrote on April 17, 2015:

Hi, did you figure out the problem or do you still need help?

Leave a comment