<<

i i book 2013/10/1 page 239 i i

Index

accessor-mutator routine Blue’s example in a module, 7 constants required for, 106 PUBLIC or PRIVATE l2 norm, 105 components, 6 book code on SIAM web site ACM, ix Airy functions, 29, 227 editors of CALGO, ix BlasModule,26 Adams, Brainerd et al., see books, C and Fortran Fortran reference interlanguage use, 117, 229 Airy’s equation c dgemm, 121 boundary value problem, C saxpy, 120 145–149 cdgemm, 121 connection formulas, 30 classes, 47, 228 w − zw =0,30 coarray examples, 163, 168 testing, 33 copyString, 122 assignment overloading cSam, 125 accumulating triplet list, 39 csaxpy, 119 accumulation csaxpyval, 120 data fitting, 142 csyscall, 127 finite elements, 148 dfetrf ,14 clearing storage dfetrs,14 Harwell–Boeing (HB) format, dgemm, 121 137 dgemv,26 one-time LU factoring, 132 dnrm2,26 saving LU factors, 132 dnrm2 support, 106 sparse add, +, 44 errnorm,93 ASSOCIATE symbol, => exampleLapackInterface,27 example, in module, 6 exceptions, 101, 228 Association for Computing Machinery, funptrs, 125 see ACM LAPACK example, 14, 227 LapackInterface,25 benchmarking, 197 MPI interface, 151, 229 BLAS, 14,103,113,143,227 nonintrinsic modules called from C, 119–121, 129–130 IEEE ARITHMETIC.f90, 228 interface for, 25–27 IEEE EXCEPTIONS.f90, 228 library building, 17–18 IEEE FEATURES.f90, 228

239

i i

i i i i book 2013/10/1 page 240 i i

240 Index

normalPdf ,94 CALGO, see ACM OpenMP examples, 169, 229 coarray, see also MPI PtrArray, 123 allocatable arrays, 165 qag, 51, 90 codimensions, 164 qag2003, 77, 89 coindex, 164 qag2003s, 77, 90 corank, 164 qag2003v, 77, 90 critical {...} end critical, 168 qkgens,90 data communication, qkgenv,90 Fortran 2008 example, 164 QUADPACK, 71, 228 example of computing π QUADPACK documentation, with quadrature, 166 89, 228 example of matrix-vector products, quadpack2003,91 167 quicksort, 57, 228 image index, 166 saxpy, 119, 120 images, 163 ,21 new convention for subscripts, 163 sparse defined operation, 35, 228 num images, 165, 166 sparse matrix applications, 141, rationale, 163 229 specifying data objects, 164 sparse system solves, 131, 229 sync all, 166 syscall, 127 this image, 165, 166 zeroin, 53, 55 code conversion books regression testing, 182 Fortran reference, x Collected from ACM Adams, Brainerd et al., x (CALGO), see ACM Fortran 77 standard, x compiler options Fortran 90 standard, x checking array bounds, 206 Metcalf, Reid, and Cohen, x checking deleted and obsolete features, 207, 213 C checking unassigned variables, interoperability, also see Fortran, mod- 206 ern features checking unused variables, 206 matching array indexing, 123 deleted and obsolescent features, matching data types, 119 181 matching Fortran COMMON, optimization level, 209 C global data, 125 performance and debugging level, matching pointers to C functions, 208 125 performance and optimization level, matching structs and derived 212 types, 124 name mangling, 120 data to user routines rationale, 117 COMMON blocks, 51 saxpy, C calls example, classes as arguments, 51 by reference, by value, 120 example, zeroin,55 string conversion, 122 module variables, 51 interoperability for MPI, 151 thread-safe, 51

i i

i i i i book 2013/10/1 page 241 i i

Index 241

