# help wanted global memory update

**URL:** <https://forums.developer.nvidia.com/t/help-wanted-global-memory-update/17493>\
**Category:** CUDA Programming and Performance\
**Created:** [July 3, 2010, 6:01am UTC](https://forums.developer.nvidia.com/t/help-wanted-global-memory-update/17493 "2010-07-03T06:01:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pcrs](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pcrs](https://forums.developer.nvidia.com/u/pcrs)\
**Post date:** [July 3, 2010, 6:01am UTC](https://forums.developer.nvidia.com/t/help-wanted-global-memory-update/17493/1 "2010-07-03T06:01:10Z")

</div>

Hi,  
I am building something in which multiple threads update random float values/vectors in global device memory a bit like a histogram problem. It is possible that multiple threads need to update the same value/vector. Since these values add or subtract something, it does not matter in which order the threads update the global memory. It is just important they all do.  
The array with float values/vectors to be updated is too large to store in shared memory.

How to tackle this problem with compute capability 1.1 ?

> AtomicAdd can not be used with float only in CC2.0  
> Building semaphores in shared memory that block a thread when another is updating, can only be done with atomicInc/atomicDec which are only availble for shared memory with CC1.2

Does anyone have an idea how to proceed here?  
thanks

---

<div class="post-metadata">

**Author:** ![LSChien](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@LSChien](https://forums.developer.nvidia.com/u/LSChien)\
**Post date:** [July 3, 2010, 3:14pm UTC](https://forums.developer.nvidia.com/t/help-wanted-global-memory-update/17493/2 "2010-07-03T15:14:19Z")

</div>

> [@](#):
>
> How to tackle this problem with compute capability 1.1 ?
> 
> > AtomicAdd can not be used with float only in CC2.0
> 
> > Building semaphores in shared memory that block a thread when another is updating, can only be done with atomicInc/atomicDec which are only availble for shared memory with CC1.2

You can use integer atomic to do float addition, check the thread

http://forums.nvidia.com/index.php?showtop…7&hl=atomic

it implement atomicAdd on “double”, you can modifiy it for “float”.

---

<div class="post-metadata">

**Author:** ![pcrs](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pcrs](https://forums.developer.nvidia.com/u/pcrs)\
**Post date:** [July 11, 2010, 4:01pm UTC](https://forums.developer.nvidia.com/t/help-wanted-global-memory-update/17493/3 "2010-07-11T16:01:00Z")

</div>

> [@](#):
>
> You can use integer atomic to do float addition, check the thread
> 
> http://forums.nvidia.com/index.php?showtop…7&hl=atomic
> 
> it implement atomicAdd on “double”, you can modifiy it for “float”.

Thanks for the suggestion, I’ll look into it.

---

<div class="post-metadata">

**Author:** ![pcrs](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pcrs](https://forums.developer.nvidia.com/u/pcrs)\
**Post date:** [July 11, 2010, 4:01pm UTC](https://forums.developer.nvidia.com/t/help-wanted-global-memory-update/17493/4 "2010-07-11T16:01:00Z")

</div>

Strange thing is that it does not accept the function atomicAdd(f\*address, float value) with sm\_11 on the grounds that it already exists. If I rename it, it is accepted. Still the documentation says that atomicAdd for floats does not exist in CC 1.1
