Report from WG5 convener

Similar documents
Co-arrays to be included in the Fortran 2008 Standard

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

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

Parallel Programming in Fortran with Coarrays

ISO/IEC : TECHNICAL CORRIGENDUM 2

Technical Report on further interoperability with C

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

Information technology Programming languages Fortran Part 1: Base language

Technical Specification on further interoperability with C

Fortran 2008 Overview February 17, 2016

Lecture V: Introduction to parallel programming with Fortran coarrays

TS Further Interoperability of Fortran with C WG5/N1917

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

The new features of Fortran 2003

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

Compiler Support for the Fortran 2003 and 2008 Standards Revision 17

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

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

The new features of Fortran 2008

More Coarray Features. SC10 Tutorial, November 15 th 2010 Parallel Programming with Coarray Fortran

Chapter 4. Fortran Arrays

Coarrays in the next Fortran Standard

NAGWare f95 Recent and Future Developments

Compiler Support for the Fortran 2003 and 2008 Standards Revision 21

Proceedings of the GCC Developers Summit

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

Programming for High Performance Computing in Modern Fortran. Bill Long, Cray Inc. 17-May-2005

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

NAGWare f95 and reliable, portable programming.

PGI Accelerator Programming Model for Fortran & C

Co-Array Fortran for parallel programming

Migrating A Scientific Application from MPI to Coarrays. John Ashby and John Reid HPCx Consortium Rutherford Appleton Laboratory STFC UK

Appendix D. Fortran quick reference

Co-array Fortran for parallel programming

Coarrays in the next Fortran Standard


Chapter 8 :: Composite Types

Current Developments in Fortran Standards. David Muxworthy 15 June 2012

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

Fortran 90 - A thumbnail sketch

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

Chapter 3. Fortran Statements

New Programming Paradigms: Partitioned Global Address Space Languages

Implementing the Standards... including Fortran 2003

Parallel Programming with Coarray Fortran

Compiler Support for the Fortran 2003, 2008, TS29113, and 2018 Standards Revision 24

Programming Languages

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

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

Computers Programming Course 5. Iulian Năstac

An Open64-based Compiler and Runtime Implementation for Coarray Fortran

PGI Fortran & C Accelerator Programming Model. The Portland Group

MPI: A Message-Passing Interface Standard

0. Overview of this standard Design entities and configurations... 5


Review More Arrays Modules Final Review

Control Abstraction. Hwansoo Han

Short Notes of CS201

Parallel Programming Features in the Fortran Standard. Steve Lionel 12/4/2012

CS201 - Introduction to Programming Glossary By

A Brief Introduction to Fortran of 15

Fortran Coding Standards and Style

Types II. Hwansoo Han

Chapter 6. A Brief Introduction to Fortran David A. Padua

6.1 Expression Evaluation. 1 of 21

C-LANGUAGE CURRICULAM

Informatics Ingeniería en Electrónica y Automática Industrial

REGCM 4.3 Developer Guide

A Comparison of Co-Array Fortran and OpenMP Fortran for SPMD Programming

Intel Visual Fortran Composer XE 2011 for Windows* Installation Guide and Release Notes

SE352b: Roadmap. SE352b Software Engineering Design Tools. W3: Programming Paradigms

Language Vulnerabilities Report: The Fortran Annex

Goals for This Lecture:

PROBLEM SOLVING WITH FORTRAN 90

The Designer's Guide to VHDL Second Edition

C Programming SYLLABUS COVERAGE SYLLABUS IN DETAILS

Implementation and Evaluation of Coarray Fortran Translator Based on OMNI XcalableMP. October 29, 2015 Hidetoshi Iwashita, RIKEN AICS

The New Features of Fortran 2003

Subroutines and Control Abstraction. CSE 307 Principles of Programming Languages Stony Brook University

Language Basics. /* The NUMBER GAME - User tries to guess a number between 1 and 10 */ /* Generate a random number between 1 and 10 */

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

CS 3360 Design and Implementation of Programming Languages. Exam 1

Index. classes, 47, 228 coarray examples, 163, 168 copystring, 122 csam, 125 csaxpy, 119 csaxpyval, 120 csyscall, 127 dfetrf,14 dfetrs, 14

Java Primer 1: Types, Classes and Operators

UNIT- 3 Introduction to C++

Chapter 3:: Names, Scopes, and Bindings

Programming Languages

Computers Programming Course 6. Iulian Năstac

NOTE: Answer ANY FOUR of the following 6 sections:

CMSC 331 Final Exam Section 0201 December 18, 2000

Strategies & Obstacles in Converting a Large Production Application to FORTRAN 90

Chapter 1 INTRODUCTION. SYS-ED/ Computer Education Techniques, Inc.

Course Title: C Programming Full Marks: Course no: CSC110 Pass Marks: Nature of course: Theory + Lab Credit hours: 3

Additional Parallel Features in Fortran An Overview of ISO/IEC TS 18508

dbx90: Fortran debugger March 9, 2009

Chapter 9 :: Subroutines and Control Abstraction

Parallel Programming Languages. HPC Fall 2010 Prof. Robert van Engelen

The New Features of Fortran 2000

ParaFEM Coding Standard for Fortran 90. Contents. 1.0 Introduction. 2.0 Documentation. 2.1 External Documentation

Pointers. Memory. void foo() { }//return

Transcription:

Report from WG5 convener Content of Fortran 2008 Framework was decided at last years WG5 meeting and was not substantially changed at this year s WG5 meeting. Two large items bits and intelligent macros were left as do if time, which made the May J3 meeting important. In the event both were deemed to be ready, but interoperability of pointers, allocatables, assumed-shape arrays, and optional arguments was not ready and has been deferred to a TR. Interpretations Corrigendum 1 has been published but is unsatisfactory because of typographical changes and will be republished. Corrigendum 2 is ready and is going through a final WG5 vote.

Co-array discussion at the May J3 meeting There was a J3 discussion over moving co-arrays to a TR or another part of the standard, despite the WG5 decision at the Feb. meeting that it be a first priority item. However, the major vendors reported pressure from users to provide co-arrays and it was decided (straw vote 6-3-2) to keep them. A significant argument was that it would be unsatisfactory to renege on the decision of last year that co-arrays would be there.

The language features that have been chosen for Fortran 2008: co-arrays, bits, intelligent macros,... John Reid, JKR Associates, UK Abstract Following the WG5 meeting in Fairfax in February and the J3 meeting in May, the new features for Fortran 2008 have been chosen. This talks aims to give an overview of the new features. BCS Fortran AGM 8 June 2006

4 Items seen to need over a year to develop UK-01 Co-arrays J3-47 BITS (originally TYPELESS objects) J3-14 Intelligent macros (supersedes parameterized modules) Items seen to need over 6 months to develop J3-43 Contiguous attribute J3-46 DO CONCURRENT Item to be developed as a TR J3-41/2 Interoperability of pointers, allocatables, assumed-shape arrays, and optional arguments

5 Minor technical changes, 1 J3-03 Execute external program J3-12 Allocatable/pointer in generic resolution J3-13 Internal procedure as actual argument J3-15 Updating complex parts J3-16 Disassociated or deallocated actual argument associated with nonpointer nonallocatable optional dummy argument is considered not to be present J3-18 Non-null initial targets for pointers J3-19 Extend intrinsics such as ASIN to complex arguments J3-22 Allow a polymorphic allocatable variable in intrinsic assignment

6 Minor technical changes, 2 J3-38 Libm: Bessel, erf, gamma, hypot J3-39 Rank plus co-rank limited to 15. J3-48 Writing Comma Separated Value CSV files RU-03 Obsolescent: ENTRY UK-05 Guarantee support of selected_int_kind(18) UK-07 Pointer function references as actual arguments UK-08 Pointer function references assignment contexts UK-11 Elemental procedures that are not pure UK-12 Recursive I/O to different unit

7 Co-arrays basics SPMD Single Program, Multiple Data Replicated to a number of images Number of images fixed during execution Each image has its own set of local variables All images start by executing main program and mostly execute asynchronously Variables declared as co-arrays are accessible on another image through second set of array subscripts, delimited by [ ] Statements: sync_all, sync_team, sync_images, notify, query, sync_memory Critical construct Collectives: co_all, co_any, etc., form_team Intrinsics: this_image, num_images, image_index, co_lbound, co_ubound

8 Examples of co-array syntax real :: r[*], s[0:*], x(n)[*] type(u) :: u2(m,n)[np,*]! Co-arrays always have assumed! co-size (equal to number of images) real :: t integer p, q, index(n)! Local variables : t = s[p] x(:) = x(:)[p]! Reference without [] is to local part x(:)[p] = x(:) u2(i,j)%b(:) = u2(i,j)[p,q]%b(:) Images have indices 1, 2,..., num_images() and co-subscript lists are mapped to image indices by the usual rule.

9 Example: redistribution Consider redistributing the array a(1:kx,1:ky)[1:kz] from b(1:ky,1:kz)[1:kx], where max(kx,kz) num_images(). iz = this_image(a) if (iz<=kz) then do ix = 1, kx a(ix,:) = b(:,iz)[ix] end do end if The if construct is needed so that no action is taken on the images on which we have no data.

