[patch, libfortran] PR33985 access="stream",form="unformatted" doesn't buffer

Jerry DeLisle jvdelisle@verizon.net
Sat Nov 3 23:07:00 GMT 2007


Angelo Graziosi wrote:
> I have applied the patch added here
> http://gcc.gnu.org/ml/fortran/2007-11/msg00011.html to GFC-4.2.2 under
> Cygwin and have not observed any progesses in reading a binary file
> of about 36MB. The file is written with these statements (nr = nz = 1499):
> 
>    ...
>    open(30,file=fMap,status='unknown',access='stream')
> 
>    write(30) nr,nz
>    write(30) dr,dz
>    r = 0.D0*dr
>    do j = 0,nr
>       z = 0.D0*dz
>       do k = 0,nz
>          call bcalc(r,z,br,bz)
>          write(30) br,bz
>          z = z+dz
>       enddo
>       r = r+dr
>    enddo
>    close(30)
> 
> 
> and it is read with
> 
>    open(MAPUNT,file='cobra.map',status='OLD',access='STREAM')
>    read(MAPUNT) nr,nz
>    read(MAPUNT) dr,dz
>    call alloc_mem()
>    ! ===============================================
>    !  Setting MAXR and MAXZ for GUFLD interpolation
>    ! ===============================================
>    maxR = real(nr*dr)
>    maxZ = real(nz*dz)
>    write(*,*)
>    write(*,'(A)',advance='NO') 'Loading B field...'
>    do i = 0,nr
>       do j = 0,nz
>          read(MAPUNT) br(i,j),bz(i,j)
>       enddo
>    enddo
>    close(MAPUNT)
> 
> 
> WITH or WITHOUT the patch it takes about 2 minutes to read it (1m54.578)!
> 
> G77 takes 53 seconds to read a similar file of 50MB (the unformatted files
> for G77 have the record marker, so the size increases); G95 takes less
> than 6 seconds (but I suspect that g95 on Cygwin uses pure Windows libs).
> 
> So, have I misinterpreted the meaning of the patch or is it specific for
> GFC-4.3 and not for 4.2.2?
> 
> Am I missing something else?

The patch only affects 'unformatted' STREAM.  Regardless, I will investigate 
your issue here.  If you could send me a completely self contained example it 
would be helpful (otherwise I build one myself)

Thanks for reporting.

Jerry



More information about the Fortran mailing list