Dan,
Try subroutine file_size8@ (character*():File_name, real8:size, integer*2:error_code)
I have now tested both internal read and write, based on mecej4's approach. The performance times are:
fmtread
ftn95 /opt /link : 1.126 seconds
ftn95 /64 /link : 0.698 seconds
gfortran /o2 : 6.238 seconds ##
intlread
ftn95 /opt /link : 0.229 seconds
ftn95 /64 /link : 0.410 seconds
gfortran /o2 : 0.260 seconds
fmtwrite
ftn95 /opt /link : 3.120 seconds
ftn95 /64 /link : 9.457 seconds ##
gfortran /o2 : 40.322 seconds ##
intlwrite
ftn95 /opt /link : 1.513 seconds
ftn95 /64 /link : 1.803 seconds
gfortran /o2 : 0.286 seconds
These tests show that formatted write with ftn95 /64 is 3x slower than 32 bit and also 5x slower than a user written function. It would be good if this could be reviewed.
gFortran 64bit formatted write is worse, being 140x slower than a user written function, with little chance of a review there. the write test is: program IntlWrite implicit none character(len=100) :: str integer :: i,j,n real, dimension(10) :: x real del_sec, sec external del_sec ! ! Initialise vector sec = del_sec (0) do i = 1,10 x(i) = 3.0i-7.679 end do write (,'(10F10.3)')(-7.679+3i,i=1,10) ! ! Formatted write sec = del_sec (0) do j=1,1000000 x(3) = 3.0/j-7.679 write (str,'(10F10.3)') x if (mod(j,100000).eq.0) write (,) del_sec (-1), j, x(3) end do sec = del_sec (0) write (,) sec,' seconds : format write' ! x(4) = -.00025 x(5) = 0 x(6) = .00065 ! do j=1,1000000 x(3) = (3.0/j-.07679) do n=1,10 call write_val_r4 ( x(n), str(n10-9:n10), 3 ) end do if (mod(j,100000).eq.0) write(,) del_sec (-1), j, x(3) end do sec = del_sec (0) write (,) sec,' seconds : function write' write (,*) str ! end program
real*4 function del_sec (update)
!
integer*4 :: update
integer*8 :: last_tick = 0
integer*8 :: tick, rate
real*4 :: dt
!
call system_clock ( tick, rate )
dt = real(tick-last_tick) / real(rate)
if ( update >= 0 ) last_tick = tick
del_sec = dt
end function del_sec