Forums - run OpenCL samples

17 posts / 0 new
Last post
run OpenCL samples
aravindg
Join Date: 7 Feb 15
Posts: 10
Posted: Mon, 2015-02-16 04:37

Hello

I am trying to run the OpenCL samples from adrenosdk-linux on my Moto g phone.

I hv installed libOpenCL.so file from my phone to the android ndk

But when i run the app i am gettting exception "unfortunately <VectorAdd> has stopped"

I hv attached the logcat output.
Plse help

  • Up0
  • Down0
Ayo Moderator
Profile picture
Join Date: 23 Jan 15
Posts: 31
Posted: Mon, 2015-03-02 14:01

Hello.

Where did you push the libOpenCL.so? Can you provide the full path please. For example: $ANDROID_NDK/platforms/android-?

Thanks.

 

  • Up0
  • Down0
aravindg
Join Date: 7 Feb 15
Posts: 10
Posted: Sun, 2015-03-08 00:33

Thks for reply

Path is $android_ndk/platforms/android-17/arch-arm/usr/lib

One more thing: i am having the native (vectoradd.cpp) file.

But in the activity file ( .java) I have just loaded the library using <System.loadLibrary("   " )>

So will the cpp code execute ? or should i make some other changes to activity file?

Thanks

Aravind

  • Up0
  • Down0
Ayo Moderator
Profile picture
Join Date: 23 Jan 15
Posts: 31
Posted: Thu, 2015-03-12 14:53

Hello Aravind

Could you clarify what you mean by:

"i am having the native (vectoradd.cpp) file.

But in the activity file ( .java) I have just loaded the library using <System.loadLibrary("   " )>" ?

Are you manually modifying the sample app before building it?

How are you building the sample? Please provide detailed steps.

To answer the question: The activity should be loaded by $AdrenoSDK/Development/Samples/OpenCL/Common/src/com/qualcomm/common/AdrenoLauncherActivity.java and should be run by $AdrenoSDK/Development/Samples/OpenCL/Common/src/com/qualcomm/common/AdrenoNativeActivity.java

Lines 19 - 26 of "AdrenoLauncherActivity.java" explain how the meta data from the AndroidManifest.xml for the sample is used to load the activity. See "runNativeActivity" in "onGPUButtonClick" and in "onCPUButtonClick" for where the activity (and hence the cpp code) is executed

Can you check and verify that these above ".java" files exist on your system?

Alternatively, try the following steps:

1. Remove any local changes you might have made to the sample, or unzip the sample from the original zip file to restore it

2. cd $AdrenoSDK/Development/Samples/OpenCL/Build/Android

3. build.sh -t VectorAdd   // Note: this should build the sample and the "Common" folder, which is necessary and which is missing from your log:

java.lang.ClassNotFoundException: Didn't find class "com.qualcomm.common.AdrenoLauncherActivity"

4. install.sh -t VectorAdd // Note this should install the sample on your Moto G phone

NOTE: If the above commands don't work for you, you might need the following first:

export ANDROID_SDK=<path to your Android SDK>

export ANDROID_NDK=<path to your Android NDK>

export APACHE_ANT=<path to your Apache Ant>

Thanks.

  • Up0
  • Down0
aravindg
Join Date: 7 Feb 15
Posts: 10
Posted: Thu, 2015-03-12 23:06
  • Hello Ayo

Thanks for your post.

clarification: I taught that the sdk provided only the nativ (c++) samples and that I will have to write the Android activity for it. But now ,thanks to you explanation I have understood.

Now I have extracted the .zip file again and deleted the older one. I am having both the java files at the intended location.

I ran the ./build.sh command but it is producing lot of errors.

I did not set path for sdk,ndk,apache-ant manually but I got Android Development pack that did the job for me.

