From: alexei.matveev on
Dear Fortran Experts,

I observe a very strange behavior of a non-advancing
IO in a program compiled with
Absoft 64-bit Fortran 95 9.0 with Service Pack 1
on x86_64. It appears like very slow read access...

Does anybody know about similar glitches or internal working
of (Absoft) Fortran compilers?

The story is like that:

1) "strace -p" shows read() syscall slurping 8K from the disk

2) immediately after that "strace" shows an mmap() syscall
with 80M length (!!), though the file is ~20K.
( from now on no syscall activity except of debug prints on tty)

3) Fortran non-advancing IO iterates over lines and characters
collecting together non-whitespace into CHARBUF and reading
by e.g. Fortran statement read(CHARBUF,*) real_num
( it goes so for hours(!!) and then completes without error messages )

It seems the critical step is *reading a character* by
read(io,'(A)', advance='no')
because whenever I interrupt the program i see in gdb this:

(gdb) where 10
#0 0x00000000021e9c21 in _fmemcpy ()
#1 0x00000000021eb3ff in _copybuf ()
#2 0x00000000021ee4f4 in _f_rterm3 ()
#3 0x00000000021dcb0b in __A_FRF ()
#4 0x0000000000eb522f in __READ_CHAR_in_IO ()

Is there anything in the
source of __READ_CHAR_in_IO with non-advaning IO
which I could have done wrong:

subroutine read_char(io,res,stat)
implicit none
integer(IK),intent(in) :: io
character, intent(out) :: res
integer(IK),intent(out) :: stat
! *** end of interface ***

stat = IO_OK

read(io,'(A)', advance='no',EOR=1001,END=1002) res
return

1001 continue ! EOR exeption
DPRINT 'io::read_char: EOR!'
stat = IO_EOR
return

1002 continue ! EOF exeption
DPRINT 'io::read_char: EOF!'
stat = IO_EOF
return
end subroutine read_char

Unfortunately I cannot reproduce the problem in
"clean lab" conditions...

Thank you in advance,

Alexei

 | 
Pages: 1
Prev: Help with Fortran 77 in Iteration
Next: SSP 360