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.

segmentsegment12/19/2012More on Synchronisation• We have to be careful <strong>with</strong> one-sided updates• If we read remote data, was it valid?• Could another process send us data <strong>and</strong> overwritesomething we have not yet used?• How do we know when remote data has arrived?• The st<strong>and</strong>ard introduces execution segments to deal <strong>with</strong> this:segments are bounded by image control statementsThe st<strong>and</strong>ard can be summarized as follows:• If a variable is defined in a segment, it must not be referenced,defined, or become undefined in another segment unless thesegments are ordered – John Reid3Execution Segmentsimage 1program hotdouble precision :: a(n)double precision :: temp(n)[*]!...if (this_image() == 1) thendo i=1, num_images()read *,atemp(:)[i] = aend doend iftemp = temp + 273d0sync all! …call ensemble(temp)2image 2program hotdouble precision :: a(n)double precision :: temp(n)[*]!...if (this_image() == 1) thendo i=1, num_images()read *,atemp(:)[i] = aend doend if2temp = temp + 273d0sync all! …call ensemble(temp)orderingiimage synchronisation points42

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

Saved successfully!

Ooh no, something went wrong!