10 Implementation model The compiler may arrange that a co-array, when originally declared, occupies the same set of addresses within each image: A co-array must have the same set of bounds on all images There is an implicit synchronization of all images at an allocate or deallocate statement so that they all perform their allocations and deallocations in the same order. On a shared-memory machine, a co-array may be implemented as a single large array. On any machine, a co-array may be implemented so that each image can calculate the memory address of an element on any image.

11 Synchronization The images normally execute asynchronously. If one image relies on another image having taken an action, explicit synchronization is needed. For example, to read data on image 1 and get it to other images: if(this_image()==1) read(*,*)p sync_all p = p[1]

12 Critical sections Exceptionally, it may be necessary to limit execution to one image at a time: critical p[6] = p[6] + 1 : end critical

13 Dynamic co-arrays Only dynamic form: the allocatable co-array. Automatic arrays or array-valued functions would require automatic synchronization, which would be awkward. Co-Arrays and SAVE Unless allocatable or a dummy argument, a coarray must be given the SAVE attribute. This is to avoid the need for synchronization when co-arrays go out of scope on return from a procedure.

14 Optimization Most of the time, the compiler can optimize as if the image is on its own, using its temporary storage such as cache, registers, etc. Structure components Types may have allocatable co-array components, but structures of this type must be scalar. However, a co-array may be of a derived type with allocatable or pointer components, which allows the size to vary from image to image. Pointers must have targets in their own image: q => z[i]%p! Not allowed allocate(z[i]%p)! Not allowed

15 BITS There will be a new intrinsic type, BITS. The number of bits is specified by the kind type parameter with default NUMERIC_STORAGE_SIZE. Up to 4*NUMERIC_STORAGE_SIZE bits must be supported. Processor may support more. Concatenation operator // available. ==, /= available for bits with bits, real, integer, or complex. >, >=, <, <=, available for bits with bits, real, or integer..and.,.or.,.xor.,.eqv.,.neqv. available for bits with bits or integer..not. available for bits. If the kinds differ, the shorter is padded on the left with zeros.

16 Assignment to bits Assignment to bits available from bits, real, integer, or complex. If the kinds differ, digits on the left are discarded or padded with zeros. For types other than bits, the internal representation is used. Interoperability There are 26 C types that are interoperable with bits.

17 New intrinsics BITS_KIND(X[,KIND]) Bits kind type parameter value compatible with the argument SELECTED_BITS_KIND(N) Bits kind type parameter value, given number of bits BITS(A [,KIND]) Conversion to bits type DSHIFTL (I, J, SHIFT) Double left shift DSHIFTR (I, J, SHIFT) Double right shift MERGE_BITS (I,J,MASK) Merge bits under mask SHIFTA (I, SHIFT) Arithmetic right shift SHIFTL (I, SHIFT) Left shift SHIFTR (I, SHIFT) Right shift LEADZ (I [,KIND]) Number of leading zero bits POPCNT (I [,KIND]) Number of one bits POPPAR (I [,KIND]) Parity of one bits TRAILZ (I [,KIND]) Number of trailing zero bits MASKL (I [,KIND]) Left justified bit mask MASKR (I [,KIND]) Right justified bit mask IALL(ARRAY,DIM[,MASK]) Bitwise AND of array elements or IALL(ARRAY[,MASK]) IANY(ARRAY,DIM[,MASK]) Bitwise OR of array elements or IANY(ARRAY[,MASK]) IPARITY(ARRAY,DIM,[,MASK]) Bitwise exclusive OR of or IPARITY(ARRAY[,MASK]) array elements PARITY (MASK [,DIM]) True if an odd number of values is true

18 Intelligent macros Parameterized modules were proposed to provide a facility whereby a module or subprogram can be developed in a generic form, and then applied to any appropriate type. Malcolm pointed out that this is roughly equivalent to a built-in macro facility, but it misses out on useful things one can do with macros. By intelligent, he means that they know about Fortran and are scoped. He wants them to be able to create modules, types, procedures, and sections of code.

19 The elements are the macro definition, e.g. DEFINE MACRO :: single_linked_list(type) TYPE type%%_list type :: value TYPE(type%%_list),POINTER :: next END TYPE END MACRO and the later macro expansion: EXPAND single_linked_list(real) where the EXPAND statement is replaced by the sequence of statements TYPE real_list real :: value TYPE(real_list),POINTER :: next END TYPE Note that type is a macro dummy argument whose scope is the macro definition. On expansion it is replaced by a token or a sequence of tokens and %% is used for concatenation during expansion.

20 Macro IF and DO constructs Macros may contain IF and DO constructs that are processed during macro expansion. Here it is likely that several macro body statements may be needed to build a single statement, e.g. CALL impure_scalar_procedure && (array(index%%1 && MACRO DO i=2,rank,index%i && MACRO END DO ),traceinfo) The double amphersands indicate that a single statement is being created.