multiline Accelerate directive

What if I have a long Accelerate directive statement, can I split them into 2 lines, I tried to using the ampersand, yet I dont know if the continued line need to be commented or not. I try both cases and it doesn’t work

Free-form

!$ACC data region copyin(a, b), 
!$ACC  copyout(c) &


!$ACC END data region

Fixed-form

!$acc data region copyin(a, b), 
!    x copyout(c)


!$ACC END data region

I followed the directive in the manual, with fixed-form format, on the 6th column of the continued line, add an ‘x’ character; yet i still get an error. I hope you can give me explain for both fixed-form format and free-form source format also.
Tuan

Hi Tuan,

With fixed, you just need to add the “acc”. For example:

       program test
          real, dimension(10,10) :: a, b
          integer :: i
!$ACC region
!$ACCx copyin(a)
          i = 19
          a = 1.1
          b = 3.0
!$acc end region
        end program

With free, the ‘&’ needs to be on the line where the line break occurs. For example:

       program test
          real, dimension(10,10) :: a, b
          integer :: i
!$ACC region   &
!$ACC copyin(a)
          i = 19
          a = 1.1
          b = 3.0
!$acc end region
        end program

Hope this helps,
Mat