Results 1 to 4 of 4

Thread: C++ bindings 1.2 incompatible with PGI 12

  1. #1
    Junior Member
    Join Date
    Jun 2011
    Posts
    3

    C++ bindings 1.2 incompatible with PGI 12

    The OpenCL C++ bindings version 1.2 use a GCC builtin (__sync_val_compare_and_swap) that is not provided by the PGI C++ compiler for x86/x86_64 Linux. (Apparently, some other compiler vendors such as Intel do provide it for compatibility.)

    Has anyone found a reasonable workaround? My attempts to provide an implementation of this builtin as a function (inlined or otherwise) causes the templated method that uses the builtin to be outlined, leading to multiply-defined symbol link errors in the code I'm working on.

  2. #2

    Re: C++ bindings 1.2 incompatible with PGI 12

    Would defining __sync_val_compare_and_swap as a macro help at all? I don't work with OpenCL 1.2 as I target both Nvidia and AMD so I have no experience there.

  3. #3
    Junior Member
    Join Date
    Jun 2011
    Posts
    3

    Re: C++ bindings 1.2 incompatible with PGI 12

    I replied a few days ago but apparently didn't hit the right button to submit.

    I tried defining __sync_val_compare_and_swap as a macro and as a C++ inline function. In both cases, the class method in the C++ bindings that uses the __sync_val_compare_and_swap builtin ended up being outlined. Since the code I'm working with includes the C++ bindings header from several source files, this meant link errors due to multiply defined symbols for this outlined function.

    I don't understand why the compiler decided to outline that function - I don't think it should have, but I couldn't figure out a way to keep it from outlining it.

    I may be stuck just modifying all our code to remove use of the C++ bindings. That would be disappointing, since overall I like the way the C++ bindings increase the level of abstraction when programming for OpenCL devices.

  4. #4

    Re: C++ bindings 1.2 incompatible with PGI 12

    Looking at the Khronos website, there is no official cl.hpp for OpenCL 1.2. They are still linking to the 1.1 cl.hpp. Can you get by with OpenCL 1.1?

Similar Threads

  1. OpenCL C++ Bindings
    By oddhack in forum OpenCL
    Replies: 99
    Last Post: 09-20-2011, 10:57 AM
  2. incompatible integer to pointer conversion!!
    By phoebe0105 in forum OpenCL
    Replies: 4
    Last Post: 05-02-2010, 11:40 PM
  3. OpenCL C# bindings
    By The Fiddler in forum OpenCL
    Replies: 1
    Last Post: 08-11-2009, 03:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •