The new features of Fortran 2003

Similar documents
The New Features of Fortran 2000

Fortran Bill Long, Cray Inc. 21-May Cray Proprietary

The New Features of Fortran 2003

Page 1 of 7. Date: 1998/05/31 To: WG5 From: J3/interop Subject: Interoperability syntax (Part 1) References: J3/98-132r1, J3/98-139

Fortran 2003 and Beyond. Bill Long, Cray Inc. 17-May-2005

Chapter 4. Fortran Arrays

ISO/IEC : TECHNICAL CORRIGENDUM 2

Fortran Coding Standards and Style

Report from WG5 convener

Lecture V: Introduction to parallel programming with Fortran coarrays

Information technology Programming languages Fortran Part 1: Base language

Technical Report on further interoperability with C

NAGWare f95 Recent and Future Developments

Fortran Coarrays John Reid, ISO Fortran Convener, JKR Associates and Rutherford Appleton Laboratory

Fortran 2008: what s in it for high-performance computing

TS Further Interoperability of Fortran with C WG5/N1917

Technical Specification on further interoperability with C

Welcome. Modern Fortran (F77 to F90 and beyond) Virtual tutorial starts at BST

FORTRAN Basis. PROGRAM LAYOUT PROGRAM program name IMPLICIT NONE [declaration statements] [executable statements] END PROGRAM [program name]

Numerical Modelling in Fortran: day 2. Paul Tackley, 2017

NAGWare f95 and reliable, portable programming.

