Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing argument (nproma) in transformed code #577

Open
aoloso opened this issue Oct 22, 2019 · 1 comment
Open

Missing argument (nproma) in transformed code #577

aoloso opened this issue Oct 22, 2019 · 1 comment

Comments

@aoloso
Copy link

aoloso commented Oct 22, 2019

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

@clementval
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants