Changeset 3849 for palm/trunk/SOURCE


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

Bugfix: added proper OpenACC support to disturb_field

Location:
palm/trunk/SOURCE
Files:
3 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
  • palm/trunk/SOURCE/init_3d_model.f90

    r3761 r3849  
    668668        ONLY :  init_surface_arrays, init_surfaces, surf_def_h, surf_lsm_h,    &
    669669                surf_usm_h, get_topography_top_index_ji
     670
     671#if defined( _OPENACC )
     672    USE surface_mod,                                                           &
     673        ONLY :  bc_h
     674#endif
    670675
    671676    USE surface_data_output_mod,                                               &
     
    21692174         TRIM( initializing_actions ) /= 'cyclic_fill' )  THEN
    21702175
     2176!
     2177!--    Needed for both disturb_field and pres
     2178!$ACC DATA &
     2179!$ACC CREATE(tend(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
     2180!$ACC COPY(u(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
     2181!$ACC COPY(v(nzb:nzt+1,nysg:nyng,nxlg:nxrg))
     2182
    21712183       CALL location_message( 'creating initial disturbances', .FALSE. )
    21722184       CALL disturb_field( 'u', tend, u )
    21732185       CALL disturb_field( 'v', tend, v )
    21742186       CALL location_message( 'finished', .TRUE. )
     2187
     2188!$ACC DATA &
     2189!$ACC CREATE(d(nzb+1:nzt,nys:nyn,nxl:nxr)) &
     2190!$ACC COPY(w(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
     2191!$ACC COPY(p(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
     2192!$ACC COPYIN(rho_air(nzb:nzt+1), rho_air_zw(nzb:nzt+1)) &
     2193!$ACC COPYIN(ddzu(1:nzt+1), ddzw(1:nzt+1)) &
     2194!$ACC COPYIN(wall_flags_0(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
     2195!$ACC COPYIN(bc_h(0:1)) &
     2196!$ACC COPYIN(bc_h(0)%i(1:bc_h(0)%ns)) &
     2197!$ACC COPYIN(bc_h(0)%j(1:bc_h(0)%ns)) &
     2198!$ACC COPYIN(bc_h(0)%k(1:bc_h(0)%ns)) &
     2199!$ACC COPYIN(bc_h(1)%i(1:bc_h(1)%ns)) &
     2200!$ACC COPYIN(bc_h(1)%j(1:bc_h(1)%ns)) &
     2201!$ACC COPYIN(bc_h(1)%k(1:bc_h(1)%ns))
    21752202
    21762203       CALL location_message( 'calling pressure solver', .FALSE. )
     
    21792206       n_sor = nsor
    21802207       CALL location_message( 'finished', .TRUE. )
     2208
     2209!$ACC END DATA
     2210!$ACC END DATA
    21812211
    21822212    ENDIF
  • palm/trunk/SOURCE/pres.f90

    r3655 r3849  
    235235
    236236    CALL cpu_log( log_point(8), 'pres', 'start' )
    237 
    238 !$ACC DATA COPYOUT(d, tend) &
    239 !$ACC COPY(u, v, w, p) &
    240 !$ACC COPYIN(rho_air, rho_air_zw, ddzu, ddzw, wall_flags_0)
    241 
    242 !$ACC DATA &
    243 !$ACC COPYIN(bc_h(0:1)) &
    244 !$ACC COPYIN(bc_h(0)%i(1:bc_h(0)%ns)) &
    245 !$ACC COPYIN(bc_h(0)%j(1:bc_h(0)%ns)) &
    246 !$ACC COPYIN(bc_h(0)%k(1:bc_h(0)%ns)) &
    247 !$ACC COPYIN(bc_h(1)%i(1:bc_h(1)%ns)) &
    248 !$ACC COPYIN(bc_h(1)%j(1:bc_h(1)%ns)) &
    249 !$ACC COPYIN(bc_h(1)%k(1:bc_h(1)%ns))
    250 
    251237
    252238!
     
    983969    CALL cpu_log( log_point(8), 'pres', 'stop' )
    984970
    985 !$ACC END DATA
    986 !$ACC END DATA
    987 
    988971 END SUBROUTINE pres
Note: See TracChangeset for help on using the changeset viewer.