PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Course

Swapping with pgf90 code

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

Joined: 15 Dec 2004
Posts: 6

PostPosted: Wed Mar 01, 2006 3:46 pm    Post subject: Swapping with pgf90 code Reply with quote


I had a pgf77 code that could not be used for large arrays. So, I went ahead and wrote a pgf90 code with dynamic allocation and modules. I have made sure that the overall number of arrays created have reduced drastically. For same array size, I found that the pgf90 code was taking much less memory compared to the pgf77 code. But when I increased my array size, I find that, although only 85% of memory is being used up, the code started to swap heavily. However, the pgf77 code for the same array size did not. Basically, it appears that the threshold beyond which the code starts to swap is lower for pgf90 than it is for pgf77.

We are compiling the codes on an AMD Dual-Opteron (not dual core) 64 bit with Red Hat Linux 2.4.2 with 4GB RAM and 4 GB swap per node. The codes are being compiled with the PG compilers (Ver. 6.0) (we have to install the latest 6.1 yet) with the following options:

pgf90 -O2 -Mextend -tp=k8-64 -mcmodel=medium
pgf77 -O2 -tp=k8-64 -mcmodel=medium

Firstly, is this a hardware issue (since the pgf77 code works fine, I am less inclined to attribute this to an issue with the hardware)

Are there any additional options that I can specify so that the memory allocation in the pgf90 version is done better to reduce swapping?

Can I use any tools to determine why the code is swapping and also to get an idea of how memory is being allocated?

Back to top
View user's profile

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

PostPosted: Thu Mar 02, 2006 12:26 pm    Post subject: Reply with quote

Hi Madhu,

I don't have real good advice for you but hopefully we can determine what's going on. For clarification, you have written your program using two different methods. In the F90 version you allocate your arrays in modules while in F77 you have statically allocated arrays. What your seeing is that the dynamically allocated arrays seem to be taking up more memory than the statically allocated arrays, thus causing more page swapping.

First, the amount of memory used should only be slighty different between the dynamic and static arrays. Dynamically allocated arrays do need a descriptor, but this relatively small. Also, the F90 runtime can use more memory than its F77 counter part, but I'm not sure if this can account for the difference your seeing. One major difference is that dynamically allocated arrays are allocated on the heap, while staticly allocated arrays are placed on the stack.

Some things that would cause a large difference in the amount of memory used would be if you've forgotten to deallocate your allocated memory, or if your using the POINTER attribute instead of ALLOCATABLE and passing the array to a function without an interface. Since a POINTER many not be contiguous, a temporary copy of the array may be made when passing the array to a function.

Valgrind (found here) does have a heap profiler called "Massif" and a memory checker. While I have not used Massif, I've used the memory check quite often to find memory leaks. Hopefully Valgrind can help you too.

Let me know what you find out.
- 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