Forums - Android example fails to load model

9 posts / 0 new
Last post
Android example fails to load model
simonr_rob
Join Date: 9 Aug 12
Posts: 7
Posted: Tue, 2017-07-25 04:00

I have followed the getting started instructions (https://developer.qualcomm.com/software/snapdragon-neural-processing-eng...) and I have sucessfuly built the Android app with Android Studio. However the app fails to load the model, examing the adb log the following is displayed:

07-25 11:21:48.529 15012-15012/com.qualcomm.qti.snpe.imageclassifiers E/linker: library "/vendor/lib/libOpenCL.so" ("/system/vendor/lib/libOpenCL.so") needed or dlopened by "/data/app/com.qualcomm.qti.snpe.imageclassifiers-1/lib/arm/libSNPE.so" is not accessible for the namespace: [name="classloader-namespace", ld_library_paths="", default_library_paths="/data/app/com.qualcomm.qti.snpe.imageclassifiers-1/lib/arm:/data/app/com.qualcomm.qti.snpe.imageclassifiers-1/base.apk!/lib/armeabi-v7a:/data/app/com.qualcomm.qti.snpe.imageclassifiers-1/split_lib_dependencies_apk.apk!/lib/armeabi-v7a:/data/app/com.qualcomm.qti.snpe.imageclassifiers-1/split_lib_slice_0_apk.apk!/lib/armeabi-v7a:/data/app/com.qualcomm.qti.snpe.imageclassifiers-1/split_lib_slice_1_apk.apk!/lib/armeabi-v7a:/data/app/com.qualcomm.qti.snpe.imageclassifiers-1/split_lib_slice_2_apk.apk!/lib/armeabi-v7a:/data/app/com.qualcomm.qti.snpe.imageclassifiers-1/split_lib_slice_3_apk.apk!/lib/armeabi-v7a:/data/app/com.qualcomm.qti.snpe.imageclassifiers-1/split_lib_slice_4_apk.apk!/lib/armeabi-v7a:/data/app/com.qualcomm.qti.snpe.imageclas
07-25 11:21:48.600 15012-15032/com.qualcomm.qti.snpe.imageclassifiers E/LoadNetworkTask: Unable to create network! Cause: error_code=809; error_message=OpenCL function has returned error. OpenCL Error (-59) CL_INVALID_OPERATION; error_component=GPU Runtime; line_no=121; thread_id=-847292128; opencl_error=-59
Java.lang.IllegalStateException: Unable to create network! Cause: error_code=809; error_message=OpenCL function has returned error. OpenCL Error (-59) CL_INVALID_OPERATION; error_component=GPU Runtime; line_no=121; thread_id=-847292128; opencl_error=-59

I am using an Inforce 6640 Single Board Computer running Android Nougat 7.1.1, I have also checked that LibOpenCL.so exists in /system/vendor/lib and it is present.

I am not sure how to proceed,  a google search comes up with https://developer.android.com/about/versions/nougat/android-7.0-changes.... NDK Apps Linking to Platform Libraries which is preventing it linking do a non NDK library. I have tried changing the target API to 23, but still get the same error.

Thanks,

Simon
 

  • Up0
  • Down0
simonr_rob
Join Date: 9 Aug 12
Posts: 7
Posted: Tue, 2017-07-25 04:09

I have also checked the Inforce source build and  libOpenCL.so is included in the public.libraries.txt (./vendor/qcom/proprietary/prebuilt/target/product/msm8996/system/vendor/etc/public.libraries.txt):

libOpenCL.so
libqti_performance.so
libqti-perfd-client.so
lib-ims-rcscmjni.so
lib-imsrcscm.so
lib-imsrcscmclient.so
lib-imsrcscmservice.so
libadsprpc.so
libsdsprpc.so
 

Thanks,

Simon

  • Up0
  • Down0
simonr_rob
Join Date: 9 Aug 12
Posts: 7
Posted: Tue, 2017-07-25 04:31

Seems to be a Inforce build problem as /libOpenCL.so is not be populated into /system/etc/public.libraries.txt, I have edited the file and in now loads the model.

I hope this helps anybody else with similar problems.

Simon

  • Up0
  • Down0
moljaca moderator
Join Date: 25 Jul 17
Location: San Diego
Posts: 40
Posted: Tue, 2017-07-25 12:05

Simon,

glad that you solved it. Thanks for posting the solution!

 Milan

  • Up0
  • Down0
shiangyong
Join Date: 21 Sep 17
Posts: 15
Posted: Mon, 2017-10-02 16:19

Hi Simon,

I'm also developing on Inforce 6640 Single Board Computer running Android Nougat 7.1.1 and it looks like I do not have permission to modify public.libraries.txt.

How did you change the permission on that file (or the whole directory)?

Thanks!

  • Up0
  • Down0
shiangyong
Join Date: 21 Sep 17
Posts: 15
Posted: Fri, 2017-10-20 13:43

I was able to push the edited public.lilbraries.txt by doing a remount on /system first. However I still see the same error.

From logcat

snpe.imageclassifiers E/linker: library "/vendor/lib/libOpenCL.so" ("/system/vendor/lib/libOpenCL.so") needed or dlopened by "/data/app/com.qualcomm.qti.snpe.imageclassifiers-1/lib/arm/libSNPE.so" is not accessible for the namespace: [name="classloader-namespace", ld_library_paths="", default_library_paths="/data/app/com.qualcomm.qti.snpe.imageclassifiers-1/lib/arm:/data/app/com.qualcomm.qti.snpe.imageclassifiers-1/base.apk!/lib/armeabi-v7a:/data/app/com.qualcomm.qti.snpe.imageclassifiers-1/split_lib_dependencies_apk.apk!/lib/armeabi-v7a:/data/app/com.qualcomm.qti.snpe.imageclassifiers-1/split_lib_slice_0_apk.apk!/lib/armeabi-v7a:/data/app/com.qualcomm.qti.snpe.imageclassifiers-1/split_lib_slice_1_apk.apk!/lib/armeabi-v7a:/data/app/com.qualcomm.qti.snpe.imageclassifiers-1/split_lib_slice_2_apk.apk!/lib/armeabi-v7a:/data/app/com.qualcomm.qti.snpe.imageclassifiers-1/split_lib_slice_3_apk.apk!/lib/armeabi-v7a:/data/app/com.qualcomm.qti.snpe.imageclassifiers-1/split_lib_slice_4_apk.apk!/lib/armeabi-v7a:/data/app/com.qualcomm.qti.snpe.imageclas
 
Any ideas on what else could be causing the issue? I'm running the Android tutorial here https://developer.qualcomm.com/software/snapdragon-neural-processing-eng...
 
 
  • Up0
  • Down0
simonr_rob
Join Date: 9 Aug 12
Posts: 7
Posted: Sat, 2017-10-21 06:37

Hi shiangyong,

Here's what my public.libraries.txt  contains:

cat /system/etc/public.libraries.txt 

libandroid.so
libadsprpc.so
libc.so
libcamera2ndk.so
libdl.so
libEGL.so
libGLESv1_CM.so
libGLESv2.so
libGLESv3.so
libicui18n.so
libicuuc.so
libjnigraphics.so
liblog.so
libmediandk.so
libm.so
libOpenCL.so
libOpenMAXAL.so
libOpenSLES.so
libqti_performance.so
libRS.so
libstdc++.so
libvulkan.so
libwebviewchromium_plat_support.so
libz.so
 
Cheers,
 
Simon
  • Up0
  • Down0
shiangyong
Join Date: 21 Sep 17
Posts: 15
Posted: Mon, 2017-10-23 13:14

Thank you Simon, I am now able to use the GPU within the Android app. For the benefit of other readers, I also learned that it is necessary to reboot the device after updating public.libraries.txt

  • Up0
  • Down0
ajay.joshy0
Join Date: 23 Jul 17
Posts: 1
Posted: Wed, 2018-11-21 23:40

Thanks a lot Simon
faced the same problem 
adding libOpenCL.so  to    /system/etc/public.libraries.txt resolved it

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