I have attached the log can you please help. ( I am not able to attach here so I have edited the original log given with question.

Thanks

Aravind

  • Up0
  • Down0
Ayo Moderator
Profile picture
Join Date: 23 Jan 15
Posts: 31
Posted: Fri, 2015-03-13 09:43

Hello Aravind.

It is not finding libOpenCL.so, because the sample is using "platform-19", and you mentioned that you have copied it into "platform-17" in the past.

Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 8 in /home/ara/Downloads/adrenosdk-linux/Development/Samples/OpenCL/VectorAdd/Android/AndroidManifest.xml    
Android NDK: WARNING:/home/ara/Downloads/adrenosdk-linux/Development/Samples/OpenCL/VectorAdd/Android/jni/Android.mk:VectorAdd: non-system libraries in linker flags: -lOpenCL    
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES    
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the    
Android NDK:     current module    
[armeabi-v7a] Clean          : VectorAdd [armeabi-v7a]
[armeabi-v7a] Clean          : android_native_app_glue [armeabi-v7a]
[armeabi-v7a] Clean          : gnustl_shared [armeabi-v7a]
[armeabi-v7a] Clean          : gnustl_static [armeabi-v7a]
Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 8 in /home/ara/Downloads/adrenosdk-linux/Development/Samples/OpenCL/VectorAdd/Android/AndroidManifest.xml    
Android NDK: WARNING:/home/ara/Downloads/adrenosdk-linux/Development/Samples/OpenCL/VectorAdd/Android/jni/Android.mk:VectorAdd: non-system libraries in linker flags: -lOpenCL

So copy the libOpenCL.so you have from your $android_ndk/platforms/android-17/arch-arm/usr/lib to $android_ndk/platforms/android-19/arch-arm/usr/lib and try the build command again.

Let us know if that helps.

 

  • Up0
  • Down0
Ayo Moderator
Profile picture
Join Date: 23 Jan 15
Posts: 31
Posted: Fri, 2015-03-13 10:17

One more thing;

============================================================
Rebuilding Common
============================================================
~/Downloads/adrenosdk-linux/Development/Samples/OpenCL/Common ~/Downloads/adrenosdk-linux/Development/Samples/OpenCL/Build/Android
Error: Failed to write project.properties file in '.'
Error: java.io.FileNotFoundException: ./project.properties (Permission denied)
Buildfile: build.xml does not exist!
Build failed
Buildfile: build.xml does not exist!
Build failed

To fix the above second problem (other than the libOpenCL.so linker errors):

1. Run Eclipse.

2. From the "File" menu in Eclipse, select "New" and in the "New" submenu select "Project..."

3. In the "New Project" window that appears, select "Android" then "Android Project From Existing Code" and click "Next"

4. In the "Import Projects" window that appears, click "Browse..." next to "Root Directory:". Browse to "~/Downloads/adrenosdk-linux/Development/Samples/OpenCL/VectorAdd.

5. The "Project to Import" should show "Android" and the "New Project Name" should show something else like "NativeActivity". Click Finish.

6. Try the build again. "Common" should have a successful build.

  • Up0
  • Down0
aravindg
Join Date: 7 Feb 15
Posts: 10
Posted: Mon, 2015-03-16 01:04

Thanks Ayo

Well I have copied the libOpenCL.so file to android-19. But the warning was still present. So i changed the Androidmanifest.xml file to <uses-sdk android:minSdkVersion="19" ( earlier it was <uses-sdk android:minSdkVersion="8" )

I built it again but failed. I have attached the new log (log3.txt with original post)

Plse suggest any solution

Thanks

  • Up0
  • Down0
aravindg
Join Date: 7 Feb 15
Posts: 10
Posted: Mon, 2015-03-16 01:12

Thanks Ayo

I tried building in eclipse.

I imported the project and changed the AndroidManifest.xml min sdk version to 19 as earlier.

Then I selected project->build

[2015-03-16 13:16:35 - AdrenoLauncherActivity] Dx
trouble writing output: already prepared

 

Then project->run

[2015-03-16 13:16:57 - AdrenoLauncherActivity] ------------------------------
[2015-03-16 13:16:57 - AdrenoLauncherActivity] Android Launch!
[2015-03-16 13:16:57 - AdrenoLauncherActivity] adb is running normally.
[2015-03-16 13:16:57 - AdrenoLauncherActivity] Performing com.qualcomm.common.AdrenoLauncherActivity activity launch
[2015-03-16 13:16:58 - AdrenoLauncherActivity] Automatic Target Mode: using device 'ZX1D638W6X'
[2015-03-16 13:16:58 - AdrenoLauncherActivity] Uploading AdrenoLauncherActivity.apk onto device 'ZX1D638W6X'
[2015-03-16 13:16:58 - AdrenoLauncherActivity] Installing AdrenoLauncherActivity.apk...
[2015-03-16 13:17:01 - AdrenoLauncherActivity] Success!
[2015-03-16 13:17:01 - AdrenoLauncherActivity] Starting activity com.qualcomm.common.AdrenoLauncherActivity on device ZX1D638W6X
[2015-03-16 13:17:02 - AdrenoLauncherActivity] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.qualcomm.VectorAdd/com.qualcomm.common.AdrenoLauncherActivity }

 

