Skip to content

Missing argument (nproma) in transformed code  #577

@aoloso

Description

@aoloso

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions