📄 mod2as.f
字号:
Program mod2as! ----------------------------------------------------------------------! **********************************************************************! *** This program is part of the EuroBen Benchmark ***! *** ***! *** Copyright: EuroBen (European Benchmark Group) ***! *** Distribution by: ***! *** Utrecht University, Computational Physics Dept. ***! *** P.O. Box 80.000 ***! *** 3508 TA Utrecht ***! *** The Netherlands ***! *** ***! *** Author of this program: Aad van der Steen ***! *** Contributed Winter 2002 ***! *** Last Modified January 2003 by Aad van der Steen ***! *** (To incorporate OpenMP) ***! **********************************************************************! Version 4.0!! --- Sparse Matrix-vector product from a CRS format matrix.! The vector to be multplied with and the result vector are assumed! to be full.! ---------------------------------------------------------------------- Use numerics Implicit None Integer, Allocatable :: indx(:), rowp(:) Real(l_), Allocatable :: matvals(:), invec(:), outvec(:) Real(l_) :: wclock, time, mflops Real(l_), Parameter :: MICRO = 1.0e-6_l_, TWO = 2.0_l_, & PERC = 1.0e2_l_ Integer :: ncols, nprocs, nrows, nelmts Integer :: omp_get_num_threads Logical :: ok! ---------------------------------------------------------------------- Call state( 'mod2as ' ) Open( 1, File = 'mod2as.in' )!$omp parallel shared(nprocs) nprocs = omp_get_num_threads()!$omp end parallel Print 1000, nprocs 10 Read( 1, *, End = 20 ) ncols, nrows, nelmts Allocate( indx(nelmts), rowp(nrows), matvals(nelmts), & invec(ncols), outvec(nrows) ) Call getmatvec( ncols, nrows, nelmts, indx, rowp, matvals, & invec ) time = wclock() Call spmxv( nrows, nelmts, indx, rowp, matvals, invec, & outvec ) time = wclock() - time mflops = TWO*MICRO*Real( nelmts, l_ )/Max( time, 1.0e-9_l_ ) ok = .TRUE. Call check( ncols, nrows, nelmts, indx, rowp, outvec, ok ) Deallocate ( indx, rowp, matvals, invec, outvec ) Print 1010, nrows, ncols, & PERC*Real( nelmts, l_ )/Real( nrows*ncols, l_ ), & time, mflops, ok Go To 10! ---------------------------------------------------------------------- 20 Print 1020! ---------------------------------------------------------------------- 1000 Format( 'Program mod2as: Sparse (CRS) Matrix-vector Multiply:'/ & 'No. of procs. = ', i3/ & '-------------------------------------------------------'/ & ' #Rows | #Cols | %Fill | Time(s) | Mflop/s |OK|'/ & '------------------------------------------------------|') 1010 Format( i7, '|', i7, '|', f6.2, ' |', g13.5, '|', g13.5, '|', l, & '|' ) 1020 Format( '-------------------------------------------------------') ! ---------------------------------------------------------------------- End Program mod2as
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -