Skip to content

Commit

Permalink
ACC: use data regions rather than hard-coded parallel gang loops
Browse files Browse the repository at this point in the history
  • Loading branch information
awnawab committed Oct 7, 2024
1 parent e5e34b1 commit dc27eef
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/ecwam/cireduce_loki_gpu.F90
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,14 @@ SUBROUTINE CIREDUCE_LOKI_GPU (WVPRPT, FF_NOW)
ENDIF
CALL GSTATS(1493,0)
! DETERMINE THE WAVE ATTENUATION FACTOR
!$acc parallel loop gang present(FF_NOW, WVPRPT) vector_length(NPROMA_WAM)
!$acc data present(FF_NOW, WVPRPT)

DO ICHNK = 1, NCHNK
CALL CIWAF(1, NPROMA_WAM, WVPRPT%CGROUP(:,:,ICHNK), FF_NOW%CICOVER(:,ICHNK), &
& FF_NOW%CITHICK(:,ICHNK), WVPRPT%CIWA(:,:,ICHNK))
ENDDO
!$acc end parallel loop

!$acc end data
CALL GSTATS(1493,1)
ENDIF

Expand Down
6 changes: 4 additions & 2 deletions src/ecwam/outbs_loki_gpu.F90
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ SUBROUTINE OUTBS_LOKI_GPU (MIJ, FL1, XLLWS, &
!$loki update_device

CALL GSTATS(1502,0)
!$acc parallel loop gang default(present) copyin(NPROMA_WAM) copyout(BOUT) vector_length(NPROMA_WAM)
!$acc data present(MIJ,WVPRPT,WVENVI,INTFLDS,FF_NOW,NEMO2WAM) copyout(BOUT)

DO ICHNK = 1, NCHNK
CALL OUTBLOCK(1, NPROMA_WAM, MIJ(:,ICHNK), &
& FL1(:,:,:,ICHNK), XLLWS(:,:,:,ICHNK), &
Expand All @@ -117,7 +118,8 @@ SUBROUTINE OUTBS_LOKI_GPU (MIJ, FL1, XLLWS, &
& NEMO2WAM%NEMOVCUR(:, ICHNK), &
& BOUT(:,:,ICHNK))
ENDDO
!$acc end parallel loop

!$acc end data
CALL GSTATS(1502,1)

! PRINT OUT NORMS
Expand Down
6 changes: 4 additions & 2 deletions src/ecwam/wamintgr_loki_gpu.F90
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ SUBROUTINE WAMINTGR_LOKI_GPU(CDTPRA, CDATE, CDATEWH, CDTIMP, CDTIMPNEXT, &
IF (LHOOK) CALL DR_HOOK('IMPLSCH',0,ZHOOK_HANDLE_IMPLSCH)
TIME0=-WAM_USER_CLOCK()

!$acc parallel loop gang vector_length(NPROMA_WAM) default(present) copyin(NPROMA_WAM)
!$acc data present(VARS_4D,WVPRPT,WVENVI,FF_NOW,WAM2NEMO,INTFLDS,MIJ)

DO ICHNK=1,NCHNK
CALL IMPLSCH (1, NPROMA_WAM, VARS_4D%FL1(:,:,:,ICHNK), &
& WVPRPT%WAVNUM(:,:,ICHNK), WVPRPT%CGROUP(:,:,ICHNK), WVPRPT%CIWA(:,:,ICHNK), &
Expand All @@ -179,7 +180,8 @@ SUBROUTINE WAMINTGR_LOKI_GPU(CDTPRA, CDATE, CDATEWH, CDTIMP, CDTIMPNEXT, &
& INTFLDS%PHIEPS(:,ICHNK), INTFLDS%PHIAW(:,ICHNK), &
& MIJ%PTR(:,ICHNK), VARS_4D%XLLWS(:,:,:,ICHNK) )
END DO
!$acc end parallel loop

!$acc end data

TIME_PHYS = TIME_PHYS + (TIME0+WAM_USER_CLOCK())*1.E-06
IF (LHOOK) CALL DR_HOOK('IMPLSCH',1,ZHOOK_HANDLE_IMPLSCH)
Expand Down

0 comments on commit dc27eef

Please sign in to comment.