# cudaMemcpy2D(): reason for pitch limits?

**URL:** <https://forums.developer.nvidia.com/t/cudamemcpy2d-reason-for-pitch-limits/1332>\
**Category:** CUDA Programming and Performance\
**Created:** [August 20, 2007, 11:48am UTC](https://forums.developer.nvidia.com/t/cudamemcpy2d-reason-for-pitch-limits/1332 "2007-08-20T11:48:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmutch](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jmutch](https://forums.developer.nvidia.com/u/jmutch)\
**Post date:** [August 20, 2007, 11:48am UTC](https://forums.developer.nvidia.com/t/cudamemcpy2d-reason-for-pitch-limits/1332/1 "2007-08-20T11:48:41Z")

</div>

cudaMemcpy2D() fails with a pitch size greater than 2^18 = 262144.

Can anyone tell me the reason behind this seemingly arbitrary limit? As far as I understood, having a pitch for a 2D array just means making sure the rows are the right size so that alignment is the same for every row and you still get coalesced memory access. There is no obvious reason why there should be a size limit.

(I just ran up against this limit, which is barely documented. The number isn’t in the manual, but there is a brief reference to there being a limit in cudaGetDeviceProperties. This is going to cost me a fair bit of rewriting.)

Jim

---

<div class="post-metadata">

**Author:** ![jmutch](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jmutch](https://forums.developer.nvidia.com/u/jmutch)\
**Post date:** [August 20, 2007, 12:27pm UTC](https://forums.developer.nvidia.com/t/cudamemcpy2d-reason-for-pitch-limits/1332/2 "2007-08-20T12:27:18Z")

</div>

cudaMemcpy2D() also fails with a height greater than 2^16 = 65536.

Again – why? And if there’s no good reason, is the limit going to go away?

---

<div class="post-metadata">

**Author:** ![Simon\_Green](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Simon\_Green](https://forums.developer.nvidia.com/u/Simon_Green)\
**Post date:** [August 20, 2007, 1:02pm UTC](https://forums.developer.nvidia.com/t/cudamemcpy2d-reason-for-pitch-limits/1332/3 "2007-08-20T13:02:45Z")

</div>

I believe these are hardware limitations - there are only a limited number of bits in the hardware copy engines.

We’ll try and make this clearer in the documentation.

---

<div class="post-metadata">

**Author:** ![jmutch](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jmutch](https://forums.developer.nvidia.com/u/jmutch)\
**Post date:** [August 20, 2007, 6:26pm UTC](https://forums.developer.nvidia.com/t/cudamemcpy2d-reason-for-pitch-limits/1332/4 "2007-08-20T18:26:19Z")

</div>

Thanks for the quick reply.

I guess this wasn’t an unreasonable limitation in the graphics world. I imagine all sorts of things like this are popping up now that general purpose computing is starting to take off.

Jim
