October 2, 2008
- Coarrays implemented
September 8, 2008
- Shiny new website
May 17, 2007
- Czech translation of manual
April 18, 2007
- German translation of manual
March 14, 2007
- Japanese translation of manual
March 13, 2007
- French translation of manual
February 1, 2007
- Russian translation of manual

The back end and libraries are now up for general testing on a variety of boxes and operating systems. The tarball is usually updated as the web page is. To download and install g95 on unix systems, run the following command (originally from Joost Vandevondele):

wget -O - http://ftp.g95.org/g95-x86-
linux.tgz | tar xvfz -

This will create a directory named 'g95-install' in the current directory. Run (or better yet make an appropriate symbolic link to) ./g95-
install/bin/i686-pc-linux-gnu-
g95 in order to run g95.

Quick Overview of Coarrays

Coarrays are an exciting parallel programming extension for fortran. They are special variables that can be shared across multiple instances of the same program, which are called 'images'. The main advantage of coarrays is the high level of integration with the fortran language itself, making programs vastly more readable than subroutine calls to parallel libraries. Synchronization primitives are also provided.

Coarrays look like fortran arrays, except with square brackets instead of round. The square brackets indicate a reference to a coarray on another (or maybe the same) image. A simple coarray declaration looks like:

INTEGER :: x[*]

This declares x to be an integer that is sharable across images. In an expression, x refers to the x on the current image. x[1] refers to the x on image one and so on. The *-notation is like a fortran assumed-size array-- the bounds of the coarray are determined at run time, not compile time.

Using a coarray variable without square brackets refers to the local value within expressions. Using a coarray variable with square brackets refers to the coarray variable on a particular image. On the right side of an assignment, the value is loaded from an image. On the left side of an assignment, the value is stored to that image. The statement:

x[1] = x[2]
causes the value of x on image two to be loaded, then stored to x on image one. The statement has the same effect when executed on any image.

A simple coarray program is:


integer :: m[*]

m = THIS_IMAGE()
print *, m
SYNC ALL

if (THIS_IMAGE() == 1) then
   do i=1, NUM_IMAGES()
      print *, i, m[i]
   enddo
endif
end

Run this code with:


  ./a.out --g95 images=10

on x86/linux and x86-64/linux with g95 v0.93 or greater (and ia64/linux and windows soon).

The THIS_IMAGE() intrinsic returns the image number of the current image, which is one through NUM_IMAGES(), which returns the total number of images in the calculation.

The SYNC ALL statement causes all images to wait until all images have reached the SYNC ALL statement. Once this has happened image one prints the value of m for all other images. All other images quietly terminate.

A huge advantage that coarrays have over message passing libraries is that the programs are much more readable. Message passing libraries have to be called, and the argument lists can be lengthy and hard to read. With coarrays, the square brackets tell you that cross-image communication is taking place and language statements are used to implement synchronization instead of subroutines.

For more information on coarrays and how to use them, see John Reid's paper "Coarrays in the next Fortran Standard" and my own Coarray Compendium. The compendium is a gentle but not exhaustive introduction to coarrays. It includes some example programs.


Standards issues:

Coarrays are part of the upcoming Fortran 2008 standard. The original proposal of Numrich and Reid was recently scaled back in the draft. Many of the more advanced features were moved to a Technical Report (TR), and the core features were left in the draft.

G95 currently supports coarrays with the exception of the LOCK and UNLOCK statements, which will be implemented soon.

G95's support for coarrays comes in two major flavors. The first flavor is a version optimized for a single machine with multiple cores or processors. Ports to other unixes should be easy-- mail a request. A windows port is also in progress. Currently x86/linux and x86-64/linux are supported.

The second flavor involves support for running images across homogeneous networks. This requires a central program, the 'G95 Coarray Console' to initialize the network and start images on the machines of the network.

The library modules for coarrays and the coarray console are closed source shareware programs. The SMP version is free to use and is currently limited to 30 images to make the programming easier. If you're on some monster machine, I'd be happy to compile a special version for you. I'm planning on removing the artificial limit soon.

The network version is free free for use with five images or less. Running with more than five images requires a license, available at http://www.g95.biz. Your support funds the maintenance and development of g95.


Links

G95 Coarray Console: x86 HTTP (2010-08-18 01:28)
G95 Coarray Console: x86-64 HTTP (2009-02-26 23:14)
G95 Coarray Console: IA64 HTTP (2010-08-18 01:34)
Coarrays in the next Fortan Standard (John Reid, N1747) HTTP (2008-11-06 10:06)
Coarray Compendium HTTP (2008-10-29 09:54)