Fortran Dipl. Math. F. Braun Universität Regensburg Rechenzentrum http://www.uni-regensburg.de/edv/kurs_info/brf09510/hpc/fortran.html http://www.uni-regensburg.de/edv/kurs_info/brf09510/hpc/fortran.pdf http://www.uni-regensburg.de/edv/kurs_info/brf09510/hpc/fortran.dvi 16. Oktober 2014
KAPITEL 1 Einführung in Fortran 1. Literatur Tabelle 1. Informationen im WWW: ftp://ftp.nag.co.uk/sc22wg5/n1751-n1800/n1791.pdf Fortran 2008 Final Committee Draft http://www.nag.co.uk/sc22wg5/ Standardisierung von Fortran (JTC1/SC22/WG5) http://www.fortran.de/ Deutsche Fortran Homepage http://www.nsc.liu.se/~boein/fortran.html Fortran 95 texts by Bo Einarsson http://www.fortran.com/ The Fortran Company (Products, services and tools) http://www.fortran.com/fortran/metcalf.htm Fortran 90/95/HPF Information File http://www.ifremer.fr/ditigo/molagnon/fortran90/engfaq.html F90 FAN's : Fortran 90 Frequently Asked abou http://www.fortran.com/fortran/metcalf.htm Fortran 90/95/HPF Information File ftp://ftp.nag.co.uk/sc22wg5/n1551-n1600/n1579.pdf The New Features of Fortran 2003 http://www.pdfgeni.com/book/fortran-pdf.html Frei verfügbare Skriptensammlung http://www.thefreecountry.com/compilers/fortran.shtml Fortran-Compilersammlung http://portal.acm.org/citation.cfm?doid=1570522.1570525 Compiler support for the Fortran 2003 and 2008 sta http://portal.acm.org/citation.cfm?doid=1570522.1570525 Compiler support for the Fortran 2003 and 2008 sta http://fortranwiki.org/fortran/show/fortran+2008+status Compiler support for the Fortran 2003 and 2008 sta http://www.fortran2008.com/ Fortran 2008 1.1. Fortran im WWW. Tabelle 2. Literatur: Bä97 Bäumer Programmieren mit Fortran 90 1997 3528052082 cha07 Chapman Fortran 95/2003 for Scientists and Engineers 2007 0071285784 ell98 Ellis Fortran 90 Programming 1998 17/ST 250 F60 E47 met04 Metcalf Fortran95/2003 2004 0198526938 nr96 Numerical Recipes in Fortran 90 1996 84/SK 900 P935 F7(2,96) rrzn97 Fortran 95 00/ST 250 F60 R336 Üb07 Überhuber Softwareentwicklung in Fortran 90 2007 3211824502 F00/99 A887 1.2. Lehrbücher. 1.3. Standard. http://gcc.gnu.org/wiki/gfortranstandards Fortran Standards Documents (Gcu) ftp://ftp.nag.co.uk/sc22wg5/n1801-n1850/n1830.pdf Letzter Draft (7.6.2010) ftp://ftp.nag.co.uk/sc22wg5/n1801-n1850/n1826.pdf Letzter Draft (20.4.2010) ftp://ftp.nag.co.uk/sc22wg5/n1801-n1850/n1827.txt Unterschiede zwischen N1814 und N1826 ftp://ftp.nag.co.uk/sc22wg5/n1801-n1850/n1824.pdf Coarrays ftp://ftp.nag.co.uk/sc22wg5/n1851-n1900/n1866.pdf Interoperability of Fortran with C (TR 29113) ftp://ftp.nag.co.uk/sc22wg5/n1851-n1900/n1862.pdf MPI 3.0 3
4 1. EINFüHRUNG IN FORTRAN 1.4. Kurse im Internet. http://www2.fz-juelich.de/jsc/files/docs/vortraege/f90_f_eilige.pdf F90 37 S. http://ravel.phc.uni-kiel.de/scripts/cc_tc_block/fortran.pdf F90/95 32 S. http://omega.solarsiedlung.org/herold2008skript.pdf F95 112 S. https://srv.rz.uni-bayreuth.de/lehre/fortran90/fortran.pdf F90/95 235 S. http://www2.fz-juelich.de/jsc/files/docs/bhb/bhb-0124.2up.pdf F90/95 144 S. 2. Die Fortran Sprachfamilie 2.1. Hauptlinie. mit fett markierten major revisions: Fortran (Backus, IBM, 1953/54, Formeln, Anweisungen), Fortran I, II (1958), III Fortran IV (1961, Unterprogramme), Fortran-66 Fortran IV, ANSI, Fortran-77 (1978, modernisiert, insbesondere strukturiert), Fortran 90 (1991, Formatfreiheit, Feldgrenzen, Feldoperationen, Module, Zeiger, Rekursion, Dynamischer Speicher, Operatorüberladung, Typen, Namensparameter, Obsolete Markierungen) Fortran 95 (forall, pure, elemental, Initialisierungen) Fortran 2000, Fortran 2003 ( Objektorientierung, Polymorphie, Vererbung, Funktionszeiger, C-Anbindung, Unicode, Kommandoargumente, Umgebungsvariable) Fortran 2008 (ISO/IEC 1539-1:2010) (Submodules, Coarrays, Performance (do concurrent, contiguous), Data (rank 15, long), IO (newunit), Statements (block), Intrinsics (bit, bessel, norm2. ndloc), Procedures, Lexical 2.2. Nebenlinien: HPF (High Performance Fortran): Fortran 95 mit speziellen Optimierungsmöglichkeiten. http://www.netlib.org/hpf/ coarray-fortran (Numrich, SGI, 1996): Fortran mit Erweiterungen für verteiltes Rechnen im PGAS-Speicher. http://www.uni-regensburg.de/edv/kurs_info/brf09510/hpc/pgascaf.html F: Ursprünglicher Name von coarray-fortran. F: Fortran 95 ohne historischen Ballast. http://www.fortran.com/f/ Elf90: Fortran 95 ohne historischen Ballast. Ratfor: Fortran 66 mit strukturierten Anweisungen. Fortress: Eine auf Fortran basierte parallele Sprache aus dem Darpa-Projekt
KAPITEL 2 Fortran-Compiler http://www.fortranplus.co.uk/resources/fortran_2003_2008_compiler_support.pdf Compiler support for the Fortran 2003 ans 2008 Standard Tabelle 1. Fortran-Compiler: g95 gfortran g77 Absoft Fortran 95 AMD x86 Open64 Compiler Suite Cray HP HPC HP Fortran IBM Fortran Intel Fortran Lahey Fortran NAGWare f97 PathScale Fortran 95 PGI Fortran Salford FTN95 Sun Studio http://www.g95.org/index.shtml http://gcc.gnu.org/fortran/ http://gcc.gnu.org/wiki/gfortrang77 http://developer.amd.com/cpu/open64/pages/default.aspx http://software.intel.com/en-us/articles/non-commercial-software-down http://www.silverfrost.com/32/ftn95/ftn95_personal_edition.aspx siehe http://en.wikipedia.org/wiki/list_of_compilers#fortran_compilers http://en.wikipedia.org/wiki/c_compiler Von Andrew Vaught seit 2000 1. g95 2. gfortran http://gcc.gnu.org/wiki/fortran2003status Fortran 2003 Status http://gcc.gnu.org/wiki/fortran2003 http://gcc.gnu.org/wiki/fortran2008status Fortran 2008 Status 5
KAPITEL 3 Aufbau von Fortran-Programmen Kommentare (alt und neu): Comment lines,! Kommentare Formatgebunden (f77) und formatfrei (f95) Ausführbare (Strukturanweisungen) und nicht ausführbare Anweisungen Fortsetzungszeilen (alt und neu): & zeigt an, dass die Zeile in der nächsten Zeile weitergeht, die nie eine Kommentarzeile ist. Kopf - Vereinbarungen - Anweisungen - Ende Groÿ- und Kleinschreibung case insentitive Namen 7
KAPITEL 4 Datentypen Grundtypen: integer, real, complex, logical, character Implizite Typen: implicit none! Überall! noch überaller! integer :: i, j, k Längenvarianten: character(15), character(len=30) Wertebereichsvarianten (kind): Veraltete Längenvariante: integer*1, *2, *4, *8, character*45, real*4, *8 Besser: kind = Anzahl der Bytes Schreibvariante: real, parameter :: pi = 3.141592653589793; character(*), parameter :: error='error' Feldvariante: real, dimension (3) :: v 9
KAPITEL 5 Ausdrücke Ausdrücke: +,,, /, Konversionen: real(i), integer (x) Logik: == /= > >= < <=.EQ..NE..GT..GE..LT..LE..TRUE..FALSE..AND..OR..EQV..NEQV. String: len, s(5:7), index, trim, //, iachar, achar Intrinsics: exp, log, log10, sqrt, abs, sin, cos, tan, asin, acos, atan int, nint, real, acharm iachar min, max 11
KAPITEL 6 Felder real, dimension (3) :: v integer, dimension (3, 4) :: w w11 w21 w31 w12 w22... w34 real, dimension (0:2) :: x real, dimension (0:2) :: x = 0 real, dimension (0:2) :: x = (/ 1.1, 2.2, 3.3 /) real, dimension (12) :: x = (/ (1.0*i+3.0*(j-1)), i=1,2 x(i) Feldoperationen: x = y * z Unterfelder. Matrixoperationen: dot_product matmul transpose maxloc minloc maxval minval sum product cshift Ausgabe: Bedingte Feldverarbeitung: where ()... else where ()... end where Dynamische Felder: 13
KAPITEL 7 Anweisungen stop Wertzuweisung: var = ausdruck if () then... else if () then... end if select case ()... case ()... case ()... case default... end select do... if () exit... end do do while ()... end do do iiivar = a, e, s... end do exit in Schleifen cycle in Schleifen where ()... else where ()... end where 15
KAPITEL 8 Unterprogramme 17
KAPITEL 9 Ein- und Ausgabe open unit= le= status=action= iostat= write (unit, format) list read (unit, format) varlist close unit= Interne Dateien (Stringkonversionen): write (string, format) list 19
KAPITEL 10 Formate '(F8.2)' write (*, 100) list 100 format (1X, I6, F10.2) string = write (*, string) list integer: Iw, rtw, riw.m (width, repeat, minimum) Binär: Bw Oktal: Ow Hexadezimal: Zw real: Fw.d rfw.d Ew.d rew.d ESw.d rwsw.d ENw.d renw.d Gw.d rgw.d (width, decimals, repeat) logical: Lw rlw character: A ra Aw raw 21
KAPITEL 11 Module 23
KAPITEL 12 Interface 25
KAPITEL 13 Zeiger 27
KAPITEL 14 Don't no implicit no arithmetic if do neverrealvar = a, e, s... end do never GOTO anywhere never use ENTRY never use COMMON don't INCLUDE (war niemals Fortran bis f90, und danach veraltet wegen Modulen) 29
Inhalt 31
Inhaltsverzeichnis Kapitel 1. Einführung in Fortran 3 1. Literatur 3 2. Die Fortran Sprachfamilie 4 Kapitel 2. Fortran-Compiler 5 1. g95 5 2. gfortran 5 Kapitel 3. Aufbau von Fortran-Programmen 7 Kapitel 4. Datentypen 9 Kapitel 5. Ausdrücke 11 Kapitel 6. Felder 13 Kapitel 7. Anweisungen 15 Kapitel 8. Unterprogramme 17 Kapitel 9. Ein- und Ausgabe 19 Kapitel 10. Formate 21 Kapitel 11. Module 23 Kapitel 12. Interface 25 Kapitel 13. Zeiger 27 Kapitel 14. Don't 29 Inhalt 31 33
34 INHALTSVERZEICHNIS TTH-Seite: http://hutchinson.belmont.ma.us/tth/