PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Course

About memory allocation and memory copy

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



Joined: 23 Sep 2009
Posts: 2

PostPosted: Tue Mar 30, 2010 6:45 am    Post subject: About memory allocation and memory copy Reply with quote

It is a about the memory allocation and memory copy between CPU and GPU. In high dimension cases could the memory copy by done by
For example d_A is a 5 dimensional array
d_A(:,:,:,:,:) = A(:,:,:,:,:)

Thanks.:-)
Back to top
View user's profile
mkcolg



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

PostPosted: Tue Mar 30, 2010 10:22 am    Post subject: Reply with quote

Hi soniccrazy,

Sure, but you could simplify it further with just "dA = A".

- Mat
Back to top
View user's profile
paulv



Joined: 26 Jul 2004
Posts: 19
Location: JCSDA

PostPosted: Wed May 05, 2010 2:06 am    Post subject: Re: About memory allocation and memory copy Reply with quote

soniccrazy wrote:
It is a about the memory allocation and memory copy between CPU and GPU. In high dimension cases could the memory copy by done by
For example d_A is a 5 dimensional array
d_A(:,:,:,:,:) = A(:,:,:,:,:)

This issue is (well, was) discussed fairly regularly in the comp.lang.fortran newsgroup.

Be aware that
Code:
d_A(:,:,:,:,:) = A(:,:,:,:,:)

is not the same as
Code:
d_A = A

as the former is using array slices. For assignment I doubt it's a big deal. In other situations 99.9% of the time it probably won't matter. For GPU's I can't say (no experience).

The most common argument for using this type of assignment is that it provides a visual reminder to the reader of the code that d_A and A are arrays, not scalars. I don't subscribe to it.

FWIW, when I see code that contains assignment statements using array slices like your example, it's an indication the code was written by someone new to Fortran90+ (or following coding guidelines written back in the 1990's when Fortran90 was sliced bread and Fortran77 coders were mildly confused :o)

cheers,

paulv
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