If I have a kernel where each thread writes to a number of different locations in global memory, and some threads will write to the same location as others, what happens? Do the writes get serialised?

Basically, what I want to do is this

```
//index of this thread
int thrIndex = ...calculate index
for (int i=0; i<limit; ++i)
{
int otherindex = ... calculate index
float4 force = //... calculate value of force;
globalArray[thrIndex] += force;
globalArray[otherIndex] -= force;
}
```

where “otherindex” could be the “thrIndex” of another thread.

Is this possible? Or am I going about this the wrong way? Any suggestions appreciated.

Thanks

Nodlams