# cudaMallocPitch() question

**URL:** <https://forums.developer.nvidia.com/t/cudamallocpitch-question/12884>\
**Category:** CUDA Programming and Performance\
**Created:** [October 21, 2009, 7:45pm UTC](https://forums.developer.nvidia.com/t/cudamallocpitch-question/12884 "2009-10-21T19:45:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gpu\_user](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@gpu\_user](https://forums.developer.nvidia.com/u/gpu_user)\
**Post date:** [October 21, 2009, 7:45pm UTC](https://forums.developer.nvidia.com/t/cudamallocpitch-question/12884/1 "2009-10-21T19:45:59Z")

</div>

f I want to use

T\* pElement = (T\*)((char\*)BaseAddress + Column\* pitch) + Row;

Do I write?

cudaMallocPitch( (void\*\*) &d\_src , &pitch , height\* sizeof(float) , width);

Thanks!

---

<div class="post-metadata">

**Author:** ![Quoc\_Vinh](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Quoc\_Vinh](https://forums.developer.nvidia.com/u/Quoc_Vinh)\
**Post date:** [October 22, 2009, 3:33am UTC](https://forums.developer.nvidia.com/t/cudamallocpitch-question/12884/2 "2009-10-22T03:33:55Z")

</div>

> [@](#):
>
> f I want to use
> 
> T\* pElement = (T\*)((char\*)BaseAddress + Column\* pitch) + Row;
> 
> Do I write?
> 
> cudaMallocPitch( (void\*\*) &d\_src , &pitch , height\* sizeof(float) , width);
> 
> Thanks!

NO!

if you want to access data with “T\* pElement = (T\*)((char\*)BaseAddress + Column\* pitch) + Row;”

you may not get proper result. That must be a transformation matrix.
