13.07.2015 Views

PGAS Programming with UPC and Fortran Coarrays

PGAS Programming with UPC and Fortran Coarrays

PGAS Programming with UPC and Fortran Coarrays

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

12/19/2012<strong>Coarrays</strong> <strong>and</strong> Procedures• An explicit interface is required if a dummy argument is acoarray• Dummy argument associated <strong>with</strong> coarray, not a copy• avoids synchronisation on entry <strong>and</strong> return• Other restrictions on passing coarrays are:• the actual argument should be contiguous• a(:,2) is OK, but a(2,:) is not contiguous• or the dummy argument should be assumed shape... to avoid copying• Function results cannot be coarrays2121<strong>Coarrays</strong> as Dummy Arguments• As <strong>with</strong> st<strong>and</strong>ard <strong>Fortran</strong> arrays, the coarray dummy argumentsin procedures can be:• Explicit shape: each dimension of a coarray declared <strong>with</strong> explicit value• Assumed shape: extents <strong>and</strong> bounds determined by actual array• Assumed size: only size determined from actual array• Allocatable: the size <strong>and</strong> shape can be determined at run-timesubroutine s(n, a, b, c, d)integer :: nreal :: a(n) [n,*] ! explicit shape - permittedreal :: b(:,:) [*] ! assumed shape - permittedreal :: c(n,*) [*] ! assumed size - permittedreal, allocatable :: d(:) [:,:] ! allocatable - permitted222211

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!