defined operation equivalence partitioning, 198 .ip., .pi., superLU, solves, 132 .p., .ip., assignment Fortran Airy’s equation, statement functions, 211 boundary value problem, 145 Fortran development least-squares, rationale, ix piecewise linear, 142 Fortran optimization clearing storage algorithm choice, 212 interior of SuperLU , 137 memory access, 211 INTENT(IN), operands, 132 MPI and coarrays, 212 parsing precedence, 42 OpenMP, 212 use of parentheses, 45 Fortran standards, see books, Fortran ref- sparse matrix add, +, 42, 43 erence sparse matrix product, *, .p., Fortran, modern features, 42, 45 see assignment overloading sparse matrix solve, .ip., .pi., 131 see data to user routines sparse matrix , .t., see defined operation see deleted features 42, 45 see derived types, classes deleted features see generic names, subprograms ASSIGN label, see IEEE standard GO TO assigned label, 187 see object-oriented END IF with label, 187 see obsolescent features nH or hollerith see procedures, type-bound edit descriptors, 187 see QUADPACK PAUSE, 187 see recursion REAL loop variables, 187 allocating with problem size derived types example, 19 class procedures, 63–64 ASSOCIATE symbol, 4 example, in module, 6 avoiding name clashes, 27 Dijkstra quote on testing, 193 CASE statement documentation computed-GO TO, 2, 184–185 arguments comments, inline, 2 input type, kind, and , 92 example, 3 output, 93 compilation units example, CALL qag2003(),95 functions, 13 modules, derived types main programs, 13 PUBLIC objects, 90 modules, 13 QUADPACK use, subroutines, 13 example, 90 compiler analysis, 210 routines called, 90 continuation lines user function useofsymbol&,3 interface, 91 derived type, xi recommended packaging, 94 component separator, %, 5 variable dictionary, 89 often a C structure, also a writing style, 89 record, 5

i i

i i i i book 2013/10/1 page 242 i i

242 Index

PUBLIC or PRIVATE components, Fortran intrinsic modules see modules, packaging IEEE ARITHMETIC, 102, 111, dusty decks, 212 113 early optimization, 209 IEEE EXCEPTIONS, 102, 111 gfortran, compiler, 14 IEEE FEATURES, 102, 111–112 INCLUDE ISO C BINDING, 119–128, 136 file, 9–10, 32–33 Kahan, William, 102, 105 templates, 31–32 overflow and underflow interfaces, 24 setting flags, 109 defining a module procedure, 31 setting IEEE halting mode, 107 interoperability with C, ix, 117 underflow and denormalized results, intrinsic modules, 102, 119, 172 113 library, building, 18 intrinsic subprograms modules, xi, see also modules, c loc, 160 packaging cpu time,10 multiple statements per line huge, 104 avoid, 2, 4 move alloc,41 name transformation present,8 dnrm2, locally called l2norm,27 random number, 141 numeric inquiry functions, 102 selected real kind,21 optional arguments, 8 system clock,11 example, 8, 11 tiny, 113 PRESENT intrinsic function, 8 transfer,9 pointer, 4 relational symbols, 5 Kahan’s algorithm source formatting, 2 constants required, 107 timing routines, 10 l2 norm, 108 cpu time,10 system clock,11 LAPACK top 10 items, xi dgetrf , dgetrs,14 use of symbol =>,4 library building, 17 VOLATILE attribute, 173 ar, ranlib,17 legacy code, restructuring, 188 generic names legacy interfacing, 14 Airy functions BLAS,14 example, 30 code bloat, 17 packaging Airy functions compilation, linking, 17 example, 31 file suffix .f ,14 subprograms LAPACK,14 advantages, 29, 30 timing, dgetrf , dgetrs,15 library building, 17 IEEE standard library, precompiled floating-point exceptions, 102 calls to module subprograms, 26 example, d2nrm, 103 calls, interfaces, 25 Fortran floating-point history, library, usage 102 order, linker, 18

i i

i i i i book 2013/10/1 page 243 i i

Index 243

