Thanks.
I have added linker flags to CMakelists.txt then solved the problem that linker cannot found libdl.so.2 and so on.
computecpp-sdk/samples/CMakelists.txt
SET(CMAKE_EXE_LINKER_FLAGS
“${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,/usr/aarch64-linux-gnu/lib”)
But new errors appears. libComputeCpp.so seems to be not able to find OpenCL API symbols although pocl has their symbols, (I confirmed libOpenCL.so has them with"nm" commmand ).
/home/k-ojima/ComputeCpp-CE-1.3.0-Ubuntu-16.04-ARM_64/lib/libComputeCpp.so: undefined reference to clReleaseSampler@OPENCL_1.0' /home/k-ojima/ComputeCpp-CE-1.3.0-Ubuntu-16.04-ARM_64/lib/libComputeCpp.so: undefined reference to
clEnqueueWriteImage@OPENCL_1.0’
/home/k-ojima/ComputeCpp-CE-1.3.0-Ubuntu-16.04-ARM_64/lib/libComputeCpp.so: undefined reference to clReleaseMemObject@OPENCL_1.0' /home/k-ojima/ComputeCpp-CE-1.3.0-Ubuntu-16.04-ARM_64/lib/libComputeCpp.so: undefined reference to
clRetainEvent@OPENCL_1.0’
(snip)
There should be no need to change the rpath of the executable, CMake should take care of this for you. Could you try to just the following?
cmake -DComputeCpp_DIR=…/ComputeCpp-CE-1.3.0-Ubuntu-16.04-ARM_64 -DComputeCpp_HOST_DIR=…/ComputeCpp-CE-1.3.0-Ubuntu-16.04-x86_64 -DOpenCL_LIBRARY=/opt/pocl/libOpenCL.so -DOpenCL_INCLUDE_DIR=/usr/include -DCMAKE_TOOLCHAIN_FILE=./cmake/toolchains/gcc-generic.cmake -DCOMPUTECPP_BITCODE=spir64
This is where your pocl library is located. If this doesn’t work could you paste the output of the following command here?
nm /opt/pocl/libOpenCL.so | grep OPENCL_1.0
Thanks.
Unfortunately, in my environment, I followed cmake command but cmake failed, so in addition I edited cmake files to specify cross-compiler options.
And I do the nm command you said, then there are no output. I understood ComputeCpp expects OpenCL APIs with the OPENCL_1.0 but pocl lib does not have it. Can I make the ComputeCpp ignore the OPENCL_1.0?
Which CMake command failed, exactly?
I’ve not used pocl on ARM myself but I have both compiled ComputeCpp applications for ARM and used pocl a few times and not run into trouble. If I were attempting to do the same thing you were doing, I would take the following steps. While they are something of a restatement of what has been discussed before, I don’t expect any individual step to fail, and following them might help us pinpoint the error:
- Download OpenCL Headers from GitHub
- Download OpenCL ICD Loader, again from GitHub
- Build this for ARM platform using same headers
- Build and link my ComputeCpp application using the same toolchain and the OpenCL ICD loader from the previous step (here you would specify
-DOpenCL_INCLUDE_DIR
and -DOpenCL_LIBRARY
as pointing to the downloaded headers and just-built OpenCL ICD Loader library
- Now you can deploy to the device, pocl has ICD loader support as described on this page so you should be able to add the entry to
/etc/OpenCL/vendors
and from there it should just work. Alternatively you could preload the pocl
library, that would work too.
I did notice in one of your replies that OpenCL_INCLUDE_DIR was set as /usr/include
- I would really strongly recommend against that. And to be clear, I would not use pocl
in the build steps for the SYCL code, and would rather stick to the plain ICD loader library.
If you tell us which of these stages has an error and what that is, maybe we can pinpoint what’s going wrong - as I said before, I don’t expect any of these stages to fail.
All that being said, if you do something like this then it should work. I did it just the other day to get some profiling data from an ARM device.
Sorry for late reply. Thank you.
I followed your procedures and now I am stuck in below.
Now you can deploy to the device, pocl has ICD loader support as described on this page so you should be able to add the entry to /etc/OpenCL/vendors
and from there it should just work. Alternatively you could preload the pocl
library, that would work too.
I try to execute the vptr sample on a target board, then errors appear.
root@s32v234sbc:/home/samples# ./vptr
./vptr: /home/sdk/drivers/libOpenCL.so.1: no version information available (required by /home/sdk/drivers/libComputeCpp.so)
./vptr: /home/sdk/drivers/libOpenCL.so.1: no version information available (required by /home/sdk/drivers/libComputeCpp.so)
./vptr: /home/sdk/drivers/libOpenCL.so.1: no version information available (required by /home/sdk/drivers/libComputeCpp.so)
attempting to add vendor /usr/local/lib/libpocl.so.2.5.0…
successfully added vendor /usr/local/lib/libpocl.so.2.5.0 with suffix POCL
terminate called after throwing an instance of ‘cl::sycl::compile_program_error’
Aborted
root@s32v234sbc:/home/samples#
Do you have any idea for this?
Are you able to run clinfo on the device? If yes it would be useful to see what the OpenCL drivers are reporting in terms of what is supported.
Can you show us the output of clinfo?
Specifically here the error means that the driver (which appears to be pocl, which is promising) wasn’t able to compile the code. The parallel-for
sample has better error handling than the vptr
sample; if you run it you should get full build log. Of course if it runs then it means something in the vptr
sample specifically is causing the problem.
Actually a better thought is that the configuration file will allow you to select verbose output - if I remember correctly, this will cause the build log to be output to standard output directly, regardless of the user code. It’s too noisy to be enabled by default but might help here.
Thank you. Finally I’ve done combination of ComputeCpp and pocl on arm CPU board!
Cause of the latest error is that I did not set a pocl compile option.
if(ENABLE_SPIR)
set(HOST_DEVICE_EXTENSIONS “${HOST_DEVICE_EXTENSIONS} cl_khr_spir”)
endif()
I set ENABLE_SPIR, then computecpp sample works properly.
Thank you for your kind cooperation.
2 Likes
Great news! I’m glad it’s working. Let us know if you run into any other problems