stfc / PSycloneBench

Various benchmarks used to inform PSyclone optimisations
BSD 3-Clause "New" or "Revised" License
6 stars 5 forks source link

Add explicit data-movement version of tracer-advection benchmark. #80

Open arporter opened 2 years ago

arporter commented 2 years ago

76 is adding OpenACC versions of the tracer-advection benchmark. Currently these all use managed memory but psyclone/#310 is adding support for explicit control of data movement.

arporter commented 2 years ago

I've created 80_explicit_data_mv branch for this, based off the one where I'm adding tracer advection for #75.

arporter commented 2 years ago

I've added a new target for the 'compute in subroutine' version of the benchmark. This processes and compiles on my laptop although we generate very sub-optimal code in the driver routine:

OPEN(UNIT = 24, FILE = 'output.dat', FORM = 'formatted')
checksum = 0.0d0
!$acc update if_present device(checksum)
!$acc update if_present host(jpk)
do jk = 1, jpk - 1, 1
  !$acc update if_present host(jpj)
  do jj = 2, jpj - 1, 1
    !$acc update if_present host(jpi)
    do ji = 2, jpi - 1, 1
      !$acc update if_present host(checksum,mydomain)
      checksum = checksum + mydomain(ji,jj,jk)
      !$acc update if_present device(checksum)
      STOP 'PSyclone: tracer_advection: manually add ACC update statements (if required) for the following CodeBlock...'
      WRITE(24, *) mydomain(ji, jj, jk)
arporter commented 2 years ago

It turns out that 'enter data' does not work well with automatic arrays. It seems that the best solution to this is to implement the 'raise-to-module-scope' transformation.