# simple element wise addition more stores than reads?

**URL:** <https://forums.developer.nvidia.com/t/simple-element-wise-addition-more-stores-than-reads/5224>\
**Category:** CUDA Programming and Performance\
**Created:** [August 28, 2008, 11:34am UTC](https://forums.developer.nvidia.com/t/simple-element-wise-addition-more-stores-than-reads/5224 "2008-08-28T11:34:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![VrahoK](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/vrahok/32/12061_2.png) [@VrahoK](https://forums.developer.nvidia.com/u/VrahoK)\
**Post date:** [August 28, 2008, 11:34am UTC](https://forums.developer.nvidia.com/t/simple-element-wise-addition-more-stores-than-reads/5224/1 "2008-08-28T11:34:06Z")

</div>

Hi,

I’ve got a really simple kernel adding up elements of one vector to another one and storing it back to the second.

```auto
__global__ void add(cufftComplex *src, cufftComplex *dst)

{

  int index = threadIdx.x + blockIdx.x*blockDim.x + blockIdx.y*blockDim.x*gridDim.x;

  dst[index] = cuCaddf(src[index],dst[index]);

}

```

Now when I look at the Visual Profiler output I see that all my reads and writes are coallesced (like expected), but I’ve got n\_writes = 4_n\_reads. I would expect n\_reads = 2_n\_writes for reading from 2 arrays and writing back to one.

Any explanation?

Thanks,

Vrah

---

<div class="post-metadata">

**Author:** ![Tigga](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Tigga](https://forums.developer.nvidia.com/u/Tigga)\
**Post date:** [August 28, 2008, 11:53am UTC](https://forums.developer.nvidia.com/t/simple-element-wise-addition-more-stores-than-reads/5224/2 "2008-08-28T11:53:47Z")

</div>

I’ve seen a similar thing with a slightly more complicated kernel. IIRC the number of reads was twice as many as expected, while the number of writes was correct.

What hardware are you using?

---

<div class="post-metadata">

**Author:** ![VrahoK](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/vrahok/32/12061_2.png) [@VrahoK](https://forums.developer.nvidia.com/u/VrahoK)\
**Post date:** [August 28, 2008, 1:58pm UTC](https://forums.developer.nvidia.com/t/simple-element-wise-addition-more-stores-than-reads/5224/3 "2008-08-28T13:58:16Z")

</div>

> [@](#):
>
> I’ve seen a similar thing with a slightly more complicated kernel. IIRC the number of reads was twice as many as expected, while the number of writes was correct.
> 
> What hardware are you using?
> 
> [snapback]432197[/snapback]

I’m working on a Tesla C870.

Even changing the calculation to float-wise or float4-wise accesses (for it doesn’t matter how much is calculated in one thread) doesn’t change these numbers.
