ARM-software / ComputeLibrary

The Compute Library is a set of computer vision and machine learning functions optimised for both Arm CPUs and GPUs using SIMD technologies.
MIT License
2.85k stars 776 forks source link

unable to run examples using issue with usage of arm mali APIs #58

Closed mkamrao closed 7 years ago

mkamrao commented 7 years ago

Hello

I was trying to run an example using openCL for Mali GPU from compute lib as below and encountered errors while running. (Able to compile compute lib with opencl option and the example code) aarch64-oe-linux-g++ examples/cl_convolution.cpp test_helpers/Utils.cpp -I. -Iinclude -std=c++11 -L. -lOpenCL -lmali -larm -o cl_convolution -Wl,-rpath,.

./cl_convolution !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ERROR: clGetPlatformIDs from stub libOpenCL.so library called! This library can be used to resolve OpenCL symbols at compile time but must not be in your runtime path (You need to use a real OpenCL implementation, this one is empty) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! terminate called after throwing an instance of 'cl::Error' what(): empty Aborted

Could you suggest where I can get the compatible libOpenCL.so or corresponding opencl source needed for testing OpenCL on Mali using ARM Compute library. (Note: I am using ARM Juno h/w platform rev0).

Thanks kamrao

AnthonyBarbier commented 7 years ago

Hi, If you have a libmali.so on your platform you can just create a symlink libOpenCL.so You also need to make sure that the stub libOpenCL.so you used to compile the example does not appear in your path before your real library.

mkamrao commented 7 years ago

Hello

The libmali.so (-lmali ) in above command is actually ARM Compute library compiled with OpenCL enabled.

Could you suggest how to get appropriate OpenCL library for testing the ARM Compute library on Mali? Do you expect libOpenCL.so already available on the platform?

Thanks

AnthonyBarbier commented 7 years ago

Instead of linking against mali just link against the stub OpenCL. Then create a symlink between libmali and libOpenCL and make sure the stub is not in your path when you run the example (At the moment the error message you see is because the stub libOpenCL.so library is getting loaded instead of the real libmali.)

fyhtea commented 7 years ago

Hello, I created a symlink between libGLES_mali.so and libOpenCL.so in /system/lib64/, however encountered errors like this:

CANNOT LINK EXECUTABLE "/data/local/tmp/cl_convolution": cannot locate symbol "clGetContextInfo" referenced by "/data/local/tmp/cl_convolution"... Aborted

Could you suggest how to solve this problem?

thanks

AnthonyBarbier commented 7 years ago

Could you please post the command you used to build the example ?

Could you also double check your version of libmali has been compiled with OpenCL: strings libGLES_mali.so | grep clGet

Thanks

fyhtea commented 7 years ago

I compiled compute lib with opencl option and the example was build by:

aarch64-linux-android-g++' examples/cl_convolution.cpp test_helpers/Utils.cpp -I. -Iinclude -std=c++11 -larm_compute-static -L. -o cl_convolution_aarch64 -static-libstdc++ -pie -lOpenCL

After running

string libGLES_mali.so | grep clGet

there is no output.... So my libmali was not compiled with OpenCL? How can i update it?

Thanks

AnthonyBarbier commented 7 years ago

Yes, looks like you don't have OpenCL enabled on your platform:

You probably want to get in touch with Linaro for more details, I've found the latest Android image I also found some information on the ARM Community

fyhtea commented 7 years ago

OK,i will have a look at that.

Thank you very much.

ghost commented 7 years ago

I have enabled opencl on my platform and it can't run

(gdb) run
Starting program: /home/root/ComputeLibrary/cl_convolution
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".

/home/root/ComputeLibrary/cl_convolution

warning: the debug information found in "/usr/lib/libxshmfence.so.1.0.0" does not match "/usr/lib/libxshmfence.so.1" (CRC mismatch).

terminate called after throwing an instance of 'cl::Error'
  what():  empty

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at /usr/src/debug/glibc/2.24-r0/git/sysdeps/unix/sysv/linux/raise.c:58
58      }
(gdb)
GeorgeARM commented 7 years ago

Closing issue. Reopen if this haven't been resolved yet.