PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

using cudaMallocPitch

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
Tuan



Joined: 11 Jun 2009
Posts: 233

PostPosted: Fri Jan 07, 2011 10:20 pm    Post subject: using cudaMallocPitch Reply with quote

I'm considering to use cudaMallocPitch() or not. So, could you please clarify:

The reason of using cudaMallocPitch is for data-coalescing. In CUDA C, data elements in a 2D array is referenced using 2 pointers. So, it requires the starting point of each row is 64-byte aligned.
1. In CUDA Fortran, do we have this restriction?
2. If YES, is it correct that as long as each column is 64-byte aligned, we don't need to use cudaMallocPitch(), and allocate() is good enough?


So, (in CUDA Fortran) if my data is a 2D array, with each element is 8-byte (e.g. double precision) and the row dim is a multiple of 8, then there is no need to use cudaMallocPitch()? Is that rite?

In case the row dim is not a multiple of 8, should I use cudaMallocPitch()? or is there another option in Fortran can be use for CUDA Fortran?

Thanks,

Tuan
Back to top
View user's profile
brentl



Joined: 20 Jul 2004
Posts: 132

PostPosted: Mon Jan 10, 2011 2:45 pm    Post subject: Reply with quote

1. No, we don't have that restriction
2. No, you don't need cudaMallocPitch()

Fortran programmers have been manually padding arrays for as long as there have been arrays, so you can do that yourself if you want. It all depends on how you access the data within the array, to determine whether you get good coalescing memory behavior or not.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group