claw-compiler icon indicating copy to clipboard operation
claw-compiler copied to clipboard

Missing argument (nproma) in transformed code

Open aoloso opened this issue 5 years ago • 1 comments

Description of the issue in few words.

Original code

! Original code before transformation
PROGRAM test_abstraction10
  USE mo_column, ONLY: compute_column_public
  REAL, DIMENSION(20,60) :: q, t  ! Fields as declared in the whole model
  INTEGER :: nproma, nz           ! Size of array fields
  INTEGER :: p                    ! Loop index

  nproma = 20
  nz = 60

  DO p = 1, nproma
    q(p,1) = 0.0
    t(p,1) = 0.0
  END DO

  !$claw sca forward create update
  DO p = 1, nproma
    CALL compute_column_public(nz, q(p,:), t(p,:))
  END DO

  PRINT*,SUM(q)
  PRINT*,SUM(t)
END PROGRAM test_abstraction10
! Can also be XcodeML directly

Transformation code

! Wrong code after being processed by CLAW

! Can also be XcodeML directly

Expected code

PROGRAM test_abstraction10
 USE mo_column , ONLY: compute_column_public
 REAL :: q ( 1 : 20 , 1 : 60 )
 REAL :: t ( 1 : 20 , 1 : 60 )
 INTEGER :: nproma
 INTEGER :: nz
 INTEGER :: p

 nproma = 20
 nz = 60
 DO p = 1 , nproma , 1
  q ( p , 1 ) = 0.0
  t ( p , 1 ) = 0.0
 END DO
!$omp target data map(alloc:q(:,:),t(:,:))
!$omp target update to(q(:,:),t(:,:))
 CALL compute_column_public ( nz , q ( : , : ) , t ( : , : ) )
!$omp target update from(q(:,:),t(:,:))
!$omp end target data
 PRINT * , sum ( q )
 PRINT * , sum ( t )
END PROGRAM test_abstraction10
! Expected code
PROGRAM test_abstraction10
 USE mo_column , ONLY: compute_column_public
 REAL :: q ( 1 : 20 , 1 : 60 )
 REAL :: t ( 1 : 20 , 1 : 60 )
 INTEGER :: nproma
 INTEGER :: nz
 INTEGER :: p

 nproma = 20
 nz = 60
 DO p = 1 , nproma , 1
  q ( p , 1 ) = 0.0
  t ( p , 1 ) = 0.0
 END DO
!$omp target data map(alloc:q(:,:),t(:,:))
!$omp target update to(q(:,:),t(:,:))
 CALL compute_column_public ( nz , q ( : , : ) , t ( : , : ) , nproma = nproma&
  )
!$omp target update from(q(:,:),t(:,:))
!$omp end target data
 PRINT * , sum ( q )
 PRINT * , sum ( t )
END PROGRAM test_abstraction10
! Can also be XcodeML directly

Execution of clawfc

# Command used to apply the transformation

clawfc --directive=openmp --target=gpu

Related issues (if any)

Issue #00

aoloso avatar Oct 22 '19 15:10 aoloso

Can you show your code for compute_column_public? Do you have the claw sca directive in it?

clementval avatar Oct 28 '19 15:10 clementval