Vous êtes sur la page 1sur 26

Fortran 2003 & 2008

Welcome

A Brief History

Original Question: Can a Compiled Language Be Efficient? Fortran 66 / 77 (Archaic) Fortran 90 / 95 (Modern) Fortran 2003 Alternation of Large Revisions and Small Revisions Fortran 2008 May Be Substantial

Highlights of Fortran 2003


Parameterized Derived Types Inheritance Associate Construct Deferred Type Parameters Asynchronous Input/Output Procedure Pointers Interoperability with C

Parameterized Derived Types

Specify Kind Values When a Type is Used Within the Type Definition, Use the Kind Values to Specify Kinds of Components Disambiguate Procedure References Based on Kind Values Length Values May Be Determined during Execution

Inheritance

Single Inheritance

Efficiency, Clarity Single look-up (at most) needed during execution to call correct procedure Reference similar to component reference Finalizers (destructors)

Type Bound Procedures


Abstract Types

Select Type Block

class( root) :: foo select type( foo) type( child) class( root) end select

Associate Construct

Simple Names Given to Complex Designators


Array element selectors Component selectors Procedure references Input/Output lists

Simplify Expressions

Associate Example

associate( x => array( i)% coords% x, & y => array( i)% coords% y, & r2 => array( j)% dist2) r2 = x**2 + y**2 end associate

Deferred Type Parameters

A Length Parameter Value is Unknown Until the Object Is Associated or Allocated Applies to Pointers, Allocatables, and Dummy Arguments Values Determined During Execution

Deferred Type Parameters


type :: statistics_t( n) real, dimension( n) :: values end type statistics_t type( statistics_t( 100)) :: observations real function average( data) type( statistics_t( :)), intent( in) :: data average = sum( data% values) / size( data% values) end function average mean = average( observations)

Asynchronous Input/Output

Specify asynchronous Keyword on Data Declaration Use asynchronous Specifier on Open Statement Use asynchronous Specifier on Data Transfer Statement Use Wait Statement to Await Completion of Transfer

Procedure Pointers

Declared to Be both Procedures and Pointers May Have Either Explicit Interfaces or Implicit Interfaces May Be Used with Abstract Interfaces May Be Type-Bound

Interoperability with C

Allow Access to OS Services, Other Low-Level Libraries Allow C Programs to Access Fortran Numerical Libraries Provide Interoperability of Data and Procedures Convert Between C Pointers and Fortran Pointers

Anticipating Fortran 2008 I


Co-arrays Parameterized Modules More Mathematical Intrinsics Pointers & Targets:


Pointer to Contiguous Memory Same Shape Array Declarations Intent( scratch) Allocate Mold

Anticipating Fortran 2008 II


Concurrent Loop Control Detecting Logical & Character Kind Values Forward Allocatable Declaration Findloc() Rank > 7 Arrays Typeless Intrinsic Type CSV Files

Co-arrays I

Each Array Attribute Has a Coattribute


co-rank co-extent co-size

Different Co-indices Are Stored on Different Processors Get/Put Uses [] Instead of ()

Co-arrays II

Implement with One-sided Transfers


Cray's shmem library MPI Windows

High-Level Syntax High Efficiency www.co-array.org (Alan Wallcraft) Numerich & Reid at RAL (UK)

Parameterized Modules

Modeled After Ada's Generic Packages See J3 Paper 04-383r1 Instantiation Is Per Module Reference

So for one instantiation per program, wrap the parameterized module reference in a module which specifies the parameters needed

New Math Intrinsics

Complete the Complex Arc-Trig Functions Bessel, Gamma, Error Function, Etc. Findloc() Array Search Intrinsic Storage Size C Storage Size More?

Intrinsics are relatively easy to add

Pointers and Targets

Declare Permissible Targets of Pointers Declare Permissible Pointers to Targets Specify that Assumed Shape Arrays will have the Same Extents Specify Pointing to Contiguous Memory Intent( Scratch)

Concurrent Loop Control


Add a Forall-Like Loop Control Uses Current Do-Loop Structure


Block scope, enddo Cycle but not exit Cache/Vector Parallel

Memory Access Reduction


See J3 Paper 05-133r2

Typeless

Ordered Bits without Interpretation Bit Operations


popcnt(), poppar(), leadz(), trailz() min, max etc work as unsigned and / or / xor

As Dummy Argument, Accepts Any Type of Actual of Same Size See J3 Paper 05-155r1

Write CSV Files

Provide an Easy Means to Write CSV Files Provide Access to MATLAB, Mathematica, Maple, S-Plus, Spreadsheets, Etc. Done as an Access Method (?) See J3 Paper 05-108r1

ISO

Ice-Oh

Helenistic word meaning same Not I-S-O

International Organization for Standardization www.iso.org SC22 WG5

ANSI

ANSI Does Everything www.ansi.org INCITS Does Information Technology www.incits.org TC- Technical Committees J3 www.j3-fortran.org

Volunteer

Activities Based on Volunteerism Absence of Volunteers Allows Vendors to Dominate


Proprietary Jails Standards Change on a whim

Vous aimerez peut-être aussi