Removing the have task info stuff leads to getrusage being called. Though there must be a bug in the os x getrusage because the max resident set size it returns is too large to be right. I realize this is not related to petsc, but if you are interested the python script:

import resource
import sys

t = range(0,10000)

print "Size of t is ",sys.getsizeof(t),"bytes"
print "Max resident set size is ",resource.getrusage(resource.RUSAGE_SELF)[2]*1024,"bytes"

gives the output:

Size of t is  80072 bytes
Max resident set size is  4521459712 bytes

I would guess the two values should be in the same ballpark, and actually the computed resident set size is larger than the amount of memory I have to begin with! Hopefully the apple developers would be able to help.

Thanks
Colin

Quoting Barry Smith <[email protected]>:


On May 22, 2013, at 8:32 PM, Colin McAuliffe <[email protected]> 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 <[email protected]>:


On May 22, 2013, at 7:06 PM, Colin McAuliffe <[email protected]> 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 <[email protected]>:


 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 <[email protected]> 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

Reply via email to