This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



On Sat, 3 Nov 2007, Jerry DeLisle wrote:

> If you could send me a completely self contained example it
> would be helpful (otherwise I build one myself)
>

Here the exaples with results:

Writing the stream
==============================================================
!
! gfortran write_stream.F95 -o write_stream
!
! GFC-4.2.2 results without patch (3rd run)
!
!    $ time ./write_stream
!
!    real	0m54.718s
!    user	0m9.436s
!    sys	0m31.718s
!
!
! GFC-4.2.2 results with patch (3rd run)
!
!    $ time ./write_stream.patched
!
!    real	0m5.250s
!    user	0m3.624s
!    sys	0m1.546s
!
module kind_consts
  integer, parameter :: DP = kind(1.D0)
end module kind_consts

program write_stream
  use kind_consts
  implicit none
  real(DP), parameter :: X = 1.D0,Y = 1.D0
  integer, parameter :: NX = 1499,NY = 1499
  integer :: i,j
  open(30,file='test.dat',status='unknown',access='stream')
  write(30) NX,NY
  do i = 0,NX
     do j = 0,NY
        write(30) X,Y
     enddo
  enddo
   close(30)
end program write_stream
==================================================================


Reading the stream
==================================================================
!
! gfortran read_stream.F95 -o read_stream
!
! GFC-4.2.2 results without patch (3rd run)
!
!    $ time ./read_stream
!
!    real	1m46.297s
!    user	0m15.671s
!    sys	1m4.984s
!
! GFC-4.2.2 results with patch (3rd run)
!
!    $ time ./read_stream.patched
!
!    real	1m45.688s
!    user	0m14.515s
!    sys	1m4.453s
!
module kind_consts
  integer, parameter :: DP = kind(1.D0)
end module kind_consts

program read_stream
  use kind_consts
  implicit none
  real(DP) :: x,y
  integer :: nx,ny,i,j
  open(30,file='test.dat',status='old',access='stream')
  read(30) nx,ny
  do i = 0,nx
     do j = 0,ny
        read(30) x,y
        !print *,x,y
     enddo
  enddo
  close(30)
end program read_stream
==================================================================


As you can see, the patch seems to work when writing (54 --> 5...) but not
when reading (1m46 --> 1m45...)


Cheers,

   Angelo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]