# atomicAdd(\*float, float) undefined

**URL:** <https://forums.developer.nvidia.com/t/atomicadd-float-float-undefined/25919>\
**Category:** CUDA Programming and Performance\
**Created:** [February 28, 2012, 8:39pm UTC](https://forums.developer.nvidia.com/t/atomicadd-float-float-undefined/25919 "2012-02-28T20:39:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nanogeek815](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@nanogeek815](https://forums.developer.nvidia.com/u/nanogeek815)\
**Post date:** [February 28, 2012, 8:39pm UTC](https://forums.developer.nvidia.com/t/atomicadd-float-float-undefined/25919/1 "2012-02-28T20:39:32Z")

</div>

Hello,  
I have been working on this for a few hours with no luck and as such decided to seek out help here.

This is the line of code I am finding issues with:  
atomicAdd(&Ii, grayLevel[threadId]);

The error:  
IntelliSense: identifier “atomicAdd” is undefined

Could this be simply missing a header or am I missing much more?

Both of these values are floats by the way.  
I am using Visual Studio 2010

I am quite new to this and really don’t know how to go about fixing it.  
Any and all help is appreciated.

---

<div class="post-metadata">

**Author:** ![pasoleatis](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pasoleatis](https://forums.developer.nvidia.com/u/pasoleatis)\
**Post date:** [February 28, 2012, 8:47pm UTC](https://forums.developer.nvidia.com/t/atomicadd-float-float-undefined/25919/2 "2012-02-28T20:47:58Z")

</div>

2 min search [c - Some issue with Atomic add in CUDA kernel operation - Stack Overflow](http://stackoverflow.com/questions/5994859/some-issue-with-atomic-add-in-cuda-kernel-operation)

Specifiy at least compute capability 1.1 to support the floats. the flag on linux is -arch=sm\_1.1 (other popsiblities are 13, 20 and 21). I do not know in winsows, but check the atomic add example in sdk to see the exact flags in compiling.

If the architecture is not specified it assume the lowest automatically.

more here [The Official NVIDIA Forums | NVIDIA](http://forums.nvidia.com/index.php?showtopic=40698)

---

<div class="post-metadata">

**Author:** ![nanogeek815](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@nanogeek815](https://forums.developer.nvidia.com/u/nanogeek815)\
**Post date:** [February 28, 2012, 8:58pm UTC](https://forums.developer.nvidia.com/t/atomicadd-float-float-undefined/25919/3 "2012-02-28T20:58:20Z")

</div>

So I went into the properties bit of VS2010 and changed that but it still doesn’t work.

Same error.  
Also, exits with code -1

---

<div class="post-metadata">

**Author:** ![pasoleatis](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pasoleatis](https://forums.developer.nvidia.com/u/pasoleatis)\
**Post date:** [February 28, 2012, 9:20pm UTC](https://forums.developer.nvidia.com/t/atomicadd-float-float-undefined/25919/4 "2012-02-28T21:20:17Z")

</div>

Did you try the SDK example for atomic add? simpleAtomicIntrinsics If it runs check the project settings for it.

---

<div class="post-metadata">

**Author:** ![seibert](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/seibert/32/520688_2.png) [@seibert](https://forums.developer.nvidia.com/u/seibert)\
**Post date:** [February 28, 2012, 10:56pm UTC](https://forums.developer.nvidia.com/t/atomicadd-float-float-undefined/25919/5 "2012-02-28T22:56:19Z")

</div>

Atomic addition of floats is only supported with compute capability 2.0 and later. You need to pass the

-arch=sm\_20

option to nvcc.
