From: patchkov@acs1.acs.ucalgary.ca (Serguei Patchkovskii)
Subject: Re: More questions on swap space reservation
Date: 1999/05/27 [thread overview]
Message-ID: <7ik088$ib4@ds2.acs.ucalgary.ca> (raw)
In-Reply-To: 7ijs42$ta2$1@nnrp1.deja.com
dtmoore (sponk@my-deja.com) wrote:
: so. So, my question is this ... if I re-write the array declarations
: using F90 dynamic allocation, will it help to alleviate my problem, or
: will it just delay the swap bloating until program reaches the
: allocation statments? Another way to ask this is ... under the
If you allocate only the amount of space you need (rather than the largest
size you might need), or if you deallocate arrays which are no longer
needed, you'll do fine. Likewise, if there are some parts of the program
which are never reached in a typical run, and you never get to the allocate
statements, the amount of swap space you need will decrease.
If neither is true, and all the memory you might conceivably need is
allocated at the start of the program and lives through the whole run
you will need the same amount of the swap space as in the statically
dimensioned case - plus some overhead.
: immediate swap mode, is the swap file size fixed when the process
: starts, or will it be increased as more dynamic allocation occurs?
When you use ALLOCATE in your Fortran program, your request eventually
winds down to the sbrk() system routine[*], which simply attempts to
extend the bss segment of your program. (This is why I told that dynamic
memory is treated just like bss). In the immediate mode, this will also
allocate however much swap pages is needed to swap out the new memory
locations. If this cannot be done, sbrk() will return an error, which
will (eventually) result in a non-zero status indication from ALLOCATE.
If you don't have the STAT= attribute in the ALLOCATE, it will simply
kill your program - possibly several hours (or days, or weeks) into
the calculation.
In this sense, a statically dimensioned Fortran-77 program running in
the immediate mode is more reliable, as it is *guaranteed* not to run
out of memory at any future time. (Being able to determine the maximum
data size of an arbitrary program at the startup time was one of the
design requirements behind Fortran-77). Being able to allocate memory
dynamically is nice, but requires certain amount of discipline and a
fair bit of extra error handling.
Regards,
/Serge.P
[*] This is in fact a gross oversimplification, but it will do.
--
home page: http://www.cobalt.chem.ucalgary.ca/ps/
prev parent reply other threads:[~1999-05-27 4:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-05-26 4:00 More questions on swap space reservation dtmoore
1999-05-26 4:00 ` Serguei Patchkovskii
1999-05-27 4:00 ` dtmoore
1999-05-27 4:00 ` Serguei Patchkovskii [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox