What about reading in data from a separate (comma-delimited?) text file,
and then immediately saving in arrays or (platform dependent) binary
unformatted scratch files (if you're pushing Fortran array limits) ?
Admittedly, there is still the portability issue of the difference
between line return standards on different platforms.
Gaz
-----Original Message-----
From: Len Makin [mailto:[log in to unmask]]
Sent: Thursday, 8 November 2001 10:48
To: [log in to unmask]
Subject: Re: Fortran Memory
On Wednesday, 7 November 2001, at 14:57,
Richard Maine <[log in to unmask]> wrote:
> Len Makin writes:
> > So why do we do this?
> [Put huge arrays in data statements]
> > Because many programs are to be executed many times,
> > but only linked once. The time for compile/link becomes
insignificant
> > compared to the repeated hit of the equivalent executable
statements,
> > or even worse, waiting for disk I/O. Fortran is used where
(executable)
> > performance matters. If the compilation and linking are fast too,
that's
> > a bonus but not the main point at issue.
... <good stuff deleted>...
> I really think that in most cases where I see such huge arrays,
> the real reason is just convenience. The programmer found it more
> convenient to throw them into a data statement than to write code
> to read them from a file. Though this convenience vanishes pretty
> quickly when it starts choking compilers, or when the data has to
> be modified and this requires recompilation for every modification.
I think I agree. However there is also a portability/clarity issue
involved. It is clearer or more convenient often to supply the source
containing explicit (commented ? ;-) DATA statements with initial
values,
than to explain and port data files between different systems with
different filenaming conventions, unformatted record structures, etc.
Of course if the data is often modified, then your reasoning is quite
correct - put it in an unformatted file and read once. If the criterion
is portability rather than performance, use a formatted (possibly
NAMELIST)
file.
Cheers,
Len
--
[log in to unmask]:+61 3 9669 8109: CSIRO/Bureau of Meteorology
High Performance Computing and Communications Centre
24th floor, 150 Lonsdale St | GPO Box 1289K, Melbourne, VIC 3001
Australia
************************************************************************
The information in this e-mail together with any attachments is
intended only for the person or entity to which it is addressed
and may contain confidential and/or privileged material.
Any form of review, disclosure, modification, distribution
and/or publication of this e-mail message is prohibited.
If you have received this message in error, you are asked to
inform the sender as quickly as possible and delete this message
and any copies of this message from your computer and/or your
computer system network.
************************************************************************
|