⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mod2ci.f

📁 网络带宽测试工具
💻 F
字号:
      Program mod2ci! ----------------------------------------------------------------------! **********************************************************************! *** This program is part of the Euroben Benchmark                  ***! ***                                                                ***! *** Copyright: EuroBen Group p/o                                   ***! ***            Utrecht University, Computational Physics Dept.     ***! ***            P.O. Box 80.000                                     ***! ***            3508 TA Utrecht                                     ***! ***            The Netherlands                                     ***! ***                                                                ***! *** Author of this program: Aad van der Steen                      ***! *** Date                    Summer 2005                            ***! **********************************************************************! ----------------------------------------------------------------------! --- Version 1.0 (Shared-memory parallel, OpenMP).! --- Purpose of program mod2ci! -----------------------------! --- Solver for sparse linear systems with iterative methods and!     one type of preconditioner. The systems are not actually!     solved but rather a predifined number of iterations is performed!     to assess the speed of the solver-preconditioner combination.!     Two types of systems are considered:!     1. - Systems stemming from 3-D finite difference problems!          resulting in 7-banded matrices. We consider only the!          symmetric type in ANOTHER program: 'mod2cr'.!     2. - Finite element type, irregularly filled matrices.!          They are stored in CRS format. In this program 'mod2ci' we!          only look at non-symmetric matrices and their solution!          methods.!! --- In this Program 'mod2ci' we address the irregular, FEM type!     of problem. For the regular 7-band matrix-based type we have!     program 'mod2cr'.!!     Solvers used:!     -  For the symmetric banded systems in 'mod2cr': CG with ILU(0)!        and polynomial preconditioning.!     -  For irregular systems in 'mod2ci': RGMRES and TFQMR with!        polynomial preconditioning.! ----------------------------------------------------------------------      Use                       numerics      Use                       floptime      Implicit                  None      Integer, Allocatable   :: indx(:), rowp(:)      Real(l_), Allocatable  :: matvals(:), b(:), q(:), x(:)      Real(l_)               :: corr, maxdf, mindf, res      Real(l_)               :: frac, mflops, resnrm, time      Integer, Parameter     :: m = 1, maxit = 50      Real(l_), Parameter    :: tol = 1.0e-10_l_      Real(l_), Parameter    :: micro = 1.0e-6_l_, two = 2.0_l_,     &                          perc = 1.0e2_l_      Real(l_)               :: gamma(m+1)      Integer                :: i, ncols, nrows, nelmts, nrep      Integer                :: nprocs, omp_get_num_threads      Logical                :: ok      External               :: lpolyn! ----------------------------------------------------------------------      Call state( 'mod2ci  ' )!$omp parallel shared(nprocs)      nprocs = omp_get_num_threads()!$omp end parallel      Open( 1, File = 'mod2ci.in' )      Print 1000, nprocs! ----------------------------------------------------------------------! --- Do case with GMRES and polynomial preconditioning.       Print 1005   10 Read( 1, *, End = 20 ) ncols, nrows, nelmts, nrep         Allocate( indx(nelmts), rowp(nrows+1), matvals(nelmts),     &             b(ncols), q(nrows), x(nrows) )         Call getmatvec( nrows, nelmts, indx, rowp, matvals, b )         Call pcoefs( m, gamma )         q = 1.0_l_         flops = 0         time = wclock()         Do i = 1, nrep            x = 0.0_l_            resnrm = -1.0_l_            Call rgmres( nrows, nelmts, m, indx, rowp, matvals, q, x, b,     &                   gamma, maxit, tol, resnrm, lpolyn )         End Do         time = wclock() - time         mflops = micro*Real( flops, l_ )/time         time   = time/Real( nrep, l_ )         frac   = perc*Real( nelmts, l_ )/Real( ncols*nrows, l_ )         Print 1010, ncols, nrows, frac, time, mflops, resnrm         Deallocate( indx, rowp, matvals, b, q, x )      Go To 10   20 Print 1020      Print 1025! ----------------------------------------------------------------------! --- Do case with TFQMR and polynomial preconditioning.       Rewind 1      Print 1030, nprocs      Print 1005   30 Read( 1, *, End = 40 ) ncols, nrows, nelmts, nrep         Allocate( indx(nelmts), rowp(nrows+1), matvals(nelmts),     &             b(ncols), q(nrows), x(nrows) )         Call getmatvec( nrows, nelmts, indx, rowp, matvals, b )         Call pcoefs( m, gamma )         q = 1.0_l_         flops = 0         time = wclock()         Do i = 1, nrep            x = 0.0_l_!           resnrm = -1.0_l_            Call tfqmr( nrows, nelmts, m, indx, rowp, matvals, q, x, b,     &                  gamma, maxit, tol, resnrm, lpolyn )         End Do         time = wclock() - time         mflops = micro*Real( flops, l_ )/time         time   = time/Real( nrep, l_ )         frac   = perc*Real( nelmts, l_ )/Real( ncols*nrows, l_ )         Print 1010, ncols, nrows, frac, time, mflops, resnrm         Deallocate( indx, rowp, matvals, b, q, x )      Go To 30   40 Print 1020! ---------------------------------------------------------------------- 1000 Format( 'Program mod2ci: Sparse iterative solver test'/     &        'Non-symmetric, CRS: RGMRES with polyn. preconditioner.'/     &        'No. of procs. = ', i3 ) 1005 Format( '-------------------------------------------------------',     &        '-----------'/     &        ' #Rows | #Cols | %Fill |   Time(s)   |   Mflop/s   |   R'     &        'esidue   |'/     &        '-------------------------------------------------------',     &        '----------|' ) 1010 Format( i7, '|', i7, '|', f6.2, ' |', g13.5, '|', g13.5, '|',     &        g13.5, '|' ) 1020 Format( '-------------------------------------------------------',      &        '-----------' ) 1025 Format ( / ) 1030 Format( '-------------------------------------------------------',     &        '-----------'/     &        'Program mod2ci: Sparse iterative solver test'/     &        'Non-symmetric, CRS: TFQMR with polyn. preconditioner.'/     &        'No. of procs. = ', i3 )! ----------------------------------------------------------------------      End Program mod2ci

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -