This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Two issues with Compute Library 17.12, scons and manual native compilation, on Odroid XU4.

First issue is with scons. A Previous post was concerned with creating my own source and build subdirectories (MyProgs/ and build/MyProgs) and modification of SConstruct to succesfully compile cl_convolution and neon_convolution as a first step for compiling my own attempts. I can succesfully compile all the example programs and the graph_alexnet example in my MyProgs source folder with the following command line:

scons Werror=1 debug=1 -j6 debug=1 asserts=0 embed_kernels=1 neon=1 opencl=1 os=linux arch=armv7a

However, if I add my own program to the source folder, scons doesn't seem to see it or try to compile it. I copied my program to the examples directory and reverted to the original SConstruct in case the *.cpp file names were being referenced from there by scons! Still not seen by scons. I have searched around and can't seem to find any lists of the examples source files so I assume scons must be creating it's own list! So how do I ensure my file is picked up by scons and not filtered out?

Second issue comes about because I started using the manual build compile incantation due to the scons issue above. I originally had problems with making this work but recently succeeded in compiling neon_convolution.cpp using the following command line, (changing -L. to -L./openclLib to find the missing -larm_compute etc):

arm-linux-gnueabihf-g++ MyProgs/neon_convolution.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -mfpu=neon -L./openclLib -larm_compute -larm_compute_core -o build/MyProgs/neon_convolution

However when I try to compile my own Opencl program or the cl_convolution example, after the gcc compile is succesfully finished, I end up with ld (Linker??) issues, similar in both cases which makes me think there is something missing from the command line incantation. Comparing the command line with the scons command line, I think, due to unfamiliarity with command line stuff, I'm probably missing a reference to the gpu or openCL (mfpu=neon is there and can't find any relevant examples in the documentation examples!)? Note that the command lines given in the documentation only differ in that "-DARM_COMPUTE_CL" is added to the opencl command line, compilation bombs without it!!

Command line is:

arm-linux-gnueabihf-g++ MyProgs/cl_convolution.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -mfpu=neon -L./openclLib -larm_compute -larm_compute_core -o build/MyProgs/cl_convolution -DARM_COMPUTE_CL

This gives the following output, in the case of cl_convolution compilation: (subsequent scons compile works ok for this file)

/tmp/cc99vqAy.o: In function `cl::Context::Context(unsigned long long, int*, void (*)(char const*, void const*, unsigned int, void*), void*, int*)':
cl_convolution.cpp:(.text._ZN2cl7ContextC2EyPiPFvPKcPKvjPvES6_S1_[_ZN2cl7ContextC5EyPiPFvPKcPKvjPvES6_S1_]+0x1b0): undefined reference to `clCreateContextFromType'
/tmp/cc99vqAy.o: In function `cl::CommandQueue::CommandQueue(cl::Context const&, cl::Device const&, unsigned long long, int*)':
cl_convolution.cpp:(.text._ZN2cl12CommandQueueC2ERKNS_7ContextERKNS_6DeviceEyPi[_ZN2cl12CommandQueueC5ERKNS_7ContextERKNS_6DeviceEyPi]+0x48): undefined reference to `clCreateCommandQueue'
/tmp/cc99vqAy.o: In function `int cl::Context::getInfo<std::vector<cl::Device, std::allocator<cl::Device> > >(unsigned int, std::vector<cl::Device, std::allocator<cl::Device> >*) const':
cl_convolution.cpp:(.text._ZNK2cl7Context7getInfoISt6vectorINS_6DeviceESaIS3_EEEEijPT_[_ZNK2cl7Context7getInfoISt6vectorINS_6DeviceESaIS3_EEEEijPT_]+0x12): undefined reference to `clGetContextInfo'
cl_convolution.cpp:(.text._ZNK2cl7Context7getInfoISt6vectorINS_6DeviceESaIS3_EEEEijPT_[_ZNK2cl7Context7getInfoISt6vectorINS_6DeviceESaIS3_EEEEijPT_]+0x16): undefined reference to `clGetContextInfo'
collect2: error: ld returned 1 exit status

I've had a search for similar issues on the community page but no success. Any help will be appreciated

Parents
  • OK after two full days of experimenting and searching for answers for this issue, then thinking about how do I pose these questions so they are understandable by viewers! Write the post and submit! do a bit more exploration and guess what?

    I've answered the first part/issue myself. While awaiting a reply to my questions, I was once more scrutinising the SConscript file in the source file directory I came across the filters causing the issue around lines 50 - 100+. Your program names must begin with neon_, cl_, neoncl_ (in my case), graph_, gles_, or whatever else and end in .cpp.

    There are a number of python filters for each case in the form of:-

    if env['opencl']:

            for file in Glob("./cl_*.cpp"):

                 ...........blah,blah

    My new program I was writing now compiles under scons after prepending the name with neoncl_! So now I can move on to debug and further development. The simple answer is to stick to prepending filenames to match the filters or write your own SConscript file to suit your application. :-)

    In any case I still have the second manual compile issue to be answered, which would be handy for compiling individual programs instead of waiting while scons is checking all files in the directory are up to date.

Reply
  • OK after two full days of experimenting and searching for answers for this issue, then thinking about how do I pose these questions so they are understandable by viewers! Write the post and submit! do a bit more exploration and guess what?

    I've answered the first part/issue myself. While awaiting a reply to my questions, I was once more scrutinising the SConscript file in the source file directory I came across the filters causing the issue around lines 50 - 100+. Your program names must begin with neon_, cl_, neoncl_ (in my case), graph_, gles_, or whatever else and end in .cpp.

    There are a number of python filters for each case in the form of:-

    if env['opencl']:

            for file in Glob("./cl_*.cpp"):

                 ...........blah,blah

    My new program I was writing now compiles under scons after prepending the name with neoncl_! So now I can move on to debug and further development. The simple answer is to stick to prepending filenames to match the filters or write your own SConscript file to suit your application. :-)

    In any case I still have the second manual compile issue to be answered, which would be handy for compiling individual programs instead of waiting while scons is checking all files in the directory are up to date.

Children