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
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
Thanks
Aravind
Hi Aravind,
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.
Hth,
Chris
Thanks a lot Chris.
I tried ndk-build for OpenCL stub.
ara@Aravind:~/Downloads/Mali_OpenCL_SDK_v1.1.0/lib$ ndk-build
make: *** No rule to make target `jni\../..\lib\opencl_stubs.c', needed by `obj/local/armeabi-v7a/objs/OpenCL/..\lib\opencl_stubs.o'. Stop.
It is not finding the opencl_stub file. I changed the Android.mk from LOCAL_SRC_FILES := opencl_stubs.c to LOCAL_SRC_FILES := ..\lib\opencl_stubs.c
But no use. can u plse help?
My bad, Linux doesn't like the backslashes (I wrote this on Windows ) change the backslashes to forward slashes in the Android.mk files and you're good to go
Cheers,
Hello Chris
Thanks a lot.It worked.
A libs folder and and obj folder is created inside <hello_world_sample> and inside <Mali_SDK--- / lib >
How should I run it?
Also the procedure is the same for all samples right , except we have to change the source file ?
Thanks a lot
Yeah the process is the same, just look at the makefiles to see what files are compiled and what the includes are for specific samples and recreate the Android.mk files I provided for those samples to run them, just copy the binary to the device, chmod it so it's executable and run it from the shell. It will fall over trying to load a file most likely, so you will need to modify the source so it looks in /sdcard/ or something. From memory at present it will look for an Assets folder in the current working dir.
So i will have to copy the hello_world_opencl executable present inside obj->local->armeabi-v7a to device.
i run $ adb shell pm setInstallLocation 2 to install it in sdcard.
To modify source, u mean i will hv to change the Android.mk file LOCAL_SRC_FILES := hello_world_opencl.cpp to look inside sdcard? Sorry i dont understand
setInstallLocation is a package manager command, and will only affect where the package manager installs packages. In this case you don't have a package to install, I assume you'll probably just push the thing with adb push somewhere like /sdcard/ and run it from there?
As for source, I am referring to the actual C++ source code, not the Android.mk file. Generally speaking there may be some minor issues running on Android which you may need to fix, e.g. broken file paths, but then again it might just work without issues. We don't routinely test on Android as we don't support it out of the box.
I tried the push command. The problem is i am getting "permission denied error"
------------------
$adb shell
#su
# mount -o remount,rw /dev/block/stl9 /system
#chmod 777 /system/app
# exit
exit
$adb push---
-------------------
What is the problem ? Or is there an alternative ?
adb push thing /sdcard/thing isn't working? Does the device have an /sdcard/ directory? If adb push isn't working on your device then that's a support request for HardKernel I think!
Yes there is a sd card directory.But the "error" is not specific to ODROID but ubiquitous in many devices.
Can u plse suggest an alternative?
I'm afraid I've never had any trouble with adb push. Can you copy the exact line you're typing? I guess without using the Android tools you're limited to moving files onto/off the device with USB keys etc.
With production devices, even with root capabilities, you cannot push directly to the system partition - even if you remount it as rw.
For these devices with this security feature, you have to push it to the sdcard first, then adb shell and copy the files from the sdcard to your destination (note: mv will not work due to cross-filesystem limitations, a cp will work)
However you should have an eng build running on a devboard such as the XU3, so pushing directly to a rw system partition is possible, but only after you first run the following commands:
adb root
adb remount
It sounds like you are having a lot of basic problems. A lot of the issues you are now raising are not related to Mali, or indeed ARM.
Please google for the answer to generic problems before posting here.
We cannot and will not do the work for you.
Thank you for understanding, and we are more than happy to help with any Mali and/or ARM specific issues or questions you may have.
Kind Regards,
Michael McGeagh
Oh ok I understand ur jurisdictions.
i will try ur suggestions
chrisvarns Thks to u too.
Hi Chris,
My Phone is HuaWei Mate 7, GPU is T628.
I did as your says. And I adb push the hello_world_opencl to the /mnt/sddcard/neon. And I run the executable file, there is a error that is :
shell@hwmt7:/mnt/sdcard/neon $ ./hello_world_opencl
OpenCL error: CL_OUT_OF_HOST_MEMORY
Creating an OpenCL context failed. /root/android-ndk-r10d/samples/hello-jni/jni/common.cpp:248
Failed to create an OpenCL context. /root/android-ndk-r10d/samples/hello-jni/jni/hello_world_opencl.cpp:39
1|shell@hwmt7:/mnt/sdcard/neon $
How to fix this error? Thank you very much.
Hi
The reason for ur error is given in this link https://www.khronos.org/registry/cl/sdk/1.0/docs/man/xhtml/clCreateContext.html
Have you pulled the .so library from your HuaWei ?