Results 1 to 4 of 4

Thread: atom_add with float

  1. #1
    Junior Member
    Join Date
    Apr 2010

    atom_add with float

    According to the OpenCl spec there should be a function:
    T atom_add (Q T *p, T val)

    The following line works properly
    __local int z=1;
    int w = 5;
    atom_add(&z, w);

    But switching from int to float
    __local float z=1;
    float w = 5;
    atom_add(&z, w);

    results in the following error
    <program source>:45:2:{45:2-45:10}: error: no matching overload found for arguments of type 'float __attribute__((address_space(3)))*, float'
    atom_add(&z, w);
    /System/Library/Frameworks/OpenCL.framework/Resources/cl_kernel.h:2531:23: note: instantiated from:
    #define atom_add(X,Y) __CLFN_A2(X, Y, add)
    /System/Library/Frameworks/OpenCL.framework/Resources/cl_kernel.h:2525:26: note: instantiated from:
    #define __CLFN_A2(x,y,R) __builtin_overload(2, x, y, \

    Any ideas? I'm running a new MacbookPro i5 with OS X 10.6.

  2. #2

    Re: atom_add with float

    According to the specification there is a function
    Code :
    int atom_add (__local int *p, int val)

  3. #3
    Senior Member
    Join Date
    Sep 2002
    Santa Clara

    Re: atom_add with float

    atomic operations are only supported on integer data (not floating-point data). This is why you are getting the compile error.

  4. #4
    Junior Member
    Join Date
    Apr 2010

    Re: atom_add with float

    I see that now. I assumed T was any native type (float/int/long/char..). Thanks for clearing this up!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean