Consider the following program: program kl integer i,j,k integer, parameter :: m = 1000, n = 387 real x(m,n) x = 1.e0 inquire(iolength=k) (x(i,1), i=1, m) open(unit=1, file='foo.dat', access='direct', recl=k) do j = 1, n write(1,rec=j) (x(i,j), i=1, n) end do close(1) end program kl
We find the following performance on multiple executions. kargl[225] rm foo.dat kargl[227] gfc40 -static -o z kl.f90 kargl[228] time ./z 0.11 real 0.05 user 0.05 sys kargl[229] time ./z 29.44 real 0.36 user 28.13 sys kargl[230] time ./z 28.77 real 0.25 user 28.07 sys kargl[231] rm foo.dat kargl[232] gfc41 -static -o z kl.f90 kargl[233] time ./z 0.23 real 0.06 user 0.05 sys kargl[234] time ./z 0.11 real 0.05 user 0.06 sys kargl[235] time ./z 0.11 real 0.03 user 0.08 sys Here gfc40 is an unpatched gfortran from 4.0.1, and gfc41 is a patched gfortran from HEAD. Now, image the performance if m = 1080 and n = 25000. Oh, the inhumanity! See attached patch for suggested fix. -- Summary: Really, really, horrible IO performance Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: libfortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kargl at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21820