1 2 Previous Next 15 Replies Latest reply: May 3, 2012 9:55 AM by etresoft
studUS Level 1 Level 1 (0 points)

I have Snow Leopard (10.6.8) and running Xcode 3.2.6 with (I hope!) version 1.1 for OpenCL. I am running a program that requires the function clEnqueueReadBufferRect() which I can see it's present in the cl.h header in my /System/Library/Frameworks/OpenCL.framework/ location. I do not understand why clEnqueueReadBuffer() is found by the compiler and clEnqueueReadBufferRect() is not, since they both belong to cl.h and I'm compiling with the "-framework OpenCL" flag. please help! any partial hint/trick is welcome

  • 1. Re: OpenCL library/function missing
    etresoft Level 7 Level 7 (24,270 points)

    Could you post the code?

  • 2. Re: OpenCL library/function missing
    xnav Level 5 Level 5 (6,630 points)

    Try searching for 'clEnqueueReadBuffer' with Spotlight/Finder to see if you could be including it from a different header that doesn't have clEnqueueReadBufferRect.

  • 3. Re: OpenCL library/function missing
    studUS Level 1 Level 1 (0 points)

    ah! I should have done that the first time. lesson learned

     

    #include <OpenCL/opencl.h>

     

    int main(int argc, char** argv) {

     

        int height, width, size;

        float* input;

        cl_platform_id platform;

        cl_device_id device;

        cl_context context;

        cl_command_queue queue;

        cl_mem memBuffer;

        size_t buff[0];

       

        // this one fails

        clEnqueueWriteBufferRect(queue, memBuffer, CL_TRUE, buff, buff, buff,

                width*sizeof(float), 0, width*sizeof(float), 0, input, 0, NULL, NULL);

        // this one works

        //clEnqueueWriteBuffer(queue, memBuffer, CL_TRUE, 0, size, input, 0, NULL, NULL);

       

        return 0;

    }

     

    I compile using this line:

     

    g++ demo.cpp -framework OpenCL

     

    and the error I get is:

     

    Undefined symbols:

      "_clEnqueueWriteBufferRect", referenced from:

          _main in ccpln4aL.o

    ld: symbol(s) not found

    collect2: ld returned 1 exit status

     

    but if I comment that function and instead use clEnqueueWriteBuffer() there is no error whatsoever!

     

    why would that be?

  • 4. Re: OpenCL library/function missing
    xnav Level 5 Level 5 (6,630 points)

    You can ignore my previous post, you have a linker error, not  a compile error.

  • 5. Re: OpenCL library/function missing
    studUS Level 1 Level 1 (0 points)

    ok, thanks, but how do I solve that? I need to use clEnqueueReadBufferRect and I cannot.

  • 6. Re: OpenCL library/function missing
    etresoft Level 7 Level 7 (24,270 points)

    studUS wrote:

     

    ok, thanks, but how do I solve that? I need to use clEnqueueReadBufferRect and I cannot.

    That function is not present in the Snow Leopard version of OpenCL. You have to use the Lion version and Xcode4.

  • 7. Re: OpenCL library/function missing
    studUS Level 1 Level 1 (0 points)

    how do I go about that? I thought it's not possible to install Xcode4 on Snow.

  • 8. Re: OpenCL library/function missing
    studUS Level 1 Level 1 (0 points)

    or is there a way to update my OpenCL libraries? I'm not using Xcode anyway.

  • 9. Re: OpenCL library/function missing
    etresoft Level 7 Level 7 (24,270 points)

    studUS wrote:

     

    I'm not using Xcode anyway.

    Could have fooled me. I have no idea what kind of custom setup you have. Consequently, there isn't much I can do to tell you how to fix it.

  • 10. Re: OpenCL library/function missing
    studUS Level 1 Level 1 (0 points)

    fooled you? that was not in my intention. and I am not using any custom setup. Xcode is installed with all the developer kit, it's just I'm not using it. I rather like using g++ from a command line.

     

    Isn't any way I could import the OpenCL 1.1 libraries (found the headers, but not the libraries) from Lion or some other place on the web and just use those instead?

  • 11. Re: OpenCL library/function missing
    etresoft Level 7 Level 7 (24,270 points)

    studUS wrote:

     

    fooled you? that was not in my intention. and I am not using any custom setup. Xcode is installed with all the developer kit, it's just I'm not using it. I rather like using g++ from a command line.

     

    That might be OK, might not.

     

    Isn't any way I could import the OpenCL 1.1 libraries (found the headers, but not the libraries) from Lion or some other place on the web and just use those instead?

     

    How did you even know that new function was there? On my Snow Leopard machine it doesn't even exist. This is a system library on Lion. If you are targeting Lion, you need to use Lion and Xcode4 to build. Plus you can use clang instead of g++. If there aren't any other Lion dependencies in OpenCL, you might be able to copy it to Snow Leopard. You could never distribute it.

     

    It just seems you are getting further and further out on the branch and are actively sawing.

  • 12. Re: OpenCL library/function missing
    studUS Level 1 Level 1 (0 points)

    How did you even know that new function was there? On my Snow Leopard machine it doesn't even exist. This is a system library on Lion. If you are targeting Lion, you need to use Lion and Xcode4 to build.

     

    I knew because there are several locations where cl.h can be found in Spotlight. one location was Nvidia's GPU computing SDK. while looking inside that one I noticed this function and I hate I cannot use it because it optimizes the previous function from 1.0 which is slower in execution. I just installed Xcode 4.2 but that didn't update the libraries in /System/Library/Frameworks/OpenCL.framework/Libraries so I'm kind of at a loss here

  • 13. Re: OpenCL library/function missing
    etresoft Level 7 Level 7 (24,270 points)

    Xcode isn't going to update your system libraries. Poke around in the platforms and sdk directories inside Xcode. You may be able to find a newer version of the framework. You will still have issues trying to get it running on Snow Leopard.

  • 14. Re: OpenCL library/function missing
    studUS Level 1 Level 1 (0 points)

    when I installed Xcode 4.2 it touched the frameworks location because it's date and time are changed to today, but no headers/libraries were touched whatsoever. well, unless someone can zip the OpenCL.framework in Lion and ship it to me, I'm gonna drop this path with much regret

1 2 Previous Next