I/O performance blues
Salvatore Filippone
filippone.salvatore@gmail.com
Mon Nov 25 18:43:00 GMT 2013
HI Jerry,
Thanks.
Salvatore
Source code sent offlist
On Mon, Nov 25, 2013 at 6:58 PM, jvdelisle <jvdelisle@charter.net> wrote:
> When I have some time in the next few weeks, I will take a look at your
> example.
>
> Regards,
>
> Jerry
>
>
>
> -------- Original message --------
> From Salvatore Filippone <filippone.salvatore@gmail.com>
> Date: 11/25/2013 6:31 AM (GMT-08:00)
> To gfortran <fortran@gcc.gnu.org>
> Subject I/O performance blues
>
>
> Hello
> In the last few days I have investigated a rather disappointing
> phenomenon related to I/O.
> The Harwell-Boeing storage format is a rather well-known format for
> storing matrix data on file; sample codes and pointers to further
> documentation are available at http://math.nist.gov/MatrixMarket/
>
> The input is via read statements as follows
> ==================================================
> open(infile,file=filename, status='OLD', err=901, action='READ')
>
> read (infile,fmt=fmt10) mtitle_,key,totcrd,ptrcrd,indcrd,valcrd,rhscrd,&
> & type,nrow,ncol,nnzero,neltvl,ptrfmt,indfmt,valfmt,rhsfmt
> if (rhscrd > 0) read(infile,fmt=fmt11)rhstype,nrhs,nrhsix
> allocate(icp(ncol+1),ia(nnzero),val(nnzero),stat=ircode)
> if (ircode /= 0 ) then
> write(*,*) 'Memory allocation failed'
> goto 993
> end if
>
> read (infile,fmt=ptrfmt) (icp(i),i=1,ncol+1)
> read (infile,fmt=indfmt) (ia(i),i=1,nnzero)
> if (valcrd > 0) read (infile,fmt=valfmt) (val(i),i=1,nnzero)
>
> close(infile)
> ===================================================
> Now, at the Matrix Market site there is an alternative implementation
> of this I/O in C.
> It turns out the C version consistently outperforms the Fortran version!!
>
> [sfilippo@epsilon testhb]$ ./test_hbrd
> File name?
> ultrasound80.hb
> Reading from matrix file: ultrasound80.hb
> nrows: 531441 ncols: 531441 nnzeros: 33076161
> C Time read for ultrasound80.hb: 18.724172830581665
> Fortran Time read for ultrasound80.hb: 33.051491975784302
> [sfilippo@epsilon testhb]$ ./test_hbrd
> File name?
> thm_6814k.hb
> Reading from matrix file: thm_6814k.hb
> nrows: 6813804 ncols: 6813804 nnzeros: 33930324
> C Time read for thm_6814k.hb: 19.886425018310547
> Fortran Time read for thm_6814k.hb: 38.642944097518921
> [sfilippo@epsilon testhb]$ ./test_hbrd
> File name?
> pde-50.hb
> Reading from matrix file: pde-50.hb
> nrows: 125000 ncols: 125000 nnzeros: 860000
> C Time read for pde-50.hb: 0.32523894309997559
> Fortran Time read for pde-50.hb: 0.78256392478942871
> ====================================================
> This is with current trunk; I have seen fluctuations in the exact
> timings when trying 4.6.4/4.7.3/4.8.2 but the overall picture is
> pretty much the same.
>
> I have the full test program and many input cases available; is
> anybody familiar with the IO in gfortran and willing to take a look?
> And/or give me any suggestions where to look for clues and how? Should
> I open a PR?
>
>
> Thanks a lot
> Salvatore
More information about the Fortran
mailing list