PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Multi-dimensional array copyin

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



Joined: 14 Oct 2012
Posts: 10

PostPosted: Sun Oct 14, 2012 6:58 am    Post subject: Multi-dimensional array copyin Reply with quote

I have a 2D matrix SIZE x SIZE, which I'm trying to copy to the GPU.

I allocate the matrix this way:

Code:
float (*a)(SIZE) = (float(*)[SIZE]) malloc(SIZE * SIZE * sizeof(float));


And I have this on my ACC region:

Code:
#pragma acc data copyin(a[0:SIZE][0:SIZE]


The compiler output is:

Code:
Generating copyin(a[0:1024][0:])


What does a[0:1024][0:] mean?

If instead of this, I have only one array with SIZE*SIZE length (and copy everything to the GPU), then the code is about 10x slower to execute.

Any ideas?
Back to top
View user's profile
mkcolg



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

PostPosted: Mon Oct 15, 2012 11:21 am    Post subject: Reply with quote

Hi lechat,

In OpenACC, only contiguous data blocks of data can be copied. Since SIZE is known and you're array is contiguous, the compiler is copying the whole array in one large 1-D block.

Quote:
If instead of this, I have only one array with SIZE*SIZE length (and copy everything to the GPU), then the code is about 10x slower to execute.
I'd need an example of your code to determine why this would be the case.

Hope this helps,
Mat
Back to top
View user's profile
lechat



Joined: 14 Oct 2012
Posts: 10

PostPosted: Tue Oct 16, 2012 3:16 pm    Post subject: Reply with quote

Hi mkcolg,

thank you for your reply, very useful.

I'm sorry, the code with the "serialized" matrix is *not* 10x times slower, it was a mistake on my side.

Thank you
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