You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the code snippet below, the condition should be outside of the kernel to have a more efficient code. In such case, it is easy to detect that the condition is independent from the computation of the kernel and can wrap the kernel instead of being part of it.
Original code
PURE ELEMENTAL SUBROUTINE calc_smth(ll, smth)
LOGICAL, INTENT(IN) :: ll
!$claw model-dataREAL, INTENT(INOUT) :: smth
!$claw end model-data
!$claw sca
IF(ll) THEN
smth =0.1END IFENDSUBROUTINEcalc_smth
Transformation code
SUBROUTINEcalc_smth ( ll , smth , nproma )
INTEGER , INTENT(IN) :: nproma
LOGICAL , INTENT(IN) :: ll
REAL , INTENT(INOUT) :: smth ( 1 : nproma )
INTEGER:: proma
!$acc datapresent(smth)
!$acc parallel
!$acc loop gang vector
DO proma =1 , nproma , 1IF ( ll ) THEN
smth ( proma ) =0.1END IFEND DO
!$acc end parallel
!$acc end dataENDSUBROUTINE calc_smth
Expected code
SUBROUTINEcalc_smth ( ll , smth , nproma )
INTEGER , INTENT(IN) :: nproma
LOGICAL , INTENT(IN) :: ll
REAL , INTENT(INOUT) :: smth ( 1 : nproma )
INTEGER:: proma
IF ( ll ) THEN
!$acc datapresent(smth)
!$acc parallel
!$acc loop gang vector
DO proma =1 , nproma , 1
smth ( proma ) =0.1END DO
!$acc end parallel
!$acc end dataEND IFENDSUBROUTINE calc_smth
In the code snippet below, the condition should be outside of the kernel to have a more efficient code. In such case, it is easy to detect that the condition is independent from the computation of the kernel and can wrap the kernel instead of being part of it.
Original code
Transformation code
Expected code
Execution of
clawfc
Related issues (if any)
None
The text was updated successfully, but these errors were encountered: