On Thu, 13 Aug 2015 14:12:10 +0000
Joe Haywood <[email protected]> wrote:

> A little clarificatio. Here is the function I refer to when I say global add, 
> I should have said global atomic add floats.
> 
> inline void GAtomicAdd(volatile __global float *source, const float operand) {
> union {
> unsigned int intVal;
> float floatVal;
> } newVal;
> 
> union {
> unsigned int intVal;
> float floatVal;
> } prevVal;
> 
> do {
> prevVal.floatVal = *source;
> newVal.floatVal = prevVal.floatVal + operand;
> } while (atomic_cmpxchg((volatile __global unsigned int *)source, 
> prevVal.intVal, newVal.intVal) != prevVal.intVal);
> }
> 
> As used in the code
> GAtomicAdd(&pdose[indz+indx*NZ+indy*NZ*NCOL],urn);
> 

Is it impossible to work on a shared array or redesign the algorithm ?

-- 
Jérôme Kieffer
tel +33 476 882 445

_______________________________________________
PyOpenCL mailing list
[email protected]
http://lists.tiker.net/listinfo/pyopencl

Reply via email to