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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

12/19/2012Pointer Coarray Structure Components• We are allowed to have a coarray that contains componentsthat are pointers• Note that the pointers have to point to local data• We can then access one of the pointers on a remote image toget at the data it points to• This technique is useful when adding coarrays into an existingMPI code• We can insert coarray code deep in call tree <strong>with</strong>outchanging many subroutine argument lists• We don’t need new coarray declarations• Example follows...19Pointer Coarray Structure Components...• Existing non-coarray arrays u,v,w• Create a type (coords) to hold pointers (x,y,z) that we use to pointto x,y,z. We can use the vects coarray to access u, v, w.subroutine calc(u,v,w)real, intent(in), target, dimension(100) :: u,v,wtype coordsreal, pointer, dimension(:) :: x,y,zend type coordstype(coords), save :: vects[*]! …vects%x => u ; vects%y => v ; vects%z => wsync allfirstx = vects[1]%x(1)2010

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

Saved successfully!

Ooh no, something went wrong!