PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Trouble Getting Started CUDA/PGI Fortran
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
Dolf



Joined: 22 Mar 2012
Posts: 100

PostPosted: Wed Nov 07, 2012 10:34 am    Post subject: RE: Reply with quote

Hi Mat,

I meant module size, like for below:

module matrices_1

implicit none
real(8), device, allocatable, dimension (:,:) :: aDev,bDev,cDev

end module matrices_1

allocate(aDev(306,306),bDev(306,306))

size of module = size(aDev) + size(bDev) ??? no??

how can calculate size of aDev??
is it gonna be: size(aDev) = 8 * 306 * 306 bytes???

please advice.

Dolf
Back to top
View user's profile
mkcolg



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

PostPosted: Wed Nov 07, 2012 12:09 pm    Post subject: Reply with quote

Quote:
size of module = size(aDev) + size(bDev) ??? no??

how can calculate size of aDev??
is it gonna be: size(aDev) = 8 * 306 * 306 bytes???
Sorry Dolf, but I'm still not clear on what you're asking. To me, "size of module" means the number of lines of source code in a module. Are you trying to calculate the total amount of memory in bytes the module's data will consume?

"size" returns the number of element in an array not the number of bytes. So the number of bytes for aDev would be "size(aDev) * kind(aDev)".

- Mat
Back to top
View user's profile
Dolf



Joined: 22 Mar 2012
Posts: 100

PostPosted: Wed Nov 07, 2012 12:48 pm    Post subject: RE: Reply with quote

thanks Mat for you patience.
yes, I want to know the following:

1) how can I calculate memory usage by the module, not how many lines.
2) what is the maximum limit of memory that I can use.
3) how can I calculate the memory utilized by a matrix, giving its size and type (real(8)).

by the way, I am using NVIDIA GeForce 640v2, cuda 4.2.
thanks.
Dolf
Back to top
View user's profile
mkcolg



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

PostPosted: Wed Nov 07, 2012 1:52 pm    Post subject: Reply with quote

Hi Dolf,

Quote:
1) how can I calculate memory usage by the module, not how many lines.

For static module variables, you can either manually calculate them and/or use the Linux "size" command. The BSS and data segments will show the size in bytes of your static module data.

For dynamic allocation, you will need to do this at run time if the size of the allocation is variable. If the size is known, then you can manually calculate the usage.

For local variables, these are stored on the program stack and the exact amount of memory in use will depend upon the calling sequence.

Keep in mind, if you are using OpenMP, private memory is duplicated for each thread and is stored on each thread's program stack.

Quote:
2) what is the maximum limit of memory that I can use.


For static memory with the small memory module it's 2GB. To go beyond 2GB of static memory, use the medium memory model (-mcmodel=medium).

For dynamic memory in 64-bits, you can theoretically address 2^64 bytes (though on most systems it's only 2^48) . However, if any individual array is larger then 2GB, add the flag "-Mlarge_arrays".

On the GPU, there isn't any virtual memory so you are limited by the amount of physical memory on the device.

Quote:
3) how can I calculate the memory utilized by a matrix, giving its size and type (real(8)).
Number of elements times the size in bytes of the data type. In Fortran "byte_size_Arr = size(Arr) * kind(Arr)"

- Mat
Back to top
View user's profile
Dolf



Joined: 22 Mar 2012
Posts: 100

PostPosted: Wed Nov 07, 2012 2:11 pm    Post subject: RE: Reply with quote

so, are you saying, if I have aDev(306,306), and its real(8) type, the memory size is:

8 * 306 * 306 bytes??

thanks,
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
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 5 of 7

 
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