NAG Fortran Library 1 3 2 NAG 3 3 4 3.1........................................... 4 3.1.1........................................ 5 3.1.2................................. 5 3.2......................................... 6 3.3................................. 6 3.3.1........................................ 6 3.3.2 NAG Fortran........................................ 7 3.3.3...................... 8 3.4 ifail........................................ 8 3.4.1................................... 8 3.4.2 ifail............................................. 9 3.4.3 Hard Fail....................................... 9 3.4.4 Soft Fail....................................... 10 3.4.5 NAG................................. 10 3.4.6........................................ 10 3.5......................................... 11 3.6................................ 11 3.7........................................... 12 3.8............................................ 12 3.9........................................... 12 3.10................................. 12 3.11...................................... 13 3.11.1 Bit-wise Reproducibility BWR.................. 15 3.11.1.1 Conditional BWR CBWR. 15 3.12............................................ 16 essint.1
NAG Library Manual 3.12.1......................................... 16 3.12.1.1................................ 16 3.12.1.2............................................ 18 3.12.1.3....................................... 18 3.12.2.............................................. 18 3.12.2.1..................................... 18 3.12.2.2 NAG?................... 20 3.12.3......................................... 21 4 22 4.1........................................... 22 4.2......................................... 22 4.3.............................................. 23 4.3.1............................................ 23 4.3.2........................................ 24 4.3.3............................................. 25 4.4............................................. 26 4.5 Example...................................... 27 4.6....................................... 27 4.6.1 HTML............................................ 27 4.6.1.1 HTML5.................................. 27 4.6.1.2 Firefox Mozilla....................... 28 4.6.1.3...................................... 28 4.6.1.4 HTML5.................................. 28 4.6.1.5 HTML5.................................. 29 4.6.1.6 Windows HTML.................................. 29 4.6.2 PDF............................................. 29 4.6.2.1 PDF................................. 29 4.6.2.2 PDF.................................... 29 5 NAG 29 6 NAG 30 7 30 essint.2
1 Mark Mark 26.1 Mark a00aaf Use nag_library, Only: a00aaf Call a00aaf End nag_example a00aaf Example *** Start of NAG Library implementation details *** Implementation title: Linux, 64-bit, NAG Fortran (32-bit integers) Precision: FORTRAN double precision Product Code: FLL6A2619L Mark: 26.1 (self-contained) *** End of NAG Library implementation details *** 2 NAG NAG (a) (b) Keyword and GAMS Search Chapter Routine (c) Chapter Introduction (d) Routine Document (b) (e) Users Note (f) (g) Example 4.5 essint.3
NAG Library Manual (a) (g) Chapter Introduction Routine Document Users Note 3 3.1 NAG Routine Chapter 3 D01 - Quadrature H S 1 ACM SHARE ACM (1960 1976) 6 c06pcf 2 3 O 0 f D03 E04 f a a f a f F06 Basic Linear Algebra Subprograms, BLAS Dongarra et al. (1988) Dongarra et al. (1990) NAG BLAS f06paf dgemv BLAS F16 BLAS The BLAS Technical Forum Standard (2001) Blackford et al. (2002) F16 NAG BLAS F07 LAPACK F08LAPACK LAPACK Anderson et al. (1999) F01 LAPACK BLAS essint.4
NAG LAPACK f07adf dgetrf Chapter Introduction BLAS/LAPACK NAG f06paf f07adf BLAS LAPACK dgemv dgetrf 3.1.1 Experimental Note (a) Mark (b) 3.1.2 6 nagf_ Chapter Contents D01 Quadrature nagf_quad_ F07 F08 lapack BLAS/LAPACK nagf_blas_dgemm BLAS/LAPACK 3.1 BLAS/LAPACK dgemm a f f old f a NAG nag_library Use Fortran 3.3.1 essint.5
NAG Library Manual 3.2 NAG (a) (b) (c) Foreword (a) (c) (b) (c) 3.3 Fortran 3.10 Arguments entry exit 4.3 2 nag_library Use KIND=nag_wp INTENT COMMON NAG 3 NAG COMMON 3.3.1 Fortran Use nag_library essint.6
s17aef BesselJ0 Use nag_library, Only: s17aef Use nag_library, Only: BesselJ0 => s17aef BesselJ0 s17aef d02ejf Subroutine BDFsolve(xend,y) Use nag_library, Only: nag_wp, d02ejf, d02ejw, d02ejx, d02ejy Real(kind=nag_wp) :: xend, y(:) Real(kind=nag_wp) :: tol, xstart INTEGER :: ifail, iw, n Character :: relabs Real(kind=nag_wp), Allocatable :: w(:) n = Size(y) tol = 1.0e-3_nag_wp relabs = M iw = (12+n)*n + 50 Allocate(w(iw)) ifail = 0 xstart = 0.0_nag_wp Call d02ejf(xstart,xend,n,y,fcn,d02ejy,tol,relabs,d02ejx, & d02ejw,w,iw,ifail) Return End Subroutine BDFsolve Call BDFsolve(xend,y) 3.3.2 NAG Fortran NAG nag_library NAG nag_wp Use essint.7
NAG Library Manual Use nag_library.mod 3.3.3 (i) (ii) irevcm irevcm 3.4 ifail 3.4.1 3 (i) (ii) (iii) essint.8
3 3.7 3.8 3.9 6 Error Indicators and Warnings 3.4.2 ifail ifail ifail ifail 2 (i) (ii) (i) ifail ifail (ii) ifail 0 hard fail 1 1 soft fail ifail 0 hard fail soft fail ifail 1 0 1 ifail 1 3.4.3 Hard Fail ifail 0 ** ABNORMAL EXIT from NAG Library routine XXXXXX: ifail = n ** NAG hard failure - execution terminated XXXXXX n XXXXXX 6 hard fail hard fail essint.9
NAG Library Manual 3.4.4 Soft Fail ifail 1 1 ifail ifail ifail 1 ifail 1 silent exit ifail 1 noisy exit ** ABNORMAL EXIT from NAG Library routine XXXXXX: ifail = n ** NAG soft failure - control returned XXXXXX n XXXXXX 6 soft fail ifail ifail 0 ifail 9 Example ifail soft fail hard fail 2 (i) (ii) 6 3.4.5 NAG value 3.4.6 Mark 7 Mark 8 ifail X04 ifail essint.10
100c + 10b + a a b 0 1 a = 0: hard failure b = 0: silent exit a = 1: soft failure b = 1: noisy exit 3.5 logical error message unit 6 x04aaf logical advisory message unit 6 x04abf E04, E05, H OPEN OS 3.6 NAG Z Y g13afz g13aff essint.11
NAG Library Manual 2 3 50 E04 e54nfu e54nfu e04nfa qphess e04nff e04nfu 3.7 ifail = 999 3.8 a00acf Example ifail = 399 Unix NAG_KUSARI_FILE NAG 3.9 ifail ifail ifail = 99 3.10 C Visual Basic NAG NAG C C Fortran Example NAG DLL Visual Basic, Visual Basic essint.12
for Applications (Excel), Fortran, C, C++ NAG DLL Users Note NAG 3.11 NAG 16 2 8 10 IEEE ANSI/IEEE (1985) 1980 NAG IEEE 2 IEEE 80-bit 1980 Intel 8087 64-bit IEEE NAG NAG SIMD SSE SSE 128-bit SSE 64-bit 32-bit essint.13
NAG Library Manual SSE SSE 16 NAG SSE n x y s = x 1 y 1 + x 2 y 2 + x 3 y 3 + + x n y n s = (x 1 y 1 + x 3 y 3 ) + (x 2 y 2 + x 4 y 4 ) + AVX 256-bit 512-bit AVX 32 NAG NAG NAG essint.14
NAG NAG 3.11.1 Bit-wise Reproducibility BWR 32-bit 64-bit a + (b + c) (a + b) + c IEEE 754 32-bit 2 24 +(1 2 24 ) = 1 (2 24 +1) 2 24 = 0 IEEE 754 32-bit 23 2 24 + 1 = 2 24 BWR 1. Windows Linux 2. CPU Intel AMD Intel Sandy Bridge Intel Ivy Bridge 3. 4. BWR (a) (b) CPU SSE3 SSE4 AVX (c) (a) (b) SSE SIMD BWR 3.11.1.1 Conditional BWR CBWR NAG NAG BWR CBWR BWR NAG CBWR essint.15
NAG Library Manual NAG CPU BWR 3.12 3.12.1 OpenMP 3.12.2 NAG Fortran Library COMMONSAVE 8 Thread Unsafe Routines NAG Fortran Library 5 e04ucf e04uca f a e04uca 3.12.1.1 iuser ruser a f a iuser ruser a iso_c_binding Type (c_ptr) cpuser iuser ruser essint.16
Module mymodule Use iso_c_binding, Only: c_f_pointer, c_ptr Private Public :: myfun Type, Public :: mydata Integer :: nx Real (Kind=nag_wp), Allocatable :: x(:) End Type mydata Contains Subroutine myfun(...,iuser,ruser,cpuser) Type (c_ptr), Intent (In) :: cpuser Type (mydata), Pointer :: md Call c_f_pointer(cpuser,md)... Use md%x and md%nx... End Subroutine myfun End Module mymodule... Program myprog Use mymodule, Only: myfun,mydata Use iso_c_binding, Only: c_loc, c_ptr Type (c_ptr) :: cpuser Type (mydata), Target :: md... md%nx = 1000 Allocate (md%x(md%nx)) cpuser = c_loc(md)... call nagroutine(...,myfun,cpuser,iuser,ruser,ifail)... End Programe e04stf 10 OpenMP threadprivate essint.17
NAG Library Manual NAG NAG iuser ruser X06 OpenMP 3.12.1.2 NAG x04aaf x04abf SAVE NAG soft failure ifail 1 3.4 ifail 3.12.1.3 BLAS NAG 3.12.2 3.12.2.1 NAG NAG CPU parallel speedup essint.18
n n 1 n scalability (a) (b) Amdahl s law r s = 1 r n S n 1 S n ( ) s + r n 4 1 4 n S n 4 NAG OpenMP 3.12.2.2 OpenMP fork join OpenMP nested parallelism essint.19
NAG Library Manual 3.11 3.12.2.2 NAG? NAG OpenMP NAG OpenMP NAG 8 NAG 1. NAG OpenMP NAG NAG OpenMP NAG NAG 2. NAG BLAS LAPACK NAG NAG NAG 3.12.3 OpenMP NAG OpenMP forkjoin fork join OpenMP orphaned directive 8 NAG OpenMP NAG OpenMP OpenMP NAG NAG X06 NAG NAG nested parallelism NAG fork join essint.20
NAG NAG OpenMP NAG NAG NAG BLAS LAPACK OS Dense and Sparse Linear Algebra FFTs Random Number Generators Quadrature Partial Differential Equations Interpolation Curve and Surface Fitting Correlation and Regression Analysis Multivariate Methods Time Series Analysis Financial Option Pricing Global Optimization Wavelets 3.12.3 NAG OpenMP FL FS 8 NAG Multithreaded Routines BLAS LAPACK NAG essint.21
NAG Library Manual BLAS LAPACK NAG NAG 4 4.1 NAG Library Manual, Mark 26 NAG Fortran Introduction Mark 26 NAG Fortran Library News Mark Mark Advice on Replacement Calls for Withdrawn/Superseded Routines Keyword and GAMS Search Keyword Search Chapter Introduction Routine Document Example Example 4.2 Introduction essint.22
Chapter Contents - D01 (quad) Chapter Contents Chapter Introduction - D01 (quad) Chapter Introduction Routine Documents - A a f 10 1. Purpose 2. Specification 3. Description 4. References 5. Arguments 4.3 6. Error Indicators and Warnings 7. Accuracy 8. Parallelism and Performance 9. Further Comments 10. Example 4.5 E04, E05, H 3 11. Algorithmic Details 12. Optional Parameters 13. Description of Monitoring Information 11. 13. Optional Parameters 11. 4.3 Specification C C++ NAG C d03pdf/d03pda 2 C Fortran d03faf d03faf_ a d03pda d03pda_ 5 4.3.1 Input exit essint.23
NAG Library Manual Output Input/Output Workspace Communication Array External Procedure Input entry Output exit Input/Output entry exit 3.6 User Workspace Dummy 4.3.2 Constraint: Constraints: Constraint: n > 0 n = 0 ifail 0 3.4 Character Constraint: check = n Character essint.24
Mark Suggested value: 4.3.3 Fortran adjustable dimensions Subroutine <name> (m, n, a, b, ldb) Integer m, n, a(n), b(ldb,n), ldb a 1 a(n) - Integer array n n b 2 b(ldb,n) - Integer array On entry m n B ldb ldb - Integer On entry <name> b 1 Constraint ldb m m b 1 ldb m ldb 2 n N essint.25
NAG Library Manual Integer aa(100), bb(100,50) or Integer Allocatable :: aa(:), bb(:,:) ldb = 100 Integer :: m, n, ldb...... m = 80 Read(5,*) M, N n = 20 ldb = m Call <name>(m,n,aa,bb,ldb) Allocate (aa(m),bb(ldb,n)) Call <name>(m,n,aa,bb,ldb) NAG assumed size Integer a(*), b(ldb,*) Allocatable NAG Fortran 4.4 machine precision 10 16 machine precision 10 16 machine precision x02ajf X02 X02 Chapter Introduction block size F07 F08 work lwork Users Note Mark machine-readable X02 3.5 essint.26
nag_rp (reduced precision) nag_wp (basic precision) nag_hp (additional precision) 4.5 Example 10 Example Example machine-readable Example NAG Users Note Example Example Example Example 4.6 HTML - HTML, SVG, MathML PDF PDF - PDF HTML PDF PDF - PDF PDF Windows HTML - Windows HTML 4.6.1 HTML 4.6.1.1 HTML5 W3C HTML MathML SVG CSS essint.27
NAG Library Manual 4.6.1.2 Firefox Mozilla Firefox 4 Firefox HTML MathML STIX OpenType Firefox MathML http://www.mozilla.org/projects/mathml/fonts/ 4.6.1.3 Firefox javascript MathML MathJax javascript http://www.mathjax.org MathJax Firefox http://docs.mathjax.org/en/latest/installation.html MathJax../styles/nagmathml.js http://cdn.mathjax.org/mathjax/latest/ 4.6.1.4 HTML5 html/frontmatter/manconts.html HTML PDF PDF black green grey pale blue navy blue red pink purple royal blue NAG URL ifail HTML Example Example essint.28
4.6.1.5 HTML5 HTML5 4.6.1.6 Windows HTML Windows HTML HTML5 Windows HTML MathJax Microsoft Windows 4.6.2 PDF 4.6.2.1 PDF Adobe Acrobat Reader http://www.adobe.com/reader Acrobat Reader Acrobat Reader xpdf ghostview PDF http PDF Acrobat Adobe Acrobat 4.6.2.2 PDF PDF PDF PDF HTML PDF Acrobat PDF PDF PDF 5 NAG NAG NAG Ford (1982), Ford et al. (1979), Ford and Pool (1984), Hague et al. (1982) essint.29
NAG Library Manual 6 NAG NAG ISO Fortran 95 (1997), ANSI (1966), ANSI (1978), ANSI/IEEE POSIX (1995), Basic Linear Algebra Subprograms Technical (BLAST) Forum (2001) 7 ACM (1960 1976) Collected algorithms from ACM index by subject to algorithms Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (1999) LAPACK Users Guide (3rd Edition) SIAM, Philadelphia http://www.netlib.org/lapack/lug ANSI (1966) USA standard Fortran Publication X3.9 American National Standards Institute ANSI (1978) American National Standard Fortran Publication X3.9 American National Standards Institute ANSI/IEEE (1985) IEEE standard for binary floating-point arithmetic Std 754-1985 IEEE, New York ANSI/IEEE POSIX (1995) POSIX Standard Thread Library ANSI/IEEE POSIX 1003.1c:1995 Basic Linear Algebra Subprograms Technical (BLAST) Forum (2001) Basic Linear Algebra Subprograms Technical (BLAST) Forum Standard University of Tennessee, Knoxville, Tennessee http://www.netlib.org/blas/blast-forum/blas-report.pdf Blackford L S, Demmel J, Dongarra J J, Duff I S, Hammarling S, Henry G, Heroux M, Kaufman L, Lumsdaine A, Petitet A, Pozo R, Remington K and Whaley R C (2002) An updated set of Basic Linear Algebra Subprograms (BLAS) ACM Trans. Math. Software 28 135 151 Dongarra J J, Du Croz J J, Duff I S and Hammarling S (1990) A set of Level 3 basic linear algebra subprograms ACM Trans. Math. Software 16 1 28 Dongarra J J, Du Croz J J, Hammarling S and Hanson R J (1988) An extended set of FORTRAN basic linear algebra subprograms ACM Trans. Math. Software 14 1 32 Ford B (1982) Transportable numerical software Lecture Notes in Computer Science 142 128 140 Springer Verlag Ford B, Bentley J, Du Croz J J and Hague S J (1979) The NAG Library machine Softw. Pract. Exper. 9(1) 65 72 Ford B and Pool J C T (1984) The evolving NAG Library service Sources and Development of Mathematical Software (ed W Cowell) 375 397 Prentice Hall Hague S J, Nugent S M and Ford B (1982) Computer-based documentation for the NAG Library Lecture Notes in Computer Science 142 91 127 Springer Verlag essint.30
ISO Fortran 95 (1997) ISO Fortran 95 programming language (ISO/IEC 1539 1:1997) OpenMP The OpenMP Specification for Parallel Programming http://www.openmp.org The BLAS Technical Forum Standard (2001) http://www.netlib.org/blas/blast-forum essint.31 (last)