PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

CUDA Fortran - Align attribute for allocatable arrays

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
Pradeep Rao



Joined: 18 Jan 2011
Posts: 1

PostPosted: Mon Oct 08, 2012 10:15 pm    Post subject: CUDA Fortran - Align attribute for allocatable arrays Reply with quote

Hi,

I am looking for a feature in CUDA Fortran similar to CUDA C for aligning data structures so as to comply with GPU global memory coalescing. As an example quoted in CUDA C programming guide, we have,

struct __align__(16)
{ float x;
float y;
float z;
};

As per documentation, any access to data residing in global memory compiles to a single global memory instruction if and only if the size of the data type is 1, 2, 4, 8, or 16 bytes and the data is naturally aligned (i.e. its address is a multiple of that size).

I have a 3d data structure similar to above. How do I align them in CUDa Fortran to satisfy the above criteria? Does the align attribute of "allocate" API serve this purpose?
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 5952
Location: The Portland Group Inc.

PostPosted: Wed Oct 10, 2012 8:27 am    Post subject: Reply with quote

Hi Pradeep Rao,

Fortran User defined types and C structs will naturally align on 16-bytes when the size is 16-bytes or larger. So the solution here is to add a fourth float or REAL for padding.

- Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling 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