But in the device the app stops by throwing exception "unfortunately VectorAdd has stopped working"

Plse help

Thanks

Aravind

  • Up0
  • Down0
aravindg
Join Date: 7 Feb 15
Posts: 10
Posted: Mon, 2015-03-16 03:16

Thanks a lot Ayo

There was problem in setting the minimum sdk. I just changed the sdk version to 17 in all the required files and it ran successfully.

But for image application ( ImageSobelFilter)  I am able to build and install the app.

But when i run it gives the exception "ERROR:could not image file /Samples/Textures/SampleImageUncompressed.tga"

Can u plse help this out.

Thanks

  • Up0
  • Down0
aravindg
Join Date: 7 Feb 15
Posts: 10
Posted: Mon, 2015-03-16 11:27

Also can u plse tell me where to look for the output.

For example, the result of Matrix addition program is stored in /data/data/com/qualcomm/files But i am not able to locate it.

Thanks

  • Up0
  • Down0
Ayo Moderator
Profile picture
Join Date: 23 Jan 15
Posts: 31
Posted: Mon, 2015-03-16 16:43

Try this:

cd $ADRENO_SDK/Development/Samples/OpenCL/ImageSobelFilter/Android

InstallAssets.sh // This should copy the missing texture to $ADRENO_SDK/Development/Samples/OpenCL/ImageSobelFilter/Android/assets/Samples/Textures.

Verify that the texture is there, then build the sample again and re-install it.

The output for "ImageSobelFilter" will be found in /data/data/com.qualcomm.ImageSobelFilter/files. The matrix addition sample (MatrixMatrixAdd) generates no "output" files, so its "files" folder will be empty.

Let us know if that helps.

  • Up0
  • Down0
aravindg
Join Date: 7 Feb 15
Posts: 10
Posted: Mon, 2015-03-16 21:54

Thks.

I have installed ImageSobel and could run it.

But i cant locate the output file. I could not locate the specified path "/data/data/com.qualcomm.ImageSobelFilter/files.

Any clues?

  • Up0
  • Down0
Re: run OpenCL samples Best Answer
Ayo Moderator
Profile picture
Join Date: 23 Jan 15
Posts: 31
Posted: Tue, 2015-03-17 10:22

Yes. You need a rooted device to be able to access that path.

If your device is already rooted, try "adb root".

You can get a rooted device here: https://developer.qualcomm.com/mobile-development/development-devices/mo...

 

 

  • Up0
  • Down0
aravindg
Join Date: 7 Feb 15
Posts: 10
Posted: Wed, 2015-03-25 06:02

Thanks Ayo

Is there an alternative to temporarily run the app before ordering it. I just want to test the samples before i start my own app.Thanks

  • Up0
  • Down0
Ayo Moderator
Profile picture
Join Date: 23 Jan 15
Posts: 31
Posted: Wed, 2015-03-25 16:28

Some people have expressed good results using "run-as" command in Android.

Maybe this might work for you, if you can't find a rooted device. You can search with your browser "run-as" and "Android". Or maybe search for "read Android data folder without root".

Unfortunately I cannot recommend anything you find, and you must use any results you find at your own risk.

Regards,

Ayo.

  • Up0
  • Down0
aravindg
Join Date: 7 Feb 15
Posts: 10
Posted: Fri, 2015-03-27 23:41

Thanks a lot Ayo

 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.