Changeset 1128


Ignore:
Timestamp:
Apr 12, 2013 6:19:32 AM (11 years ago)
Author:
raasch
Message:

asynchronous transfer of ghost point data for acc-optimized version

Location:
palm/trunk/SOURCE
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/Makefile

    r1112 r1128  
    2020# Current revisions:
    2121# ------------------
    22 #
     22# dependencies for time_integration modified
    2323#
    2424# Former revisions:
     
    353353production_e.o: modules.o wall_fluxes.o
    354354prognostic_equations.o: modules.o advec_s_pw.o advec_s_up.o advec_u_pw.o \
    355         advec_ws.o \
    356355        advec_u_up.o advec_v_pw.o advec_v_up.o advec_w_pw.o advec_w_up.o  \
    357         buoyancy.o calc_precipitation.o calc_radiation.o coriolis.o \
     356        advec_ws.o buoyancy.o calc_precipitation.o calc_radiation.o coriolis.o \
    358357        diffusion_e.o diffusion_s.o diffusion_u.o diffusion_v.o diffusion_w.o \
    359         eqn_state_seawater.o impact_of_latent_heat.o \
    360         plant_canopy_model.o production_e.o \
    361         subsidence.o user_actions.o \
    362         microphysics.o
     358        eqn_state_seawater.o impact_of_latent_heat.o microphysics.o \
     359        plant_canopy_model.o production_e.o subsidence.o user_actions.o
    363360random_gauss.o: random_function.o
    364361read_3d_binary.o: modules.o random_function.o
     
    373370swap_timelevel.o: modules.o
    374371temperton_fft.o: modules.o
    375 time_integration.o: modules.o prognostic_equations.o user_actions.o \
    376         interaction_droplets_ptq.o
     372time_integration.o: modules.o advec_ws.o buoyancy.o interaction_droplets_ptq.o \
     373        production_e.o prognostic_equations.o user_actions.o
    377374timestep.o: modules.o
    378375timestep_scheme_steering.o: modules.o
  • palm/trunk/SOURCE/advec_ws.f90

    r1116 r1128  
    2020! Current revisions:
    2121! ------------------
     22! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
     23! j_north
    2224!
    2325!
     
    24522454       !$acc kernels present( ddzw, sk, tend, u, v, w, wall_flags_0 )
    24532455       !$acc loop
    2454        DO  i = nxl, nxr
    2455           DO  j = nys, nyn
     2456       DO  i = i_left, i_right
     2457          DO  j = j_south, j_north
    24562458             !$acc loop vector( 32 )
    24572459             DO  k = nzb+1, nzt
     
    31533155       !$acc  kernels present( ddzw, tend, u, v, w, wall_flags_0 )
    31543156       !$acc  loop
    3155        DO i = nxlu, nxr
    3156           DO  j = nys, nyn
     3157       DO i = i_left, i_right
     3158          DO  j = j_south, j_north
    31573159             !$acc  loop vector( 32 )
    31583160             DO  k = nzb+1, nzt
     
    38703872       !$acc kernels present( ddzw, tend, u, v, w, wall_flags_0 )
    38713873       !$acc loop
    3872        DO  i = nxl, nxr
    3873           DO  j = nysv, nyn
     3874       DO  i = i_left, i_right
     3875          DO  j = j_south, j_north
    38743876             !$acc loop vector( 32 )
    38753877             DO  k = nzb+1, nzt
     
    45654567       !$acc kernels present( ddzu, tend, u, v, w, wall_flags_0 )
    45664568       !$acc loop
    4567        DO i = nxl, nxr
    4568           DO  j = nys, nyn
     4569       DO i = i_left, i_right
     4570          DO  j = j_south, j_north
    45694571             !$acc loop vector( 32 )
    45704572             DO  k = nzb+1, nzt
  • palm/trunk/SOURCE/buoyancy.f90

    r1037 r1128  
    2020! Currrent revisions:
    2121! -----------------
    22 !
     22! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
     23! j_north
    2324!
    2425! Former revisions:
     
    218219!--       Normal case: horizontal surface
    219220          IF ( use_reference )  THEN
    220              DO  i = nxl, nxr
    221                 DO  j = nys, nyn
     221             DO  i = i_left, i_right
     222                DO  j = j_south, j_north
    222223                   DO  k = nzb_s_inner(j,i)+1, nzt-1
    223224                      tend(k,j,i) = tend(k,j,i) + atmos_ocean_sign * g * 0.5 * &
     
    232233             !$acc kernels present( nzb_s_inner, hom, tend, var )
    233234             !$acc loop
    234              DO  i = nxl, nxr
    235                 DO  j = nys, nyn
     235             DO  i = i_left, i_right
     236                DO  j = j_south, j_north
    236237                   !$acc loop vector(32)
    237238                   DO  k = 1, nzt-1
  • palm/trunk/SOURCE/coriolis.f90

    r1037 r1128  
    2020! Current revisions:
    2121! -----------------
    22 !
     22! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
     23! j_north
    2324!
    2425! Former revisions:
     
    167168             !$acc  kernels present( nzb_u_inner, tend, v, vg, w )
    168169             !$acc  loop
    169              DO  i = nxlu, nxr
    170                 DO  j = nys, nyn
     170             DO  i = i_left, i_right
     171                DO  j = j_south, j_north
    171172                   !$acc loop vector( 32 )
    172173                   DO  k = 1, nzt
     
    190191             !$acc  kernels present( nzb_v_inner, tend, u, ug )
    191192             !$acc  loop
    192              DO  i = nxl, nxr
    193                 DO  j = nysv, nyn
     193             DO  i = i_left, i_right
     194                DO  j = j_south, j_north
    194195                   !$acc loop vector( 32 )
    195196                   DO  k = 1, nzt
     
    209210             !$acc  kernels present( nzb_w_inner, tend, u )
    210211             !$acc  loop
    211              DO  i = nxl, nxr
    212                 DO  j = nys, nyn
     212             DO  i = i_left, i_right
     213                DO  j = j_south, j_north
    213214                   !$acc loop vector( 32 )
    214215                   DO  k = 1, nzt
  • palm/trunk/SOURCE/diffusion_e.f90

    r1066 r1128  
    2020! Current revisions:
    2121! -----------------
     22! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
     23! j_north
    2224!
    2325! Former revisions:
     
    312314!--    runtime errors occur with -C hopt on NEC
    313315       IF ( use_reference )  THEN
    314           STOP '+++ use_reference in diffusion_e not implemented'
     316          STOP '+++ use_reference not implemented in diffusion_e_acc'
    315317!          DO  i = nxl, nxr
    316318!             DO  j = nys, nyn
     
    387389          !$acc         present( nzb_s_inner, rif, tend, var, zu, zw )
    388390          !$acc loop
    389           DO  i = nxl, nxr
    390              DO  j = nys, nyn
     391          DO  i = i_left, i_right
     392             DO  j = j_south, j_north
    391393                !$acc loop vector( 32 )
    392394                DO  k = 1, nzt
     
    458460          !$acc kernels present( diss, nzb_s_inner )
    459461          !$acc loop
    460           DO  i = nxl, nxr
     462          DO  i = i_left, i_right
    461463             !$acc loop vector( 32 )
    462              DO  j = nys, nyn
     464             DO  j = j_south, j_north
    463465                diss(nzb_s_inner(j,i),j,i) = diss(nzb_s_inner(j,i)+1,j,i)
    464466             ENDDO
  • palm/trunk/SOURCE/diffusion_s.f90

    r1093 r1128  
    2020! Current revisions:
    2121! ------------------
    22 !
     22! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
     23! j_north
    2324!
    2425! Former revisions:
     
    226227       !$acc         present( wall_w_x, wall_w_y )
    227228       !$acc loop
    228        DO  i = nxl, nxr
    229           DO  j = nys,nyn
     229       DO  i = i_left, i_right
     230          DO  j = j_south, j_north
    230231!
    231232!--          Compute horizontal diffusion
  • palm/trunk/SOURCE/diffusion_u.f90

    r1037 r1128  
    2020! Current revisions:
    2121! -----------------
    22 !
     22! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
     23! j_north
    2324!
    2425! Former revisions:
     
    275276       !$acc         present ( nzb_u_inner, nzb_u_outer, nzb_diff_u )
    276277       !$acc loop
    277        DO  i = nxlu, nxr
    278           DO  j = nys, nyn
     278       DO  i = i_left, i_right
     279          DO  j = j_south, j_north
    279280!
    280281!--          Compute horizontal diffusion
     
    372373
    373374          !$acc loop
    374           DO  i = nxlu, nxr
     375          DO  i = i_left, i_right
    375376             !$acc loop vector(32)
    376              DO  j = nys, nyn
     377             DO  j = j_south, j_north
    377378         
    378379                k = nzb_u_inner(j,i)+1
     
    403404
    404405          !$acc loop
    405           DO  i = nxlu, nxr
     406          DO  i = i_left, i_right
    406407             !$acc loop vector(32)
    407              DO  j = nys, nyn
     408             DO  j = j_south, j_north
    408409
    409410!
  • palm/trunk/SOURCE/diffusion_v.f90

    r1037 r1128  
    2020! Current revisions:
    2121! -----------------
    22 !
     22! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
     23! j_north
    2324!
    2425! Former revisions:
     
    273274       !$acc         present ( nzb_v_inner, nzb_v_outer, nzb_diff_v )
    274275       !$acc loop
    275        DO  i = nxl, nxr
    276           DO  j = nysv, nyn
     276       DO  i = i_left, i_right
     277          DO  j = j_south, j_north
    277278!
    278279!--          Compute horizontal diffusion
     
    370371
    371372          !$acc loop
    372           DO  i = nxl, nxr
     373          DO  i = i_left, i_right
    373374             !$acc loop vector(32)
    374              DO  j = nysv, nyn
     375             DO  j = j_south, j_north
    375376         
    376377                k = nzb_v_inner(j,i)+1
     
    401402
    402403          !$acc loop
    403           DO  i = nxl, nxr
     404          DO  i = i_left, i_right
    404405             !$acc loop vector(32)
    405              DO  j = nysv, nyn
     406             DO  j = j_south, j_north
    406407
    407408!
  • palm/trunk/SOURCE/diffusion_w.f90

    r1037 r1128  
    2020! Current revisions:
    2121! -----------------
    22 !
     22! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
     23! j_north
    2324!
    2425! Former revisions:
     
    228229       !$acc         present ( nzb_w_inner, nzb_w_outer )
    229230       !$acc loop
    230        DO  i = nxl, nxr
    231           DO  j = nys, nyn
     231       DO  i = i_left, i_right
     232          DO  j = j_south, j_north
    232233             !$acc loop vector( 32 )
    233234             DO  k = 1, nzt
  • palm/trunk/SOURCE/exchange_horiz.f90

    r1114 r1128  
    2020! Current revisions:
    2121! -----------------
    22 !
     22! modifications for asynchronous transfer,
     23! local variables req, wait_stat are global now, and have been moved to module
     24! pegrid
    2325!
    2426! Former revisions:
     
    9092
    9193#if ! defined( __check )
     94
     95    CALL cpu_log( log_point_s(2), 'exchange_horiz', 'start' )
     96
    9297#if defined( __parallel )
    93     INTEGER, DIMENSION(4)                 ::  req
    94     INTEGER, DIMENSION(MPI_STATUS_SIZE,4) ::  wait_stat
    95 #endif
    96 
    97 
    98     CALL cpu_log( log_point_s(2), 'exchange_horiz', 'start' )
    99 
    100 #if defined( __parallel )
    101 
    102 !
    103 !-- Exchange of lateral boundary values
     98
     99!
     100!-- Exchange in x-direction of lateral boundaries
    104101    IF ( pdims(1) == 1  .OR.  mg_switch_to_pe0 )  THEN
    105102!
     
    130127       ELSE
    131128
    132           req = 0
    133 !
    134 !--       Send left boundary, receive right one (asynchronous)
    135           CALL MPI_ISEND( ar(nzb,nys-nbgp_local,nxl),   1, type_yz(grid_level), &
    136                           pleft, 0, comm2d, req(1), ierr )
    137           CALL MPI_IRECV( ar(nzb,nys-nbgp_local,nxr+1), 1, type_yz(grid_level), &
    138                           pright, 0, comm2d, req(2), ierr )
    139 !
    140 !--       Send right boundary, receive left one (asynchronous)
    141           CALL MPI_ISEND( ar(nzb,nys-nbgp_local,nxr+1-nbgp_local), 1,          &
    142                           type_yz(grid_level), pright, 1, comm2d, req(3), ierr )
    143           CALL MPI_IRECV( ar(nzb,nys-nbgp_local,nxl-nbgp_local),   1,          &
    144                           type_yz(grid_level), pleft,  1, comm2d, req(4), ierr )
    145 
    146           CALL MPI_WAITALL( 4, req, wait_stat, ierr )
     129!
     130!--       In case of background communication switched on, exchange is done
     131!--       either along x or along y
     132          IF ( send_receive == 'lr'  .OR.  send_receive == 'al' )  THEN
     133
     134             IF ( .NOT. sendrecv_in_background )  THEN
     135                req(1:4)  = 0
     136                req_count = 0
     137             ENDIF
     138!
     139!--          Send left boundary, receive right one (asynchronous)
     140             CALL MPI_ISEND( ar(nzb,nys-nbgp_local,nxl),   1, type_yz(grid_level), &
     141                             pleft, req_count, comm2d, req(req_count+1), ierr )
     142             CALL MPI_IRECV( ar(nzb,nys-nbgp_local,nxr+1), 1, type_yz(grid_level), &
     143                             pright, req_count, comm2d, req(req_count+2), ierr )
     144!
     145!--          Send right boundary, receive left one (asynchronous)
     146             CALL MPI_ISEND( ar(nzb,nys-nbgp_local,nxr+1-nbgp_local), 1,          &
     147                             type_yz(grid_level), pright, req_count+1, comm2d,    &
     148                             req(req_count+3), ierr )
     149             CALL MPI_IRECV( ar(nzb,nys-nbgp_local,nxl-nbgp_local),   1,          &
     150                             type_yz(grid_level), pleft,  req_count+1, comm2d,    &
     151                             req(req_count+4), ierr )
     152
     153             IF ( .NOT. sendrecv_in_background )  THEN
     154                CALL MPI_WAITALL( 4, req, wait_stat, ierr )
     155             ELSE
     156                req_count = req_count + 4
     157             ENDIF
     158
     159          ENDIF
    147160
    148161       ENDIF
     
    179192       ELSE
    180193
    181           req = 0
    182 !
    183 !--       Send front boundary, receive rear one (asynchronous)
    184           CALL MPI_ISEND( ar(nzb,nys,nxl-nbgp_local),   1, type_xz(grid_level), &
    185                           psouth, 0, comm2d, req(1), ierr )
    186           CALL MPI_IRECV( ar(nzb,nyn+1,nxl-nbgp_local), 1, type_xz(grid_level), &
    187                           pnorth, 0, comm2d, req(2), ierr )
    188 !
    189 !--       Send rear boundary, receive front one (asynchronous)
    190           CALL MPI_ISEND( ar(nzb,nyn-nbgp_local+1,nxl-nbgp_local), 1,          &
    191                           type_xz(grid_level), pnorth, 1, comm2d, req(3), ierr )
    192           CALL MPI_IRECV( ar(nzb,nys-nbgp_local,nxl-nbgp_local),   1,          &
    193                           type_xz(grid_level), psouth, 1, comm2d, req(4), ierr )
    194 
    195           CALL MPI_WAITALL( 4, req, wait_stat, ierr )
     194!
     195!--       In case of background communication switched on, exchange is done
     196!--       either along x or along y
     197          IF ( send_receive == 'lr'  .OR.  send_receive == 'al' )  THEN
     198
     199             IF ( .NOT. sendrecv_in_background )  THEN
     200                req(1:4)  = 0
     201                req_count = 0
     202             ENDIF
     203
     204!
     205!--          Send front boundary, receive rear one (asynchronous)
     206             CALL MPI_ISEND( ar(nzb,nys,nxl-nbgp_local),   1, type_xz(grid_level), &
     207                             psouth, req_count, comm2d, req(req_count+1), ierr )
     208             CALL MPI_IRECV( ar(nzb,nyn+1,nxl-nbgp_local), 1, type_xz(grid_level), &
     209                             pnorth, req_count, comm2d, req(req_count+2), ierr )
     210!
     211!--          Send rear boundary, receive front one (asynchronous)
     212             CALL MPI_ISEND( ar(nzb,nyn-nbgp_local+1,nxl-nbgp_local), 1,          &
     213                             type_xz(grid_level), pnorth, req_count+1, comm2d,    &
     214                             req(req_count+3), ierr )
     215             CALL MPI_IRECV( ar(nzb,nys-nbgp_local,nxl-nbgp_local),   1,          &
     216                             type_xz(grid_level), psouth, req_count+1, comm2d,    &
     217                             req(req_count+4), ierr )
     218
     219             IF ( .NOT. sendrecv_in_background )  THEN
     220                CALL MPI_WAITALL( 4, req, wait_stat, ierr )
     221             ELSE
     222                req_count = req_count + 4
     223             ENDIF
     224
     225          ENDIF
    196226
    197227       ENDIF
  • palm/trunk/SOURCE/modules.f90

    r1116 r1128  
    2020! Current revisions:
    2121! ------------------
    22 !
     22! +background_communication, i_left, i_right, j_north, j_south, req, req_count,
     23! send_receive, sendrecv_in_background, wait_stat
    2324!
    2425! Former revisions:
     
    10711072!------------------------------------------------------------------------------!
    10721073
    1073     INTEGER ::  nbgp = 3, ngp_sums, nnx, nx = 0, nx_a, nx_o, nxl, nxlg,   &
    1074                 nxlu, nxr, nxrg, nx_on_file, nny, ny = 0, ny_a, ny_o,    &
    1075                 nyn, nyng, nys, nysg, nysv, ny_on_file, nnz, nz = 0,&
    1076                 nzb, nzb_diff, nzb_max, nzt, nzt_diff
     1074    INTEGER ::  i_left, i_right, j_north, j_south, nbgp = 3, ngp_sums, nnx,    &
     1075                nx = 0, nx_a, nx_o, nxl, nxlg, nxlu, nxr, nxrg, nx_on_file,    &
     1076                nny, ny = 0, ny_a, ny_o, nyn, nyng, nys, nysg, nysv,           &
     1077                ny_on_file, nnz, nz = 0, nzb, nzb_diff, nzb_max, nzt, nzt_diff
    10771078
    10781079
     
    14711472#endif
    14721473#endif
     1474    CHARACTER(LEN=2) ::  send_receive = 'al'
    14731475    CHARACTER(LEN=5) ::  myid_char = ''
    14741476    INTEGER          ::  acc_rank, id_inflow = 0, id_recycling = 0,      &
    1475                          myid = 0, num_acc_per_node = 0,                 &
     1477                         myid = 0, num_acc_per_node = 0, req_count = 0,  &
    14761478                         target_id, npex = -1, npey = -1, numprocs = 1,  &
    14771479                         numprocs_previous_run = -1,                     &
    14781480                         tasks_per_node = -9999, threads_per_task = 1
    14791481
    1480     INTEGER          ::  pdims(2) = 1
     1482    INTEGER          ::  pdims(2) = 1, req(100)
    14811483
    14821484    INTEGER, DIMENSION(:,:), ALLOCATABLE ::  hor_index_bounds, &
    14831485                                             hor_index_bounds_previous_run
    14841486
    1485     LOGICAL ::  collective_wait = .FALSE.
     1487    LOGICAL ::  background_communication =.FALSE., collective_wait = .FALSE., &
     1488                sendrecv_in_background = .FALSE.
    14861489
    14871490#if defined( __parallel )
     
    15001503#if ! defined ( __check )
    15011504    INTEGER ::  status(MPI_STATUS_SIZE)
     1505    INTEGER, DIMENSION(MPI_STATUS_SIZE,100) ::  wait_stat
    15021506#endif
    15031507
  • palm/trunk/SOURCE/parin.f90

    r1116 r1128  
    2020! Current revisions:
    2121! -----------------
    22 !
     22! +background_communication in inipar
    2323!
    2424! Former revisions:
     
    203203
    204204
    205     NAMELIST /inipar/  alpha_surface, bc_e_b, bc_lr, &
     205    NAMELIST /inipar/  alpha_surface, background_communication, bc_e_b, bc_lr, &
    206206                       bc_ns, bc_p_b, bc_p_t, bc_pt_b, bc_pt_t, bc_q_b, &
    207207             bc_q_t,bc_s_b, bc_s_t, bc_sa_t, bc_uv_b, bc_uv_t, &
  • palm/trunk/SOURCE/production_e.f90

    r1037 r1128  
    2020! Current revisions:
    2121! -----------------
    22 !
     22! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
     23! j_north
    2324!
    2425! Former revisions:
     
    743744       !$acc         copyin( u_0, v_0 )
    744745       !$acc loop
    745        DO  i = nxl, nxr
    746           DO  j = nys, nyn
     746       DO  i = i_left, i_right
     747          DO  j = j_south, j_north
    747748             !$acc loop vector( 32 )
    748749             DO  k = 1, nzt
     
    789790!--       'bottom and wall: use u_0,v_0 and wall functions'
    790791          !$acc loop
    791           DO  i = nxl, nxr
    792              DO  j = nys, nyn
     792          DO  i = i_left, i_right
     793             DO  j = j_south, j_north
    793794                !$acc loop vector( 32 )
    794795                DO  k = 1, nzt
     
    10011002!--       'bottom only: use u_0,v_0'
    10021003          !$acc loop
    1003           DO  i = nxl, nxr
    1004              DO  j = nys, nyn
     1004          DO  i = i_left, i_right
     1005             DO  j = j_south, j_north
    10051006                !$acc loop vector( 32 )
    10061007                DO  k = 1, nzt
     
    10481049
    10491050          !$acc loop
    1050           DO  i = nxl, nxr
    1051              DO  j = nys, nyn
     1051          DO  i = i_left, i_right
     1052             DO  j = j_south, j_north
    10521053                !$acc loop vector(32)
    10531054                DO  k = 1, nzt
     
    11021103!--                in the bottom and top surface layer
    11031104                   !$acc loop
    1104                    DO  i = nxl, nxr
    1105                       DO  j = nys, nyn
     1105                   DO  i = i_left, i_right
     1106                      DO  j = j_south, j_north
    11061107                         !$acc loop vector( 32 )
    11071108                         DO  k = 1, nzt
     
    11191120
    11201121                   !$acc loop
    1121                    DO  i = nxl, nxr
    1122                       DO  j = nys, nyn
     1122                   DO  i = i_left, i_right
     1123                      DO  j = j_south, j_north
    11231124                         !$acc loop vector( 32 )
    11241125                         DO  k = 1, nzt_diff
     
    11531154!--                in the bottom and top surface layer
    11541155                   !$acc loop
    1155                    DO  i = nxl, nxr
    1156                       DO  j = nys, nyn
     1156                   DO  i = i_left, i_right
     1157                      DO  j = j_south, j_north
    11571158                         !$acc loop vector( 32 )
    11581159                         DO  k = 1, nzt
     
    11701171
    11711172                   !$acc loop
    1172                    DO  i = nxl, nxr
    1173                       DO  j = nys, nyn
     1173                   DO  i = i_left, i_right
     1174                      DO  j = j_south, j_north
    11741175                         !$acc loop vector( 32 )
    11751176                         DO  k = 1, nzt_diff
  • palm/trunk/SOURCE/prognostic_equations.f90

    r1116 r1128  
    2020! Current revisions:
    2121! ------------------
    22 !
     22! those parts requiring global communication moved to time_integration,
     23! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
     24! j_north
    2325!
    2426! Former revisions:
     
    223225    CALL cpu_log( log_point(32), 'all progn.equations', 'start' )
    224226
    225 
    226 !
    227 !-- Calculate those variables needed in the tendency terms which need
    228 !-- global communication
    229     IF ( .NOT. neutral )  CALL calc_mean_profile( pt, 4 )
    230     IF ( ocean         )  CALL calc_mean_profile( rho, 64 )
    231     IF ( humidity      )  CALL calc_mean_profile( vpt, 44 )
    232     IF ( .NOT. constant_diffusion )  CALL production_e_init
    233     IF ( ( ws_scheme_mom .OR. ws_scheme_sca )  .AND.  &
    234          intermediate_timestep_count == 1 )  CALL ws_statistics
    235227!
    236228!-- Loop over all prognostic equations
     
    724716             ENDIF
    725717
    726          ENDIF
     718          ENDIF
     719
    727720!
    728721!--       If required, compute prognostic equation for turbulent kinetic
     
    811804    REAL    ::  sbt
    812805
    813 !
    814 !-- Calculate those variables needed in the tendency terms which need
    815 !-- global communication
    816     IF ( .NOT. neutral )  CALL calc_mean_profile( pt, 4 )
    817     IF ( ocean         )  CALL calc_mean_profile( rho, 64 )
    818     IF ( humidity      )  CALL calc_mean_profile( vpt, 44 )
    819     IF ( ( ws_scheme_mom .OR. ws_scheme_sca )  .AND.  &
    820          intermediate_timestep_count == 1 )  CALL ws_statistics
    821806
    822807!
     
    13371322
    13381323       CALL cpu_log( log_point(16), 'tke-equation', 'start' )
    1339 
    1340 !
    1341 !--    TKE-tendency terms with communication
    1342        CALL production_e_init
    13431324
    13441325       sbt = tsc(2)
     
    14641445
    14651446!
    1466 !-- Calculate those variables needed in the tendency terms which need
    1467 !-- global communication
    1468     IF ( .NOT. neutral )  CALL calc_mean_profile( pt, 4 )
    1469     IF ( ocean         )  CALL calc_mean_profile( rho, 64 )
    1470     IF ( humidity      )  CALL calc_mean_profile( vpt, 44 )
    1471     IF ( ( ws_scheme_mom .OR. ws_scheme_sca )  .AND.  &
    1472          intermediate_timestep_count == 1 )  CALL ws_statistics
    1473 
    1474 !
    14751447!-- u-velocity component
    14761448!++ Statistics still not ported to accelerators
     
    15011473!-- External pressure gradient
    15021474    IF ( dp_external )  THEN
    1503        DO  i = nxlu, nxr
    1504           DO  j = nys, nyn
     1475       DO  i = i_left, i_right
     1476          DO  j = j_south, j_north
    15051477             DO  k = dp_level_ind_b+1, nzt
    15061478                tend(k,j,i) = tend(k,j,i) - dpdxy(1) * dp_smooth_factor(k)
     
    15161488    !$acc kernels present( nzb_u_inner, rdf, tend, tu_m, u, ug, u_p )
    15171489    !$acc loop
    1518     DO  i = nxlu, nxr
    1519        DO  j = nys, nyn
     1490    DO  i = i_left, i_right
     1491       DO  j = j_south, j_north
    15201492          !$acc loop vector( 32 )
    15211493          DO  k = 1, nzt
     
    15631535!-- External pressure gradient
    15641536    IF ( dp_external )  THEN
    1565        DO  i = nxl, nxr
    1566           DO  j = nysv, nyn
     1537       DO  i = i_left, i_right
     1538          DO  j = j_south, j_north
    15671539             DO  k = dp_level_ind_b+1, nzt
    15681540                tend(k,j,i) = tend(k,j,i) - dpdxy(2) * dp_smooth_factor(k)
     
    15781550    !$acc kernels present( nzb_v_inner, rdf, tend, tv_m, v, vg, v_p )
    15791551    !$acc loop
    1580     DO  i = nxl, nxr
    1581        DO  j = nysv, nyn
     1552    DO  i = i_left, i_right
     1553       DO  j = j_south, j_north
    15821554          !$acc loop vector( 32 )
    15831555          DO  k = 1, nzt
     
    16401612    !$acc kernels present( nzb_w_inner, rdf, tend, tw_m, w, w_p )
    16411613    !$acc loop
    1642     DO  i = nxl, nxr
    1643        DO  j = nys, nyn
     1614    DO  i = i_left, i_right
     1615       DO  j = j_south, j_north
    16441616          !$acc loop vector( 32 )
    16451617          DO  k = 1, nzt-1
     
    17341706       !$acc         present( tend, tpt_m, pt, pt_p )
    17351707       !$acc loop
    1736        DO  i = nxl, nxr
    1737           DO  j = nys, nyn
     1708       DO  i = i_left, i_right
     1709          DO  j = j_south, j_north
    17381710             !$acc loop vector( 32 )
    17391711             DO  k = 1, nzt
     
    18021774!
    18031775!--    Prognostic equation for salinity
    1804        DO  i = nxl, nxr
    1805           DO  j = nys, nyn
     1776       DO  i = i_left, i_right
     1777          DO  j = j_south, j_north
    18061778             DO  k = nzb_s_inner(j,i)+1, nzt
    18071779                sa_p(k,j,i) = sa(k,j,i) + dt_3d * ( sbt * tend(k,j,i) +        &
     
    18901862!
    18911863!--    Prognostic equation for total water content / scalar
    1892        DO  i = nxl, nxr
    1893           DO  j = nys, nyn
     1864       DO  i = i_left, i_right
     1865          DO  j = j_south, j_north
    18941866             DO  k = nzb_s_inner(j,i)+1, nzt
    18951867                q_p(k,j,i) = q(k,j,i) + dt_3d * ( sbt * tend(k,j,i) +          &
     
    19191891
    19201892       CALL cpu_log( log_point(16), 'tke-equation', 'start' )
    1921 
    1922 !
    1923 !--    TKE-tendency terms with communication
    1924        CALL production_e_init
    19251893
    19261894       sbt = tsc(2)
     
    19841952       !$acc kernels present( e, e_p, nzb_s_inner, tend, te_m )
    19851953       !$acc loop
    1986        DO  i = nxl, nxr
    1987           DO  j = nys, nyn
     1954       DO  i = i_left, i_right
     1955          DO  j = j_south, j_north
    19881956             !$acc loop vector( 32 )
    19891957             DO  k = 1, nzt
  • palm/trunk/SOURCE/time_integration.f90

    r1116 r1128  
    2020! Current revisions:
    2121! ------------------
    22 !
     22! asynchronous transfer of ghost point data realized for acc-optimized version:
     23! prognostic_equations are first called two times for those points required for
     24! the left-right and north-south exchange, respectively, and then for the
     25! remaining points,
     26! those parts requiring global communication moved from prognostic_equations to
     27! here
    2328!
    2429! Former revisions:
     
    134139!------------------------------------------------------------------------------!
    135140
     141    USE advec_ws
    136142    USE arrays_3d
    137143    USE averaging
     144    USE buoyancy_mod
    138145    USE control_parameters
    139146    USE cpulog
     
    147154    USE particle_attributes
    148155    USE pegrid
     156    USE production_e_mod
    149157    USE prognostic_equations_mod
    150158    USE statistics
     
    212220!--       on the timestep scheme
    213221          CALL timestep_scheme_steering
     222
     223!
     224!--       Calculate those variables needed in the tendency terms which need
     225!--       global communication
     226          IF ( .NOT. neutral )  CALL calc_mean_profile( pt, 4 )
     227          IF ( ocean         )  CALL calc_mean_profile( rho, 64 )
     228          IF ( humidity      )  CALL calc_mean_profile( vpt, 44 )
     229          IF ( .NOT. constant_diffusion )  CALL production_e_init
     230          IF ( ( ws_scheme_mom .OR. ws_scheme_sca )  .AND.  &
     231               intermediate_timestep_count == 1 )  CALL ws_statistics
    214232
    215233!
     
    224242             CALL prognostic_equations_vector
    225243          ELSEIF ( loop_optimization == 'acc' )  THEN
     244!             i_left  = nxl;         i_right = nxr
     245!             j_south = nys;         j_north = nyn
     246!             CALL prognostic_equations_acc
     247
     248             i_left  = nxl;         i_right = nxl+nbgp-1
     249             j_south = nys;         j_north = nyn
    226250             CALL prognostic_equations_acc
     251             i_left  = nxr-nbgp+1;  i_right = nxr
     252             j_south = nys;         j_north = nyn
     253             CALL prognostic_equations_acc
     254
     255!
     256!--          Exchange of ghost points (lateral boundary conditions)
     257             IF ( background_communication )  THEN
     258
     259                CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'start' )
     260               
     261                send_receive = 'lr'
     262                sendrecv_in_background = .TRUE.
     263                req          = 0
     264                req_count    = 0
     265
     266                IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
     267                   on_device = .TRUE.         ! to be removed after complete porting
     268                ELSE                          ! of ghost point exchange
     269                   !$acc update host( e_p, pt_p, u_p, v_p, w_p )
     270                ENDIF
     271
     272                CALL exchange_horiz( u_p, nbgp )
     273                CALL exchange_horiz( v_p, nbgp )
     274                CALL exchange_horiz( w_p, nbgp )
     275                CALL exchange_horiz( pt_p, nbgp )
     276                IF ( .NOT. constant_diffusion )  CALL exchange_horiz( e_p, nbgp )
     277                IF ( ocean )  THEN
     278                   CALL exchange_horiz( sa_p, nbgp )
     279                   CALL exchange_horiz( rho, nbgp )
     280                  CALL exchange_horiz( prho, nbgp )
     281                ENDIF
     282                IF (humidity  .OR.  passive_scalar)  THEN
     283                   CALL exchange_horiz( q_p, nbgp )
     284                   IF ( cloud_physics .AND. icloud_scheme == 0 )  THEN
     285                      CALL exchange_horiz( qr_p, nbgp )
     286                      CALL exchange_horiz( nr_p, nbgp )
     287                   ENDIF
     288                ENDIF
     289                IF ( cloud_droplets )  THEN
     290                   CALL exchange_horiz( ql, nbgp )
     291                   CALL exchange_horiz( ql_c, nbgp )
     292                   CALL exchange_horiz( ql_v, nbgp )
     293                   CALL exchange_horiz( ql_vp, nbgp )
     294                ENDIF
     295                IF ( wang_kernel  .OR.  turbulence )  CALL exchange_horiz( diss, nbgp )
     296
     297                IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
     298                   on_device = .FALSE.        ! to be removed after complete porting
     299                ELSE                          ! of ghost point exchange
     300                   !$acc update device( e_p, pt_p, u_p, v_p, w_p )
     301                ENDIF
     302
     303                sendrecv_in_background = .FALSE.
     304
     305                CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'pause' )
     306
     307             ENDIF
     308
     309             i_left  = nxl+nbgp;    i_right = nxr-nbgp
     310             j_south = nys;         j_north = nys+nbgp-1
     311             CALL prognostic_equations_acc
     312             i_left  = nxl+nbgp;    i_right = nxr-nbgp
     313             j_south = nyn-nbgp+1;  j_north = nyn
     314             CALL prognostic_equations_acc
     315
     316             IF ( background_communication )  THEN
     317                CALL cpu_log( log_point(41), 'exchange-horiz-wait', 'start' )
     318#if defined( __parallel )
     319                CALL MPI_WAITALL( req_count, req, wait_stat, ierr )
     320#endif
     321                CALL cpu_log( log_point(41), 'exchange-horiz-wait', 'pause' )
     322
     323                CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'continue' )
     324
     325                send_receive = 'ns'
     326                sendrecv_in_background = .TRUE.
     327                req          = 0
     328                req_count    = 0
     329
     330                IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
     331                   on_device = .TRUE.         ! to be removed after complete porting
     332                ELSE                          ! of ghost point exchange
     333                   !$acc update host( e_p, pt_p, u_p, v_p, w_p )
     334                ENDIF
     335
     336                CALL exchange_horiz( u_p, nbgp )
     337                CALL exchange_horiz( v_p, nbgp )
     338                CALL exchange_horiz( w_p, nbgp )
     339                CALL exchange_horiz( pt_p, nbgp )
     340                IF ( .NOT. constant_diffusion )  CALL exchange_horiz( e_p, nbgp )
     341                IF ( ocean )  THEN
     342                   CALL exchange_horiz( sa_p, nbgp )
     343                   CALL exchange_horiz( rho, nbgp )
     344                  CALL exchange_horiz( prho, nbgp )
     345                ENDIF
     346                IF (humidity  .OR.  passive_scalar)  THEN
     347                   CALL exchange_horiz( q_p, nbgp )
     348                   IF ( cloud_physics .AND. icloud_scheme == 0 )  THEN
     349                      CALL exchange_horiz( qr_p, nbgp )
     350                      CALL exchange_horiz( nr_p, nbgp )
     351                   ENDIF
     352                ENDIF
     353                IF ( cloud_droplets )  THEN
     354                   CALL exchange_horiz( ql, nbgp )
     355                   CALL exchange_horiz( ql_c, nbgp )
     356                   CALL exchange_horiz( ql_v, nbgp )
     357                   CALL exchange_horiz( ql_vp, nbgp )
     358                ENDIF
     359                IF ( wang_kernel  .OR.  turbulence )  CALL exchange_horiz( diss, nbgp )
     360
     361                IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
     362                   on_device = .FALSE.        ! to be removed after complete porting
     363                ELSE                          ! of ghost point exchange
     364                   !$acc update device( e_p, pt_p, u_p, v_p, w_p )
     365                ENDIF
     366
     367                sendrecv_in_background = .FALSE.
     368
     369                CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' )
     370
     371             ENDIF
     372
     373             i_left  = nxl+nbgp;    i_right = nxr-nbgp
     374             j_south = nys+nbgp;    j_north = nyn-nbgp
     375             CALL prognostic_equations_acc
     376
     377             IF ( background_communication )  THEN
     378                CALL cpu_log( log_point(41), 'exchange-horiz-wait', 'continue' )
     379#if defined( __parallel )
     380                CALL MPI_WAITALL( req_count, req, wait_stat, ierr )
     381#endif
     382                send_receive = 'al'
     383                CALL cpu_log( log_point(41), 'exchange-horiz-wait', 'stop' )
     384             ENDIF
     385
    227386          ENDIF
    228387
     
    230389!--       Particle transport/physics with the Lagrangian particle model
    231390!--       (only once during intermediate steps, because it uses an Euler-step)
     391!--       ### particle model should be moved before prognostic_equations, in order
     392!--       to regard droplet interactions directly
    232393          IF ( particle_advection  .AND.                         &
    233394               simulated_time >= particle_advection_start  .AND. &
     
    249410!
    250411!--       Exchange of ghost points (lateral boundary conditions)
    251           CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'start' )
    252 
    253           IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
    254              on_device = .TRUE.         ! to be removed after complete porting
    255           ELSE                          ! of ghost point exchange
    256              !$acc update host( e_p, pt_p, u_p, v_p, w_p )
    257           ENDIF
    258 
    259           CALL exchange_horiz( u_p, nbgp )
    260           CALL exchange_horiz( v_p, nbgp )
    261           CALL exchange_horiz( w_p, nbgp )
    262           CALL exchange_horiz( pt_p, nbgp )
    263           IF ( .NOT. constant_diffusion )  CALL exchange_horiz( e_p, nbgp )
    264           IF ( ocean )  THEN
    265              CALL exchange_horiz( sa_p, nbgp )
    266              CALL exchange_horiz( rho, nbgp )
    267              CALL exchange_horiz( prho, nbgp )
    268           ENDIF
    269           IF (humidity  .OR.  passive_scalar)  THEN
    270              CALL exchange_horiz( q_p, nbgp )
    271              IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.              &
    272                   precipitation)  THEN
    273                 CALL exchange_horiz( qr_p, nbgp )
    274                 CALL exchange_horiz( nr_p, nbgp )
    275              ENDIF
    276           ENDIF
    277           IF ( cloud_droplets )  THEN
    278              CALL exchange_horiz( ql, nbgp )
    279              CALL exchange_horiz( ql_c, nbgp )
    280              CALL exchange_horiz( ql_v, nbgp )
    281              CALL exchange_horiz( ql_vp, nbgp )
    282           ENDIF
    283           IF ( wang_kernel  .OR.  turbulence )  CALL exchange_horiz( diss, nbgp )
    284 
    285           IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
    286              on_device = .FALSE.        ! to be removed after complete porting
    287           ELSE                          ! of ghost point exchange
    288              !$acc update device( e_p, pt_p, u_p, v_p, w_p )
    289           ENDIF
    290 
    291           CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' )
     412          IF ( .NOT. background_communication )  THEN
     413
     414             CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'start' )
     415
     416             IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
     417                on_device = .TRUE.         ! to be removed after complete porting
     418             ELSE                          ! of ghost point exchange
     419                !$acc update host( e_p, pt_p, u_p, v_p, w_p )
     420             ENDIF
     421
     422             CALL exchange_horiz( u_p, nbgp )
     423             CALL exchange_horiz( v_p, nbgp )
     424             CALL exchange_horiz( w_p, nbgp )
     425             CALL exchange_horiz( pt_p, nbgp )
     426             IF ( .NOT. constant_diffusion )  CALL exchange_horiz( e_p, nbgp )
     427             IF ( ocean )  THEN
     428                CALL exchange_horiz( sa_p, nbgp )
     429                CALL exchange_horiz( rho, nbgp )
     430                CALL exchange_horiz( prho, nbgp )
     431             ENDIF
     432             IF (humidity  .OR.  passive_scalar)  THEN
     433                CALL exchange_horiz( q_p, nbgp )
     434                IF ( cloud_physics .AND. icloud_scheme == 0 )  THEN
     435                   CALL exchange_horiz( qr_p, nbgp )
     436                   CALL exchange_horiz( nr_p, nbgp )
     437                ENDIF
     438             ENDIF
     439             IF ( cloud_droplets )  THEN
     440                CALL exchange_horiz( ql, nbgp )
     441                CALL exchange_horiz( ql_c, nbgp )
     442                CALL exchange_horiz( ql_v, nbgp )
     443                CALL exchange_horiz( ql_vp, nbgp )
     444             ENDIF
     445             IF ( wang_kernel  .OR.  turbulence )  CALL exchange_horiz( diss, nbgp )
     446
     447             IF ( numprocs == 1 )  THEN    ! workaround for single-core GPU runs
     448                on_device = .FALSE.        ! to be removed after complete porting
     449             ELSE                          ! of ghost point exchange
     450                !$acc update device( e_p, pt_p, u_p, v_p, w_p )
     451             ENDIF
     452
     453             CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' )
     454
     455          ENDIF
    292456
    293457!
  • palm/trunk/SOURCE/wall_fluxes.f90

    r1037 r1128  
    2020! Current revisions:
    2121! -----------------
    22 !
     22! loop index bounds in accelerator version replaced by i_left, i_right, j_south,
     23! j_north
    2324!
    2425! Former revisions:
     
    256257       !$acc         present( u, v, w, wall, wall_flux, z0 )
    257258       !$acc loop
    258        DO  i = nxl, nxr
    259           DO  j = nys, nyn
     259       DO  i = i_left, i_right
     260          DO  j = j_south, j_north
    260261             !$acc loop vector( 32 )
    261262             DO  k = min_inner, max_outer
     
    666667       !$acc         present( u, v, w, wall, wall_flux, z0 )
    667668       !$acc loop
    668        DO  i = nxl, nxr
    669           DO  j = nys, nyn
     669       DO  i = i_left, i_right
     670          DO  j = j_south, j_north
    670671             !$acc loop vector(32)
    671672             DO  k = min_inner, max_outer
Note: See TracChangeset for help on using the changeset viewer.