|
|
Up |
|
|
  |
Author: Infinity77Infinity77 Date: May 5, 2008 09:54
Hi All,
I have an unformatted file, and I open it for reading in big
endian mode. The file has a repetitive structure (is a time step
report for a simulation): at the beginning of every time step, there
is this pseudo-declaration:
'PARAMS'
keyword number kind
where "keyword" is an 8 character string, "number" is an integer which
tells me how much data this time step contains, and "kind" is a 4
character string which tells me the data type (i.e., 'CHAR', 'REAL'
and so on). After this declaration, the data for the current time step
follows. As an example:
'PARAMS ' 4200 'REAL'
0.5372 3.7393 0.3273 .... (4200 real numbers)
|
| Show full article (3.14Kb) |
|
| | 4 Comments |
|
  |
Author: glen herrmannsfeldtglen herrmannsfeldt Date: May 5, 2008 11:11
Infinity77 wrote:
> I have an unformatted file, and I open it for reading in big
> endian mode. The file has a repetitive structure (is a time step
> report for a simulation): at the beginning of every time step, there
> is this pseudo-declaration:
> 'PARAMS'
> keyword number kind
> where "keyword" is an 8 character string, "number" is an integer which
> tells me how much data this time step contains, and "kind" is a 4
> character string which tells me the data type (i.e., 'CHAR', 'REAL'
> and so on). After this declaration, the data for the current time step
> follows. As an example:
When describing an UNFORMATTED file, be sure to indicate the
record boundaries. Looking at the code, it seems that the
keyword number kind indicator is a separate record, but that isn't
obvious as described here.
> 'PARAMS ' 4200 'REAL'
> 0.5372 3.7393 0.3273 .... (4200 real numbers)
|
| Show full article (2.55Kb) |
|
| | no comments |
|
  |
Author: Janne BlomqvistJanne Blomqvist Date: May 6, 2008 01:34
On 2008-05-05, Infinity77 gmail.com> wrote:
> I have an unformatted file, and I open it for reading in big
> endian mode.
If you're not going to read/write the file on multiple platforms with
different native endianness, get rid of the CONVERT= stuff. Converting
endianness on the fly has much more overhead than just streaming the
data directly into application memory.
> The file has a repetitive structure (is a time step
> report for a simulation): at the beginning of every time step, there
> is this pseudo-declaration:
>
> 'PARAMS'
> keyword number kind
>
> where "keyword"...
|
| Show full article (2.32Kb) |
| no comments |
|
  |
Author: Janne BlomqvistJanne Blomqvist Date: May 6, 2008 01:48
On 2008-05-05, glen herrmannsfeldt ugcs.caltech.edu> wrote:
> The READ could also be:
>
> read(1, end=40) (matrix(i,matrixIndex),i=1000*internalCount+1:
> @ 1000*(internalCount+1))
>
> It might be that one is faster than the other for a particular
> compiler and library.
At least for gfortran the opposite is true. The implied do loop above
is handled by the frontend, IIRC converting it to (roughly) the
equivalent do loop like
do i = 1000*internalCount+1, 1000*(internalCount+1)
read (1, end=40) matrix(i,matrixIndex)
end do
|
| Show full article (1.45Kb) |
| no comments |
|
  |
|
|
  |
Author: glen herrmannsfeldtglen herrmannsfeldt Date: May 6, 2008 14:39
Janne Blomqvist wrote:
> On 2008-05-05, glen herrmannsfeldt ugcs.caltech.edu> wrote:
>>The READ could also be:
>> read(1, end=40) (matrix(i,matrixIndex),i=1000*internalCount+1:
>> @ 1000*(internalCount+1))
>>It might be that one is faster than the other for a particular
>>compiler and library.
I said one might be faster, but not which one.
> At least for gfortran the opposite is true. The implied do loop above
> is handled by the frontend, IIRC converting it to (roughly) the
> equivalent do loop like
> do i = 1000*internalCount+1, 1000*(internalCount+1)
> read (1, end=40) matrix(i,matrixIndex)
> end do
Well, it can't be quite like that because of the record
boundaries, but one call to the I/O routine per array element
I do understand.
|
| Show full article (2.65Kb) |
| no comments |
|
|