Ignore:
Timestamp:
Mar 10, 2013 2:48:14 AM (9 years ago)
Author:
raasch
Message:

GPU porting of boundary conditions and routine pres; index bug removec from radiation boundary condition

File:
1 edited

Legend:

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

    r1037 r1113  
    2020! Current revisions:
    2121! -----------------
    22 !
     22! GPU-porting for single-core (1PE) mode
    2323!
    2424! Former revisions:
     
    8282
    8383
    84     INTEGER ::  nbgp_local
     84    INTEGER ::  i, j, k, nbgp_local
    8585    REAL, DIMENSION(nzb:nzt+1,nys-nbgp_local:nyn+nbgp_local, &
    8686                    nxl-nbgp_local:nxr+nbgp_local) ::  ar
     
    199199
    200200!
    201 !-- Lateral boundary conditions in the non-parallel case
     201!-- Lateral boundary conditions in the non-parallel case.
     202!-- Case dependent, because in GPU mode still not all arrays are on device. This
     203!-- workaround has to be removed later. Also, since PGI compiler 12.5 has problems
     204!-- with array syntax, explicit loops are used.
    202205    IF ( bc_lr == 'cyclic' )  THEN
    203         ar(:,:,nxl-nbgp_local:nxl-1) = ar(:,:,nxr-nbgp_local+1:nxr)
    204         ar(:,:,nxr+1:nxr+nbgp_local) = ar(:,:,nxl:nxl+nbgp_local-1)
     206       IF ( on_device )  THEN
     207          !$acc kernels present( ar )
     208          !$acc loop independent
     209          DO  i = 0, nbgp_local-1
     210             DO  j = nys-nbgp_local, nyn+nbgp_local
     211                !$acc loop vector( 32 )
     212                DO  k = nzb, nzt+1
     213                   ar(k,j,nxl-nbgp_local+i) = ar(k,j,nxr-nbgp_local+1+i)
     214                   ar(k,j,nxr+1+i)          = ar(k,j,nxl+i)
     215                ENDDO
     216             ENDDO
     217          ENDDO
     218          !$acc end kernels
     219       ELSE
     220          ar(:,:,nxl-nbgp_local:nxl-1) = ar(:,:,nxr-nbgp_local+1:nxr)
     221          ar(:,:,nxr+1:nxr+nbgp_local) = ar(:,:,nxl:nxl+nbgp_local-1)
     222       ENDIF
    205223    ENDIF
    206224
    207225    IF ( bc_ns == 'cyclic' )  THEN
    208         ar(:,nys-nbgp_local:nys-1,:) = ar(:,nyn-nbgp_local+1:nyn,:)
    209         ar(:,nyn+1:nyn+nbgp_local,:) = ar(:,nys:nys+nbgp_local-1,:)
     226       IF ( on_device )  THEN
     227          !$acc kernels present( ar )
     228          !$acc loop
     229          DO  i = nxl-nbgp_local, nxr+nbgp_local
     230             !$acc loop independent
     231             DO  j = 0, nbgp_local-1
     232                !$acc loop vector( 32 )
     233                DO  k = nzb, nzt+1
     234                   ar(k,nys-nbgp_local+j,i) = ar(k,nyn-nbgp_local+1+j,i)
     235                     ar(k,nyn+1+j,i)          = ar(k,nys+j,i)
     236                ENDDO
     237             ENDDO
     238          ENDDO
     239          !$acc end kernels
     240       ELSE
     241          ar(:,nys-nbgp_local:nys-1,:) = ar(:,nyn-nbgp_local+1:nyn,:)
     242          ar(:,nyn+1:nyn+nbgp_local,:) = ar(:,nys:nys+nbgp_local-1,:)
     243       ENDIF
    210244    ENDIF
    211245
Note: See TracChangeset for help on using the changeset viewer.