memory allocation overhead
From: Mike M?ller (mmueller_at_dgfz.de)
Date: 04/28/04
- Next message: Michael Metcalf: "Re: memory allocation overhead"
- Previous message: Mike Cowlishaw: "Re: Fortran decimal anyone?"
- Next in thread: Michael Metcalf: "Re: memory allocation overhead"
- Reply: Michael Metcalf: "Re: memory allocation overhead"
- Reply: Jugoslav Dujic: "Re: memory allocation overhead"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 28 Apr 2004 03:38:28 -0700
I am porting a f77 application to f90. One of the most outstanding
features of the application is its memory management. Since the f77
standard allows only static memory allocation and vendor specific
dynamic memory allocation at this time (20 years ago) were slow (inner
loop, where allocations maybe called million of times) it has its own
scheme.
The application allocates a large junk of memory at start up. This
memory can be accessed by index. Therefore, the memory can be used for
dynamic size arrays at run time.
There are two parts to the memory. One for arrays that stay around
over the lifetime of the application and the other for scratch arrays
that can be used in a subroutine and then "deallocated".
The first type of memory (i.e. global arrays that are needed for most
part of program run) can be allocated once in a module and than made
available through use association.
The scratch arrays can be easily implemented as automatic arrays. But,
since those automatic arrays are allocated and deallocated in each
subroutine call the overhead for this might be considerable for very
frequent calls.
It would be interesting to know how big the overhead for automatic
arrays is. How does it depend on compiler, OS, hardware? Are there
compiler options to reduced such kind of overhead? ...
Since scratch arrays are used again and again, allocating them once
and just reuse them might be a solution. But there are a lot of
scratch arrays. So total memory usage might be enormous. Lots of
rarely used arrays would stick around but are of no use anymore.
Another way I though of, would be to allocate a bunch of arrays for
scratch purposes when they are needed the first time and keep them in
a module for use by other subroutines. That means, those subroutines
use the same arrays, or parts thereof, and just overwrite their
content, maybe setting a default first (zero or so). This would also
be some kind of own memory management but achieved with f90 means
(modules, dynamic allocation).
I would be very interested in the experience of others with similar
problems.
Thanks.
Mike
- Next message: Michael Metcalf: "Re: memory allocation overhead"
- Previous message: Mike Cowlishaw: "Re: Fortran decimal anyone?"
- Next in thread: Michael Metcalf: "Re: memory allocation overhead"
- Reply: Michael Metcalf: "Re: memory allocation overhead"
- Reply: Jugoslav Dujic: "Re: memory allocation overhead"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|