Ignore:
Timestamp:
Apr 1, 2019 4:35:16 PM (2 years ago)
Author:
knoop
Message:

Bugfix: added proper OpenACC support to disturb_field

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/disturb_field.f90

    r3655 r3849  
    134134!-- to store the disturbance
    135135    ALLOCATE( dist2(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
     136!$ACC DATA CREATE(dist2(nzb:nzt+1,nysg:nyng,nxlg:nxrg))
     137
     138!
     139!-- dist1 is initialized on the host (see below) and then updated on the device.
    136140    dist1 = 0.0_wp
     141    !$ACC KERNELS PRESENT(dist2)
    137142    dist2 = 0.0_wp
     143    !$ACC END KERNELS
    138144
    139145!
     
    188194
    189195!
     196!-- Update dist1 on the device, this is expected by exchange_horiz!
     197    !$ACC UPDATE DEVICE(dist1(nzb:nzt+1,nysg:nyng,nxlg:nxrg))
     198
     199!
    190200!-- Exchange of ghost points for the random perturbation
    191201
     
    197207!-- Loop has been splitted to make runs reproducible on HLRN systems using
    198208!-- compiler option -O3
     209     !$ACC PARALLEL LOOP COLLAPSE(2) PRIVATE(i, j, k) PRESENT(dist1, dist2)
    199210     DO  i = nxl, nxr
    200211        DO  j = nys, nyn
     
    217228    CALL exchange_horiz( dist2, nbgp )
    218229
     230    !$ACC PARALLEL LOOP COLLAPSE(2) PRIVATE(i, j, k) PRESENT(dist1, dist2)
    219231    DO  i = nxl, nxr
    220232       DO  j = nys, nyn
     
    248260!
    249261!-- Random perturbation is added to the array to be disturbed.
     262    !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k) PRESENT(field, dist1)
    250263    DO  i = nxlg, nxrg
    251264       DO  j = nysg, nyng
     
    256269    ENDDO
    257270
     271!$ACC END DATA
     272
    258273!
    259274!-- Deallocate the temporary array
Note: See TracChangeset for help on using the changeset viewer.