PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

Memory Requirements
Goto page Previous  1, 2
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
andyh



Joined: 23 May 2005
Posts: 7

PostPosted: Wed Jun 01, 2005 6:50 am    Post subject: Reply with quote

Hi Mat,

I was including stdlib.h and math.h but explicitly placed malloc.h in the code and it still behaved the same way.

I am using calloc heavily and dynamic memory.

One clue however is that I am also using free() because there is a bunch of memory bound in transient dynamic arrays. Could the problem be that free() is not freeing the memory in the case of the pgcc compiled code?

Andy
Back to top
View user's profile
mkcolg



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

PostPosted: Wed Jun 01, 2005 11:12 am    Post subject: Reply with quote

Hi Andy,

The reason for adding the malloc header file is that the default prototype for malloc is '(void *) malloc (int)' but what you need is '(void *) malloc(long)' if your requesting more than 2Gb.

Quote:
One clue however is that I am also using free() because there is a bunch of memory bound in transient dynamic arrays. Could the problem be that free() is not freeing the memory in the case of the pgcc compiled code?

Doubtful. Both gcc and pgcc should be using the exact same libc system calls. The OS might not be reclaiming the memory, but it should be marked as 'free'.

Some possibilities are: The pgcc version is making more calls to calloc, pgcc is missing the calls to free, or gcc is not making enough calls calloc. Without the code however, its very difficult to make a firm diagnosis. Can you determine how much memory your program actually requests?

- Mat
Back to top
View user's profile
andyh



Joined: 23 May 2005
Posts: 7

PostPosted: Thu Jun 02, 2005 7:58 am    Post subject: Reply with quote

Mea Culpa,

I had a configure issue. include malloc seems to be doing the trick and memory requirements are the same between codes now.

Thanks so much for your help!

Andy
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
Goto page Previous  1, 2
Page 2 of 2

 
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