1 / 37

Requirements for Fortran 2003+ Procedures and Progress David Muxworthy BSI Fortran Convenor

Requirements for Fortran 2003+ Procedures and Progress David Muxworthy BSI Fortran Convenor Prepared for the BCS FSG meeting on 10 March 2005 Almost all the content is based on material accessible via links from the factsheet. Fortran Standards Revision Cycle.

nura
Télécharger la présentation

Requirements for Fortran 2003+ Procedures and Progress David Muxworthy BSI Fortran Convenor

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Requirements for Fortran 2003+ Procedures and Progress David Muxworthy BSI Fortran Convenor Prepared for the BCS FSG meeting on 10 March 2005 Almost all the content is based on material accessible via links from the factsheet

  2. Fortran StandardsRevision Cycle 1962 First ANSI standardization committee meets 1966 Publication of ANSI standard (ISO 1972) 1978 Fortran 77 (ISO 1980) – relatively minor revision 1991 Fortran 90 - major revision 1997 Fortran 95 - minor revision 2004 Fortran 2003 - major revision

  3. F2003+ Revision Schedule Repository started 2004-05 Preliminary choice of significant features 2005-04Final choice of significant features 2006-02 Completion of separate edits 2006-05First working draft available 2007-05 First CD submitted for registration and approval 2007-10 Final CD submitted for approval 2008-09 WG5 approval of draft DIS 2009-04DIS ballot initiated 2009-05DIS ballot results available 2009-07Standard published 2009-08

  4. Requirements collection procedure ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ National member National member National member .... of ISO of ISO of ISO WG5 repository of requirements WG5 decide at May 2005 and February 2006 meetings Final set of requirements for Fortran 2003+

  5. Repository item headings Number Title Submitted By Status Severity Level References Basic FunctionalityRationaleEstimated ImpactDiscussionDetailed SpecificationHistory

  6. Severity Levels - Editorial 1. Minor editorial (less than 10 lines altered).2. Significant editorial (up to a page altered) with no technical change.3. Major editorial (up to a chapter altered) with no technical change.

  7. Severity Levels – Technical (1) • 3. Very minor technical change. • An example is adding the optional argument KIND to IACHAR. • Minor technical change. • An example is changing type-bound generics to be sets of specific named type-bound procedures. • 5. Technical change likely to need more than two J3 meetings to develop.An example is reallocation of allocatable arrays.

  8. Severity Levels – Technical (2) 6. Technical change likely to need more than a year to develop. The modules and allocatable TRs are examples.7. Technical change likely to need more than 2 years to develop. The IEEE TR is an example.8. Technical change likely to need more than 3 years to develop. Interfacing with C and the OO features are examples.

  9. WG5 RepositorySubmissions so far • level 3 18 • level 3/4 1 • level 4 13 • level 5 1 • level 6 2 • total 31

  10. WG5 RepositoryUK submissions UK-001 6 Co-array Fortran for parallel programming UK-002 3 Decimal floating point arithmetic UK-003 4 Conformance to IEEE 754R UK-004 3 KIND environment specification

  11. UK-001 Co-array Fortranfor parallel programming Co-Array Fortran is a simple parallel extension ● assumes the SPMD programming model with the program, both text and data, replicated a fixed number of times ● each copy is called an image ● normal subscripts refer to memory addresses within an image while a second set of subscripts refer to memory addresses in other images ● each image executes asynchronously with explicit synchronization provided by the programmer.

  12. UK-002 Decimal floating point arithmetic Allow for decimal floating point arithmeticLanguages increasingly support decimal arithmetic in addition to binary or hexadecimal arithmetic, e.g. C#, COBOL, Visual Basic. Now that IBM are to sell hardware with packed decimal floating point, the C and C++ WGs are preparing TRs to extend those languages to provide decimal floating-point facilities, principally for financial applications. In order to retain competitiveness and to maintain interoperability with C, Fortran should adopt comparable facilities.

  13. UK-003 Conformance to IEEE 754R Allow for decimal floating point arithmetic in conformance withIEEE 754R Other languages, notably C and C++, are being extended to accommodate features of IEEE 754R, principally for decimal floating point arithmetic. In order to retain interoperability with C, Fortran should adopt comparable facilities. The 754R standard is still being developed.

  14. UK-004 KIND environment specification Provide parameter arrays in ISO_FORTRAN_ENV that define the number and available kind values for each intrinsic type.Declarations like the following should be defined in ISO_FORTRAN_ENV INTEGER,PARAMETER:: FP_KINDS(3) = [4,8,16], & INT_KINDS(2) = [4,2], & CHAR_KINDS(1)= [1]... ● FP_KINDS(1) must be the value for KIND(0.0E0) and FP_KINDS(2) that forKIND(0.0D0) ● The first element in each array must contain the kind value for the default intrinsic type ● An inquiry as to the SIZE(FP_KINDS) will return the number of floating point, etc. representation methods available

  15. J3 Submissions - Editorial Rewrite attribute requirements (J3-008, level 3) The current method of specifying the requirements on various attributes, such as EXTERNAL and POINTER, is too hard to understand and too prone to error. The attribute specification parts of chapters 5 and 12 should be rewritten.

  16. J3 Submissions - Types & Data Objects Allow TYPE ( <intrinsic-type-spec> ) (j3-020, level 3) For regularity and symmetry, allow TYPE ( <intrinsic-type-spec> ) Allow forward type for allocatable components (j3-028, level 3) Do not require the type of an allocatable component to be defined before the type containing the allocatable component. Named rank-one array constant's extent from its <initialization-expr> (j3-023, level 3) As with the length of a character named constant, allow a rank-one array named constant to get its extent from the <initialization-expr>.

  17. J3 Submissions - Expressions ANDTHEN and ORELSE pseudo-functions (j3-031, level 4) Guarantee short-circuit evaluation of AND and OR operations. Add two new elemental pseudo-functions ANDTHEN (A1 ,A2 [, A3, ...AN] ) ORELSE (A1 ,A2 [, A3, ...AN] ) Arguments: A1, ...AN Logical, of any kind, they must be conformable The arguments are evaluated in sequence, left to right, one at a time.

  18. J3 Submissions - Assignment Allow a polymorphic allocatable variable in intrinsic assignment (j3-022, level 4) Require <expr> to have the same rank as a polymorphic <variable>. If <variable> is allocated and polymorphic, deallocate it. Then allocate it with the same dynamic type, type parameters and bounds as <expr>. Updating complex parts (j3-015, level 4) Specify that the real and imaginary parts of a complex variable can be accessed by using component-like syntax, with "component" names REAL and AIMAG.

  19. J3 Submissions - Execution control Enhance the STOP statement (j3-001, level 3) Stop code should allow a scalar integer or character expression, be displayed on ERROR_UNIT, if the stop code is integer, it should be used as the process exit status EXIT from any labelled construct (j3-024, level 3) Allow EXIT from any labelled construct (not just loops)

  20. J3 Submissions - Procedures (1) Allow empty CONTAINS part (j3-010, level 3) To facilitate program development and use of automatically generated programs Internal subprograms as actual arguments and procedure pointer targets (j3-013, level 4) Allow internal subprograms as actual arguments and procedure pointer targets

  21. J3 Submissions - Procedures (2) Disassociated or deallocated actual argument associated with nonpointer nonallocatable optional dummy argument is considered not to be present (j3-016, level 4) The title says it all (At the February 2005 J3 meeting this item was allocated lowest priority so far as J3 is concerned) Default initial values for absent optional dummy arguments (j3-017,level 4) Allow specificiation of a default initial value for absent optional dummy arguments.

  22. J3 Submissions - Procedures (3) Non-null initial targets for pointers (j3-018, level 4) Allow initial targets for pointers that are other than NULL() (At the February 2005 J3 meeting this item was allocated lowest priority so far as J3 is concerned) Allow SUBROUTINE <name> or FUNCTION <name> to be optional on END statements for module and internal subprograms (j3-025, level 3) Module procedures are required to end with END SUBROUTINE <name> or END FUNCTION <name>. This is generally a good thing, but it makes it impossible to convert a Fortran 77 external procedure to a module procedure by using INCLUDE

  23. J3 Submissions - Intrinsic Procedures(1) More mathematical functions (j3-019, level 4) Provide ACOS, ASIN, ATAN, COSH, SINH, TAN and TANH for complex type. Provide inverse hyperbolic functions, including for complex type. In the case of TAN, specify that the real part of the argument is regarded as a value in radians. Make ATAN with two arguments work like ATAN2 (j3-026, level 3) Since ATAN is generic, it is surprising to students that they need to use ATAN2 just because they have the two-argument formulation.

  24. J3 Submissions - Intrinsic Procedures (2) ASCII arguments for LGE etc (j3-027, level 3) Allow ASCII kind characters as arguments to LGE, LGT, LLE and LLT More info on GET_COMMAND[_ARGUMENT] failure (j3-029, level 3) Provide more information if GET_COMMAND or GET_COMMAND_ARGUMENT fails.

  25. J3 Submissions - ISO_FORTRAN_ENV (1) GET_IO_UNIT (j3-002, level 3) Add an procedure to ISO_FORTRAN_ENV to return a logical unit number which may be opened. IO_UNIT standard derived type (j3-009, level 4) Add a derived type to ISO_FORTRAN_ENV to represent an i/o unit. Allow values of this type to be used everywhere that a unit number can be used.

  26. J3 Submissions - ISO_FORTRAN_ENV (2) EXECUTE_COMMAND_LINE (j3-003, level 4) Add a procedure to ISO_FORTRAN_ENV to cause an external program to execute. (At the February 2005 J3 meeting this item was allocated lowest priority so far as J3 is concerned) STORAGE_SIZE (j3-004, level 3) Add a procedure to ISO_FORTRAN_ENV to return the size in bits of its argument.

  27. J3 Submissions - ISO_FORTRAN_ENV (3) Find logical and character kinds (j3-006, level 3) Add constants to iso_fortran_env which specify all available logical kind values and all available character kind names (Overlaps UK-004). Selection of most common real and integer kinds (j3-030, level 3) The standard should specify named constants in the ISO_FORTRAN_ENV intrinsic module, as an example: int8_kind, int16_kind, int32_kind, int64_kind, real32_kind, real64_kind, real128_kind, int_default_kind, real_default_kind, real_double_kind (At the February 2005 J3 meeting this item was allocated lowest priority so far as J3 is concerned)

  28. J3 Submissions - ISO_C_BINDING C_SIZEOF (j3-005, level 3) Add a procedure to ISO_C_BINDING to return the size of its argument as per C sizeof.

  29. J3 Submissions - Scope & association Construct Name Local to Construct (j3-007, level 3/4) Make a construct name be local to its construct. Use ALLOCATABLE and POINTER attributes in generic resolution (j3-012, level 4) Allow the POINTER and ALLOCATABLE attributes to be used as the last resort for generic resolution. Resolve generic without invoking a procedure or evaluating arguments (j3-021, level 4) Given exemplars of actual arguments, resolve a generic name to a specific procedure without invoking the procedure or evaluating its arguments. (At the February 2005 J3 meeting this item was allocated lowest priority so far as J3 is concerned)

  30. J3 Submissions - Coroutines Coroutines (J3-011, level 5) Provide coroutines to facilitate library procedures accessing user-supplied code. Add two new statements, called for example SUSPEND and RESUME. Provide a new form of subprogram, the "coroutine", that cannot contain an ENTRY statement, and is the only subprogram in which a SUSPEND statement is allowed. A coroutine requires an explicit interface. (At the February 2005 J3 meeting this item was allocated lowest priority so far as J3 is concerned)

  31. J3 Submissions - Parameterized modules Parameterized modules (J3-014, level 6) Provide a facility whereby a module or subprogram can be developed in a generic form, and then applied to any appropriate type.

  32. J3' s classification - "must do" itemsgreen => already in the WG5 repository Description Level Co-array Fortran for parallel programming 6 Parameterized Modules 6 Pointers to contiguous memory 5 Same Assumed Shape declaration 5 DO CONCURRENT construct 5 Math Intrinsics: complex trig 4 Rewrite attribute requirements 3 Type ( Intrinsic-type) 3 Ascii in LGE etc 3

  33. J3' s classification - "do if time" items (1) Description Level TYPELESS object 7 Avoid obtaining a logical unit for opening 5 Allocatable/Pointer in Generic Resolve 5 Conformance to IEEE 754R 4 STORAGE_SIZE intrinsic 4 Construct names Local to Construct 4 Internal Procedures as actual args 4 Updating Complex parts 4 Default for Optional Dummy 4 Polymorphic allocatable <variable> in intrinsic assignment 4 .ANDTHEN. & .ORELSE. 4 Pointers and Targets [specify all possible pointers for a target and vv] 4 Library extensions: Bessel, erf, gamma, hypot 4 Rank > 7 4 Compute if actual arg is present 4 Interoperability of pointers, allocatables, and assumed-shape arrays 4 Interoperability of optional arguments 4 New Intents [INTENT(SCRATCH)] 4 Writing Comma Separated Value CSV files [add to list-directed] 4 Select between expressions [conditional expressions] 4

  34. J3' s classification - "do if time" items (2) Description Level Decimal floating-point arithmetic 3 Stop - exit code 3 Get logical I/O unit number 3 C_sizeof 3 Finding Logical & Character Kinds 3 Allow empty CONTAINS part 3 Size/shape of Parameter Array 3 Exit from any labelled Construct 3 Name Optional on END module & internal subprogram 3 Atan/Atan2 3 Public #116: Forward Allocatable 3 More information about GET_COMMAND[_ARGUMENT] failure 3 Findloc [find location of element in an array having specified value] 3 Mold on Allocate 3 Proposed f2k+ MTE on semicolons [allow ; at start of line] 3

  35. J3' s classification - "low priority" items Description Level Coroutines 5 Behavior of -0.0 in intrinsics (subsumed by interp F03/0049) 5 Execute External program intrinsic 4 Disassoc/dealloc actual => not Present 4 Non-null Initial Targets 4 Resolve generic without invoking a procedure or evaluating arguments 4 "Use, Not …" 4 Simplified Kind Selection 3 Compiler Version [char constant in ISO_FORTRAN_ENV] 3

  36. Recent submission for consideration from UK (1) Allow references to functions returning an associated pointer to appear as actual arguments associated with INTENT(OUT) dummies. This is parallel to the way we treat regular pointers.Example:FUNCTION storage(key) RESULT(loc) INTEGER, INTENT(IN) :: key REAL, POINTER :: loc loc=>...END FUNCTION ! Make the following legalCALL RANDOM_NUMBER(storage(10))

  37. Recent submission for consideration from UK (2) Allow references to functions returning an associated pointer to appear as the lhs of assignment statement, where the value of the target is changed. This is parallel to the way we treat regular pointers.Example:FUNCTION storage(key) RESULT(loc) INTEGER, INTENT(IN) :: key REAL, POINTER :: loc loc=>...END FUNCTION ! Make the following legalstorage(5)=0.5

More Related