Atomic extension

Hello everyone,

I am trying to compute an addition on the same global memory with the help of the atomic function: atomic_add()
I have seen that I have to add “#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics:enable” to my “.cl”
Unfortunately, Visual studio is not very happy with this :doh: and told me:

<kernel>:528:6: error: no matching function for call to 'atom_add'
                                        atomic_add(F[i], absorb);
                                        ^~~~~~~~~~
cl_kernel.h:4113:20: note: expanded from macro 'atomic_add'
#define atomic_add atom_add
                   ^~~~~~~~
cl_kernel.h:4009:22: note: candidate function not viable: no known conversion from '__global float' to 'volatile __global int *__attribute__((address_sp
ace(16776963)))' for 1st argument
int __OVERLOADABLE__ atom_add(__global volatile int *ptr, int val);
                     ^
cl_kernel.h:4010:22: note: candidate function not viable: no known conversion from '__global float' to 'volatile __local int *__attribute__((address_spa
ce(16776963)))' for 1st argument
int __OVERLOADABLE__ atom_add(__local volatile int *ptr, int val);
                     ^
cl_kernel.h:4011:23: note: candidate function not viable: no known conversion from '__global float' to 'volatile __global uint *__attribute__((address_s
pace(16776963)))' (aka 'volatile __global unsigned int *__attribute__((address_space(16776963)))') for 1st argument
uint __OVERLOADABLE__ atom_add(__global volatile uint *ptr, uint val);
                      ^
cl_kernel.h:4012:23: note: candidate function not viable: no known conversion from '__global float' to 'volatile __local uint *__attribute__((address_sp
ace(16776963)))' (aka 'volatile __local unsigned int *__attribute__((address_space(16776963)))') for 1st argument
uint __OVERLOADABLE__ atom_add(__local volatile uint *ptr, uint val);
                      ^
cl_kernel.h:4013:23: note: candidate function not viable: no known conversion from '__global float' to 'volatile __global long *__attribute__((address_s
pace(16776963)))' for 1st argument
long __OVERLOADABLE__ atom_add(__global volatile long *ptr, long val);
                      ^
cl_kernel.h:4014:23: note: candidate function not viable: no known conversion from '__global float' to 'volatile __local long *__attribute__((address_sp
ace(16776963)))' for 1st argument
long __OVERLOADABLE__ atom_add(__local volatile long *ptr, long val);
                      ^
cl_kernel.h:4015:24: note: candidate function not viable: no known conversion from '__global float' to 'volatile __global ulong *__attribute__((address_
space(16776963)))' (aka 'volatile __global unsigned long *__attribute__((address_space(16776963)))') for 1st argument
ulong __OVERLOADABLE__ atom_add(__global volatile ulong *ptr, ulong val);
                       ^
cl_kernel.h:4016:24: note: candidate function not viable: no known conversion from '__global float' to 'volatile __local ulong *__attribute__((address_s
pace(16776963)))' (aka 'volatile __local unsigned long *__attribute__((address_space(16776963)))') for 1st argument
ulong __OVERLOADABLE__ atom_add(__local volatile ulong *ptr, ulong val);

I really do not understand what’s wrong with my code…
My GPU is a NVidia k620.
Can someone help me, please? Thank you in advance :smiley:

atomic_add(&F[i], absorb);

thank you acterhd!

thank you acterhd!