Maple version 11.02 future obsolescence, 20 use of, 148 one line functions, 185 matrix, sparse, see also defined operation OpenMP representation array update Harwell–Boeing (HB), 36 example, 171 triplet, 38 atomic, 175 Metcalf, Reid, and Cohen, see books, CHUNKSIZE, 180 Fortran reference cons, 170 mistake, purposeful critical, 175 quicksort, correct coding, 60 fragmentation, memory modules, packaging example, 178 derived types general models, pthreads, 180 interfaces, subprograms, 6 IEEE exceptions, 172 PUBLIC or PRIVATE input, output components, 6 example, 173 KIND parameters, 20 mutex, 180 precision definition output only example, 21 example, 172 SELECTED REAL KIND,21 private variables, personal, 177 USE-association, 6 pros, 170 example, 7, 8 pthreads, 180 MPI, see coarray race, deadlock, 170 c loc, target attribute, 160 REDUCTION, example, 172 core suite, 158 SCHEDULE, 180 module, Fortran to MPI subprograms, calling interfaces, core suite, 160 not thread-safe, 176 parameters, defining thread-safe, 170 C provides values, 159 thread-safe, tips, 176 routines, number of, 158 Windows threads, 180 operator overloading object-oriented (OO) sparse matrix add, +, 42 accessor, mutator functions, 50 optimization class, 48 in-line calls, 62, 211, 212 inheritance, polymorphism, 49 method, 48 packaging with modules object, 48 features, 18, 19 obsolescent features precision, range alternate return, 183 IEEE floating-point, 21 arithmetic-IF test, 182 procedures, type-bound character function length, 186 CLASS versus TYPE declaration, 64 CHARACTER* declaration, 186 example, 49 computed-GO TO, 184 FINAL, 54, 55 DATA statements, scattered, NOPASS, PASS, example, 64 185 purposeful mistake DO termination, 183 C interoperability fixed source format, 182 system calls, 127

i i

i i i i book 2013/10/1 page 244 i i

244 Index

QUADPACK, SIAM, see book code on SIAM web site see also documentation solving least squares derived TYPE (quadpackbase), 75 linear and sparse system, 142 enhancements, 73 ill-conditioned or singular, 142 CLASS objects, standard abstract interfaces, 73 Fortran 2003, x generic names, 74 ISO Fortran 90, x procedure pointers, 74 SuperLU, C code source conversion, 74 clear superlu, clearing storage, 137 vectorization, 74 SuperLU solving using C code integrals SOLVE with SuperLU , 137 complex, 72 testing example, 85 block coverage, 195, 202 multiple, 72 boundary values, 199 one-dimensional decision coverage, 202 Bessel J0, example, 77 equivalence partitioning, 198 data passing, 77 error logging, 196 two-dimensional, 81 exhaustive, 194 compute recursively, 81 Lapack coverage, 195 vector, 72 logging coverage, 195 interface makefiles, 196 Fortran 77, qag,75 metric, 195, 196 generic name, qag2003,77 oracle, 197 integrals, qag2003s,77 regression, 196 vector integrals, qag2003v,77 smoke, 201, 203 restrictions, Fortran 77, 73 soak, 196, 197, 203 access to data, 73 statement coverage, 195 efficiency, 73 unit, 196, 197 integrals, multiple, 73 white box, 196 vectorization, 73 timing subprograms quicksort, xiii, xv, 47, 57–70, 113 cpu time(),10 algorithms, recursive definition, 58 system clock, 10, 11 comparisons, 59, 60 tools, software functions, in-lining of, 62 code coverage, 221 in-situ sorting, 62 code debuggers, 220 operations, 59, 60 code documentation, Doxygen, 219 code profilers, 221 random numbers editors, language aware, 215, 225 complex pairs, 8 error processors, 222 example, 8 make, 216 recursion Makefile, example, 217 efficiency, reluctance, 57 source formatters, 223 quicksort, 57 text control, SVN, 219 reverse communication example, Newton method, 188 x87 assembler, 104

i i

i i