HOME

TheInfoList



OR:

Coarray Fortran (CAF), formerly known as F--, started as an extension of Fortran 95/2003 for parallel processing created by Robert Numrich and John Reid in the 1990s. The Fortran 2008 standard (ISO/IEC 1539-1:2010) now includes coarrays (spelled without hyphen), as decided at the May 2005 meeting of the ISO Fortran Committee; the syntax in the Fortran 2008 standard is slightly different from the original CAF proposal. A CAF
program Program, programme, programmer, or programming may refer to: Business and management * Program management, the process of managing several related projects * Time management * Program, a part of planning Arts and entertainment Audio * Programm ...
is interpreted as if it were replicated a number of times and all copies were executed asynchronously. Each copy has its own set of data objects and is termed an ''image''. The
array An array is a systematic arrangement of similar objects, usually in rows and columns. Things called an array include: {{TOC right Music * In twelve-tone and serial composition, the presentation of simultaneous twelve-tone sets such that the ...
syntax of Fortran is extended with additional trailing subscripts in square brackets to provide a concise representation of references to data that is spread across images. The CAF extension was implemented in some Fortran
compiler In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs tha ...
s such as those from
Cray Cray Inc., a subsidiary of Hewlett Packard Enterprise, is an American supercomputer manufacturer headquartered in Seattle, Washington. It also manufactures systems for data storage and analytics. Several Cray supercomputer systems are listed i ...
(since release 3.1). Since the inclusion of coarrays in the Fortran 2008 standard, the number of implementations is growing. The first
open-source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized so ...
compiler which implemented coarrays as specified in the Fortran 2008 standard for Linux architectures is G95. Currently, GNU Fortran provides wide coverage of Fortran's coarray features in single- and multi-image configuration (the latter based on the OpenCoarrays library). Another implementation of coarrays and related parallel extensions from Fortran 2008 is available in the OpenUH compiler (a branch of Open64) developed at the
University of Houston The University of Houston (UH) is a Public university, public research university in Houston, Texas. Founded in 1927, UH is a member of the University of Houston System and the List of universities in Texas by enrollment, university in Texas ...
.


Implementation in compilers

CAF is often implemented on top of a Message Passing Interface (MPI) library for portability. Some implementations, such as the ones available in the GNU Fortran and OpenUH compilers, may run on top of other low-level layers (for example, GASNet) designed for supporting partitioned global address space languages.


Examples

A simple example is given below. CAF is used in CGPACK, an open source package for simulating polycrystalline materials developed at the
University of Bristol , mottoeng = earningpromotes one's innate power (from Horace, ''Ode 4.4'') , established = 1595 – Merchant Venturers School1876 – University College, Bristol1909 – received royal charter , type ...
. program Hello_World implicit none integer :: i ! Local variable character(len=20) :: name ! scalar coarray, one "name" for each image. ! Note: "name" is the local variable while "name index> accesses the ! variable in a specific image; "name his_image() is the same as "name". ! Interact with the user on Image 1; execution for all others pass by. if (this_image()

1) then write(*,'(a)',advance='no') 'Enter your name: ' read(*,'(a)') name ! Distribute information to other images do i = 2, num_images() name = name end do end if sync all ! Barrier to make sure the data have arrived. ! I/O from all images, executing in any order, but each record written is intact. write(*,'(3a,i0)') 'Hello ',trim(name),' from image ', this_image() end program Hello_world
The program above scales poorly because the loop that distributes information executes sequentially. Writing scalable programs often requires a sophisticated understanding of parallel algorithms, a detailed knowledge of the underlying network characteristics, and special tuning for application characteristics such as the size of data transfers. For most application developers, letting the compiler or runtime library decide the best algorithm proves more robust and high-performing. Fortran 2018 will offer collective communication subroutines that empower compiler and runtime library teams to encapsulate efficient parallel algorithms for collective communication and distributed computation in a set of collective subroutines. These subroutines and other new parallel programming features are summarized in a technical specification that the Fortran standards committee has voted to incorporate into Fortran 2018. These enable the user to write a more efficient version of the above algorithm program Hello_World implicit none character(len=20) :: name ! scalar coarray, one "name" for each image. ! Note: "name" is the local variable while "name index> accesses the ! variable in a specific image; "name his_image() is the same as "name". ! Interact with the user on Image 1; execution for all others pass by. if (this_image()

1) then write(*,'(a)',advance='no') 'Enter your name: ' read(*,'(a)') name end if ! Distribute information to all images call co_broadcast(name,source_image=1) ! I/O from all images, executing in any order, but each record written is intact. write(*,'(3a,i0)') 'Hello ',trim(name),' from image ', this_image() end program Hello_world
where the lack of explicit synchronization offers the potential for higher performance due to less coordination between the images. Furthermore, TS 18508 guarantees that "A transfer from an image cannot occur before the collective subroutine has been invoked on that image." This implies some partial synchronization inside co_broadcast, but could be higher performing than the "sync all" in the prior example. TS 18508 also incorporates several other new features that address issues targeted by the CAF 2.0 effort described below. Examples include teams of images and events.


An alternate perspective

In 2011,
Rice University William Marsh Rice University (Rice University) is a Private university, private research university in Houston, Houston, Texas. It is on a 300-acre campus near the Houston Museum District and adjacent to the Texas Medical Center. Rice is ranke ...
pursued an alternate vision of coarray extensions for the Fortran language. Their perspective is that the Fortran 2008 standard committee's design choices were shaped more by the desire to introduce as few modifications to the language as possible than to assemble the best set of extensions to support parallel programming. In their view, both Numrich and Reid's original design and the coarray extensions proposed for Fortran 2008 suffer from the following shortcomings: * There is no support for
processor Processor may refer to: Computing Hardware * Processor (computing) **Central processing unit (CPU), the hardware within a computer that executes a program *** Microprocessor, a central processing unit contained on a single integrated circuit (I ...
subsets; for instance, coarrays must be allocated over all images. * The coarray extensions lack any notion of global pointers, which are essential for creating and manipulating any kind of linked data structure. * Reliance on named critical sections for
mutual exclusion In computer science, mutual exclusion is a property of concurrency control, which is instituted for the purpose of preventing race conditions. It is the requirement that one thread of execution never enters a critical section while a concurren ...
hinders scalable parallelism by associating mutual exclusion with code regions rather than data objects. * Fortran 2008's sync images statement does not provide a safe synchronization space. As a result, synchronization operations in user's code that are pending when a library call is made can interfere with synchronization in the library call. * There are no mechanisms to avoid or tolerate latency when manipulating data on remote images. * There is no support for collective communication. To address these shortcomings, the Rice University group is developing a clean-slate redesign of the Coarray Fortran programming model. Rice's new design for Coarray Fortran, which they call Coarray Fortran 2.0, is an expressive set of coarray-based extensions to Fortran designed to provide a productive parallel programming model. Compared to Fortran 2008, Rice's new coarray-based language extensions include some additional features: * process subsets known as teams, which support coarrays, collective communication, and relative indexing of process images for pair-wise operations, * topologies, which augment teams with a logical communication structure, * dynamic allocation/deallocation of coarrays and other shared data, * team-based coarray allocation and deallocation, * global pointers in support of dynamic data structures, * support for latency hiding and avoidance, and ** asynchronous copies, ** asynchronous collective operations, and ** function shipping. * enhanced support for synchronization for fine-grain control over program execution. ** safe and scalable support for mutual exclusion, including locks and lock sets, ** events, which provide a safe space for point-to-point synchronization, ** cofence, which forces local completion of asynchronous operations, ** finish, a barrier-like SPMD construct that forces completion of asynchronous operations across a team,


See also

*
Array programming In computer science, array programming refers to solutions which allow the application of operations to an entire set of values at once. Such solutions are commonly used in scientific and engineering settings. Modern programming languages that ...
*
Chapel A chapel is a Christian place of prayer and worship that is usually relatively small. The term has several meanings. Firstly, smaller spaces inside a church that have their own altar are often called chapels; the Lady chapel is a common type ...
*
Fortress A fortification is a military construction or building designed for the defense of territories in warfare, and is also used to establish rule in a region during peacetime. The term is derived from Latin ''fortis'' ("strong") and ''facere'' ...
*
Parallel computing Parallel computing is a type of computation in which many calculations or processes are carried out simultaneously. Large problems can often be divided into smaller ones, which can then be solved at the same time. There are several different f ...
* Partitioned global address space * Unified Parallel C * X10


References

{{Reflist


General


Co-Array Fortran homepage (Not working anymore)

ISO Fortran Committee

ANSI/INCITS Fortran Committee

Instructional videos on CAF in the Fortran Standard by John Reid (see Appendix B)

Coarray in GNU Fortran

CoarrayLib in GNU Fortran

OpenCoarrays library

NAG Fortran Compiler
Fortran programming language family