[petsc-users] Memory logging in fortran
Barry Smith
bsmith at mcs.anl.gov
Wed May 22 19:27:40 CDT 2013
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
More information about the petsc-users
mailing list