2 3. Syllabus Time Event 9:00{10:00 morning lecture 10:00{10:30 morning break 10:30{12:30 morning practical session 12:30{1:30 lunch break 1:30{2:00 a

A Fast Review of C Essentials Part I

Co-arrays to be included in the Fortran 2008 Standard

Tokens, Expressions and Control Structures

Parallel Programming in Fortran with Coarrays

Fortran's Relevance Today and in the Future. Peter Crouch, Chairman Fortran Specialist Group Member Groups Convention 5 April 2011

Types. What is a type?

Lecture 2 FORTRAN Basics. Lubna Ahmed

G Programming Languages Spring 2010 Lecture 6. Robert Grimm, New York University

DRAFT DRAFT DRAFT ISO/IEC JTC 1/SC 22 N0703. Élément introductif Élément principal Partie n: Titre de la partie. Date: ISO/IEC TR

Index. object lifetimes, and ownership, use after change by an alias errors, use after drop errors, BTreeMap, 309

Review More Arrays Modules Final Review

Fortran 90 - A thumbnail sketch

ISO/IEC JTC 1/SC 22/OWGV N 0220

Current Developments in Fortran Standards. David Muxworthy 15 June 2012

Experimental FORTRAN 2003 Interfaces for netcdf 3

Evolution of Fortran. Presented by: Tauqeer Ahmad. Seminar on Languages for Scientific Computing

C Language Part 1 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee

Fortran 2003 Part 1. École normale supérieure L3 geosciences 2018/2019. Lionel GUEZ Laboratoire de météorologie dynamique Office E324

Chapter 3. Fortran Statements

Units of Measure in Fortran

Computer Science (330)

3. Java - Language Constructs I

Compiler Support for the Fortran 2003 and 2008 Standards Revision 17

Name :. Roll No. :... Invigilator s Signature : INTRODUCTION TO PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70

UNIT- 3 Introduction to C++

CSCE 110 PROGRAMMING FUNDAMENTALS

Fortran Annex to TR 24772, Guidance to Avoiding Vulnerabilities in Programming Languages through Language Selection and Use

Advanced Fortran Programming

Introduction to C++ Introduction. Structure of a C++ Program. Structure of a C++ Program. C++ widely-used general-purpose programming language

Rvalue References as Funny Lvalues

Chapter 2. Outline. Simple C++ Programs

Introduction to C++ with content from


Programming vulnerabilities for C++ (part of WG23 N0746)

Table 2 1. F90/95 Data Types and Pointer Attributes. Data Option. (Default Precision) Selected-Int-Kind

C-LANGUAGE CURRICULAM

Programming Languages

Fortran Annex to TR 24772, Guidance to Avoiding Vulnerabilities in Programming Languages through Language Selection and Use

International Standards Organisation. Parameterized Derived Types. Fortran

The SPL Programming Language Reference Manual

The New C Standard (Excerpted material)

C++ (Non for C Programmer) (BT307) 40 Hours

About 1. Chapter 1: Getting started with Fortran 2. Remarks 2. Versions 2. Examples 2. Installation or Setup 2. Hello, world 3. Quadratic equation 4

Data Types. Every program uses data, either explicitly or implicitly to arrive at a result.

Welcome to Teach Yourself Acknowledgments Fundamental C++ Programming p. 2 An Introduction to C++ p. 4 A Brief History of C++ p.

Stream Computing using Brook+

C# Adds Useful Features

Engineering Problem Solving with C++, 3e Chapter 2 Test Bank

Watcom FORTRAN 77. Language Reference. Edition 11.0c

Short Notes of CS201

LF Fortran 95 Language Reference. Revision G.02

Introduction To C#.NET

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe

Primitive Data Types: Intro

Lecture Overview. [Scott, chapter 7] [Sebesta, chapter 6]

BLM2031 Structured Programming. Zeyneb KURT

Built-in Types of Data

Fortran. (FORmula TRANslator) History

CS201 - Introduction to Programming Glossary By

PGI Accelerator Programming Model for Fortran & C

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

Cryptol version 2 Syntax

CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010

Data Types Literals, Variables & Constants

Type Checking. Prof. James L. Frankel Harvard University

Oracle Database 11g: SQL and PL/SQL Fundamentals

Scheme G. Sample Test Paper-I. Course Name : Computer Engineering Group Course Code : CO/CD/CM/CW/IF Semester : Second Subject Tile : Programming in C

Modern Fortran OO Features

Coarrays in the next Fortran Standard

The Pascal Programming Language. Bob Fraley HP Labs. January 15, 1980

C++ Programming: From Problem Analysis to Program Design, Third Edition

Functions. Systems Programming Concepts

Intrinsic Functions Outline

CHAPTER 1 Introduction to Computers and Programming CHAPTER 2 Introduction to C++ ( Hexadecimal 0xF4 and Octal literals 031) cout Object

Lecture 19: Functions, Types and Data Structures in Haskell

Goals for This Lecture:

C++11 and Compiler Update

1. Match each of the following data types with literal constants of that data type. A data type can be used more than once. A.

Transcription:

The new features of Fortran 2003 David Muxworthy BSI Fortran Convenor

Pages in Fortran Standards 0 100 200 300 400 500 600 700 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 Year Pages

Major extensions Standardized interoperability with C Object-oriented support Derived-type enhancements IEEE 754 support Numerous data manipulation enhancements Numerous input/output enhancements

Minor incompatibilities with Fortran 95 carriage control for printer output has been removed from the standard list-directed and namelist output of real zeros is changed output of real zeros in these contexts always uses F rather than E format if the processor can distinguish +0.0 and -0.0, use is made of this by ATAN2 and by LOG, SQRT if they have complex arguments e.g. result of ATAN2 or LOG may be -π rather than π

Characters and source form the default character set is extended to include: ~ \ [ ] { } @ # grave accent, circumflex accent (but not acute accent) only [ and ] are used and are synonyms for (/ and /) variable names may be to 63 characters statements may be up to 256 lines

'International' (non-anglophone) usage explicit accommodation of 10646 characters (but not necessary for processors to support 10646) ability to specify decimal separator in internal or external files as POINT or COMMA

Data types and specifications Many new facilities, including: deferred type parameters length type parameters of certain entities may be changed during execution VOLATILE attribute for interacting with non-fortran processes ASYNCHRONOUS attribute for specifying that a variable may be subject to asynchronous input/output type specification for array constructors, e.g. [CHARACTER(LEN=8) :: Fortran, C, Algol 68 ]

More data manipulation enhancements specification and initialization expressions are extended by removal of some restrictions complex literals are extended to accept named constants, e.g. (0., PI) where PI is a previously declared real constant MIN and MAX extended to accept character arguments

Derived type enhancements the kind, length and shape of derived type components may be specified when the type is used different components may have different accessibility improved structure constructors finalizers derived-type input/output components may be allocatable

ASSOCIATE construct This allows a complex expression or object to be denoted by a simple symbol Examples: associate ( z => exp(-(x**2+y**2)) * cos(theta) ) print *, a+z, a-z end associate associate ( array => ax%b(i,:)%c ) array(n)%ev = array(n-1)%ev end associate

Enumerators Enumerators are provided to interoperate with the corresponding C enumeration type Example: enum, bind(c) enumerator :: red = 4, blue = 9 enumerator yellow end enum

Procedure pointers Pointers are extended to point to procedures, as well as variables, using a new PROCEDURE statement. Example: procedure (real_func), pointer :: p=> null() where the interface to real_func has already been defined... p => bessel write (*, *) p(2.5)!-- bessel(2.5)

Input/output enhancements There are many detailed enhancements, including: asynchronous transfer stream, rather than record, access named constants for preconnected units FLUSH statement access to error messages derived-type i/o control over rounding mode at internal to external real number conversion

IEEE support If the processor supports some or all of IEC 60559 (IEEE 754) arithmetic, the standard provides facilities to: query which IEEE facilities are provided access the facilities for IEEE arithmetic, exception handling, rounding, use of certain IEEE functions, etc.

Enhanced access to system environment new procedures, including GET_COMMAND GET_COMMAND_ARGUMENT GET_ENVIRONMENT_VARIABLE COMMAND_ARGUMENT_COUNT IOMSG=character-variable specifier in OPEN, CLOSE, READ, WRITE

Interoperability with C Uses intrinsic module ISO_C_BINDING to define named constants and derived types allows for interoperability of: intrinsic types pointer types derived types scalars and arrays procedures and procedure interfaces C global variables C functions but not (yet): procedures with data pointer, allocatable, assumed-shape array or optional dummy arguments

C Function Prototype: Interoperability with C example part 1 int C_Library_Function(void* sendbuf, int sendcount, int *recvcounts); Fortran Module: module ftn_c interface integer (c_int) function C_Library_Function & (sendbuf, sendcount, recvcounts), bind(c,name= C_Library_Function ) use iso_c_binding implicit none type (c_ptr), value :: sendbuf integer (c_int), value :: sendcount type (c_ptr), value :: recvcounts end function C_Library_Function end interface end module ftn_c &

Fortran Calling Sequence: Interoperability with C example part 2 use iso_c_binding, only: c_int, c_float, c_loc use ftn_c... real (c_float), target :: send(100) integer (c_int) :: sendcount integer (c_int), allocatable, target :: recvcounts(100)... allocate( recvcounts(100) )... call C_Library_Function(c_loc(send), sendcount, & c_loc(recvcounts))

Object-oriented support enhanced data abstraction one type may extend the definition of another polymorphism allows type of a variable to vary at run time dynamic type allocation SELECT TYPE construct type-bound procedures

Further information For a far more detailed (38 page) overview of the new features in Fortran 2003 relative to Fortran 95 see "The New Features of Fortran 2003" by John Reid, at ftp://ftp.nag.co.uk/sc22wg5/n1601-n1650/n1648.pdf