[petsc-users] Memory logging in fortran

Barry Smith bsmith at mcs.anl.gov
Thu May 23 18:45:53 CDT 2013


  Colin,

    Thanks for the info. We'll try to reorganize getting the memory size on the Apple using your information and get it into a patch.

    Barry

On May 23, 2013, at 4:11 PM, Colin McAuliffe <cjm2176 at columbia.edu> wrote:

> So after comparing the results of getrusage with guppy, a python memory profiling tool, it seems the os x getrusage is returning bytes in contrast to the os x man pages which say the results are in kb. Doing the same tests on a linux machine, it looks like getrusage is returning kb as it says in the documentation. Anyway it is not problem to correct the results of the petsc memory functions from my application code. Thanks for all your help!
> 
> Colin
> 
> Quoting Barry Smith <bsmith at mcs.anl.gov>:
> 
>> 
>> On May 22, 2013, at 8:32 PM, Colin McAuliffe <cjm2176 at columbia.edu> wrote:
>> 
>>> According to gdb the program goes here
>>> 
>>> 110: #elif defined(PETSC_HAVE_TASK_INFO)
>>> 111:   *mem = 0;
>>> 
>>> The configuration flags from my petsc compilation indicate that  both PETSC_HAVE_TASK_INFO and PETSC_HAVE_GETRUSAGE are 1. I'm not  sure what have task info is supposed to do, is it safe to set it to  0 to see if this fixes the problem?
>> 
>>    Remove the PETSC_HAVE_TASK_INFO  stuff completely and then rerun  make and see if it solves the problem.
>> 
>>     At some point the TASK_INFO stuff worked on the Apple some  years ago, perhaps they turned if off.
>> 
>>   Barry
>> 
>>> 
>>> Quoting Barry Smith <bsmith at mcs.anl.gov>:
>>> 
>>>> 
>>>> On May 22, 2013, at 7:06 PM, Colin McAuliffe <cjm2176 at columbia.edu> wrote:
>>>> 
>>>>> Hi Barry, thanks for the quick response.
>>>>> 
>>>>> I am using os x and so I would expect that petsc would be able to   use getrusage in the following lines of mem.c:
>>>>> 
>>>>> 115: #elif defined(PETSC_HAVE_GETRUSAGE)
>>>>> 116:   getrusage(RUSAGE_SELF,&temp);
>>>>> 
>>>>> Is this not the case?
>>>> 
>>>>  You can run in the debugger, put a break point at that line to   verify it goes there and if it does check the values of temp after   the call. (Sometimes Apple's docs are more optimistic than  reality.)
>>>> 
>>>>  Barry
>>>> 
>>>>> 
>>>>> Here is the link to apple's getrusage manual page
>>>>> http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/10.7/man2/getrusage.2.html
>>>>> 
>>>>> Quoting Barry Smith <bsmith at mcs.anl.gov>:
>>>>> 
>>>>>> 
>>>>>> Colin,
>>>>>> 
>>>>>>  PetscMemoryGetCurrentUsage() and MaximumUsage() us calls to  the   underlying operating system to get how much memory the  process is   using, as such they will also include external  package memory.   Unfortunately it depends on the operating  system providing this   information and often it does not, this  is why you get 0. If you  are  a hacker you could look at the  source for   PetscMemoryGetCurrentUsage() and see how to get the  information  for  your OS and add it to this routine.
>>>>>> 
>>>>>> Barry
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> On May 22, 2013, at 6:31 PM, Colin McAuliffe  <cjm2176 at columbia.edu> wrote:
>>>>>> 
>>>>>>> Hi all,
>>>>>>> 
>>>>>>> When calling PetscMemoryGetCurrentUsage or    PetscMemoryGetMaximumUsage in a fortran code the memory usage    returned is always zero. Adding command line options such as    -malloc_log and -memory_info doesn't change this result. Is  there   something else I'm missing? Also, will use of these two   functions  give memory used by external packaged called by  petsc?
>>>>>>> 
>>>>>>> All the best,
>>>>>>> Colin
>>>>>>> 
>>>>>>> --
>>>>>>> Colin McAuliffe
>>>>>>> PhD Candidate
>>>>>>> Columbia University
>>>>>>> Department of Civil Engineering and Engineering Mechanics
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> Colin McAuliffe
>>>>> PhD Candidate
>>>>> Columbia University
>>>>> Department of Civil Engineering and Engineering Mechanics
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Colin McAuliffe
>>> PhD Candidate
>>> Columbia University
>>> Department of Civil Engineering and Engineering Mechanics
>> 
>> 
>> 
> 
> 
> 
> -- 
> Colin McAuliffe
> PhD Candidate
> Columbia University
> Department of Civil Engineering and Engineering Mechanics



More information about the petsc-users mailing list