Hello
I want to run OpenCL sample apps on Mali T-628 gpu in Android platform.
i hv downloaded Mali OpenCL SDK.
My host system is Ubuntu 12.04
I saw entire development guides but couldnt understand.Any instructions on how to go about it?
Thks
Hello,
I'm afraid you may need to give a few details if you would like people to be able to help you.
For instance, what did you read?
What did you not understand?
Thks for ur reply.
I went thro http://infocenter.arm.com/help/topic/com.arm.doc.dui0538e/DUI0538E_mali_t600_opencl_dg.pdf.
I know to debug apps in mobile devices but i dont hv any idea on this.
Also i saw requirement of SourceBench Lite for compiling OpenCL programs but i am not able to download it.
Can u plse help?
H Aravind,
I don't know if the SDK supports Android out of the box, but it should be possible to build the samples using the NDK toolchains supplied with the Android NDK (codesourcery only applies to Linux and is out of date anyway), although you may need to create a basic Android.mk file etc that builds an executable. actually running the samples on your device would require OpenCL drivers to be present on the device, does your device have these? Commercial devices almost never do out of the box.
Hth,
Chris
Thks Chris for ur response.
1) creating an Android.mk is not problem.Native support can be added.
2) there are OpenCL drivers. I m using ODROID-XU3. it has support for it.
But what must i do to run the sample on this platform.?
or rather how should i change the code to make it compatible with Mali GPU.?
Thanks
So assuming you're talking about the OpenCL SDK that we ship, in the past I just build it as an executable, I.e. no APK just a binary, and then run that on the device from the command line. If its another sample then as long as it conforms to OpenCL1.1 then it should run just fine but obviously open cl is not necessarily performance portable so your mileage may vary if it was not written to take full advantage of the Mali vector architecture.
Thanks for your reply.
1)Ya I am using Mali sdk.
So what I understand is : just build the opencl sample and run it on the
android device.
No need to do anything else. Right?
2) of course performance will vary while deploying other opencl sample as u
suggested but I want to know whether it will run in the first case?
Because the code is written for a particular platform so while compiling it
will ask for different libraries right?
1. That's been my experience yes, can easily build binaries for Android and run them at command line. Only requirement is opencl libs on the device.
2. The only requirement for open cl is the open cl libs to link and run against. Obviously there may be other dependencies that the specific application you have in mind may have, which will need to be available at link and run time to link and run against. This is application specific so you'd need to know what exactly it depends on, and whether or not you have those available to compile and link against, and if not, whether or not you can procure them. This is normal though and nothing to do with open cl specifically.
Thks Chris for ur reply
But i just saw ur post in another discussion "
Is Mali OpenCL SDK will support Android? Nov 28,2013 10.21 AM . U had told the OpenCL samples will run for Ubuntu but not for Android.
Is the Mali SDK updated after that since it has been 2 yrs?
I am not critical of ur above answer but i just want to understand it:)
Hi aravind,
It was over a year ago so I don't remember specifically but it is certainly true that the opencl SDK examples do not compile for, or run on android out of the box. They require some mods to do so, as described above, and probably I had not attempted it myself at the time so couldn't say with any confidence whether it was or wasn't possible. I have since done it though so am happier to say it is possible although it is of course not strictly supported or guaranteed, i have had success in the past. The Android/Application.mk files are quite trivial to derive from ndk samples so I would encourage you to give it a go and let us know if you have any problems that we could help with.
Thks Chris for ur help.
I will try it nd come back to u:)
Thks once again
Hello Chris
I hv got Mali SDK.
It contains the samples.i choose "hello_world_opencl". The file contents are hello_world_opencl->assets,hello_world_opencl.cpp,Makefile.
Inside assets->hello_world_opencl.cl
Basically i will hv to write the Android.mk and Application.mk files and also the source java file right?
Can u just elaborate on this?
Hi Aravind,
Sorry for late reply, was at GDC last week. You will need to write the Android.mk and Application.mk files, but you won't need to write any Java files, you can just build an executable, i.e. not an APK, just a raw binary, with the NDK. It's fairly trivial to write the Android.mk file. Take a very simple NDK sample app and copy the jni folder, then modify that to include the correct files and build a binary, you should have no trouble! I'll try and get an example to you this week.
Thanks,
Thks Chris for reply.
1) I saw NDK samples. But the thing is the Android.mk file varies a lot with the application. So just replacing the <file name> will help?
2)Also the activity file will load the .so ( got from the cpp file) and as a result we can run the application. Without that wont we just get a default "hello world" message?
3) Say i want to run the "mandelbrot" sample in Mali SDK as an android app. What changes should i do?
Aravind
The activity file is not necessary if you're building a pure native binary, i.e. you wouldn't build the C++ code as a shared library, you would build it as a native binary with the NDK using BUILD_EXECUTABLE. c - Want to compile native Android binary I can run in terminal on the phone - Stack Overflow first answer is an example of this. I'll see if I can put a sample together this week.
Cheers,
Thks Chris
Ur knowledge base is very extensive.
So 1 prblem is solved. The changes in Android.mk still remains though. It will be nyc if u could provide furhter insights into it
So I've given it a go at producing the Android NDK makefiles necessary to build the OpenCL samples... I've attached a zip which you should be able to unzip over the top of your OpenCL SDK. It will add a couple of jni folders, one in lib and one in samples\hello_world_opencl. To build the hello_world_opencl sample fire up a command prompt and do the following:
The first ndk-build will build the OpenCL stub library, which exists purely to satisfy the link requirements for the samples. It is not a real implementation of OpenCL, and indeed at runtime you will be running against the real implementation present on the device. The second ndk-build will build the sample.
Note that this is only enough to make it build, I have made no modifications to the source code itself to make it run correctly, i.e. looking for files in the right place, etc, but this should be enough to get you building and running at least. I'd recommend building clinfo and checking that you get the correct diagnostic output.