Co-array Fortran
Encyclopedia
Co-array Fortran formerly known as F--, is an extension of Fortran
Fortran
Fortran is a general-purpose, procedural, imperative programming language that is especially suited to numeric computation and scientific computing...

 95/2003 for parallel processing
Parallel processing
Parallel processing is the ability to carry out multiple operations or tasks simultaneously. The term is used in the contexts of both human cognition, particularly in the ability of the brain to simultaneously process incoming stimuli, and in parallel computing by machines.-Parallel processing by...

 created by Robert Numrich and John Reid in 1990s. The Fortran 2008 standard (ISO/IEC 1539-1:2010) now includes coarrays (spelt 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
Computer program
A computer program is a sequence of instructions written to perform a specified task with a computer. A computer requires programs to function, typically executing the program's instructions in a central processor. The program has an executable form that the computer can use directly to execute...

 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 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 has been available for a long time and was implemented in some Fortran compiler
Compiler
A compiler is a computer program that transforms source code written in a programming language into another computer language...

s such as those from Cray
Cray
Cray Inc. is an American supercomputer manufacturer based in Seattle, Washington. The company's predecessor, Cray Research, Inc. , was founded in 1972 by computer designer Seymour Cray. Seymour Cray went on to form the spin-off Cray Computer Corporation , in 1989, which went bankrupt in 1995,...

 (since release 3.1). Since the inclusion of coarrays in the Fortran 2008 standard, the number of implementation is growing. The first open-source compiler which implemented coarrays as specified in the Fortran 2008 standard for Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

 architectures is G95
G95
G95 is a free, portable, open source Fortran 95 compiler. It implements the Fortran 95 standard, part of the Fortran 2003 standard and some old and new extensions including proposed features for the Fortran 2008 standard like Co-array Fortran....

.

Example


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[]" accesses the
! variable in a specific image; "name[this_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[i] = 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

An alternate perspective
A group at Rice University
Rice University
William Marsh Rice University, commonly referred to as Rice University or Rice, is a private research university located on a heavily wooded campus in Houston, Texas, United States...

 is pursuing 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.
They don't believe that the set of extensions agreed upon by the committee are the right ones.
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
    Central processing unit
    The central processing unit is the portion of a computer system that carries out the instructions of a computer program, to perform the basic arithmetical, logical, and input/output operations of the system. The CPU plays a role somewhat analogous to the brain in the computer. The term has been in...

     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
    Mutual exclusion
    Mutual exclusion algorithms are used in concurrent programming to avoid the simultaneous use of a common resource, such as a global variable, by pieces of computer code called critical sections. A critical section is a piece of code in which a process or thread accesses a common resource...

     hinders scalable parallelism by associating mutual exclusion with code regions rather than data objects.
  • Fortran 2008's sync images statement doesn't 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
  • Unified Parallel C
    Unified Parallel C
    Unified Parallel C is an extension of the C programming language designed for high-performance computing on large-scale parallel machines, including those with a common global address space and those with distributed memory...

  • Fortress (programming language)
  • Chapel programming language
    Chapel programming language
    Chapel is a new parallel programming language developed by Cray. It is being developed as part of the Cray Cascade project, a participant in DARPA's High Productivity Computing Systems program, which has the goal of increasing supercomputer productivity by the year 2010...

  • X10 (programming language)
    X10 (programming language)
    X10 is a programming language being developed by IBM at the Thomas J. Watson Research Center as part of the Productive, Easy-to-use, Reliable Computing System project funded by DARPA's High Productivity Computing Systems program...

  • Array programming
    Array programming
    In computer science, array programming languages generalize operations on scalars to apply transparently to vectors, matrices, and higher dimensional arrays....

  • Parallel Computing
    Parallel computing
    Parallel computing is a form of computation in which many calculations are carried out simultaneously, operating on the principle that large problems can often be divided into smaller ones, which are then solved concurrently . There are several different forms of parallel computing: bit-level,...

  • Partitioned global address space
    Partitioned global address space
    In computer science, a partitioned global address space is a parallel programming model. It assumes a global memory address space that is logically partitioned and a portion of it is local to each processor. The novelty of PGAS is that the portions of the shared memory space may have an affinity...

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK