2026-04-06 20:43:52 +00:00

45 lines
901 B
Plaintext

! RUN: %python %S/test_errors.py %s %flang_fc1
module m
type bar
integer, allocatable :: m(:)
end type
type r1
real :: origin(3)
end type r1
contains
attributes(global) subroutine g1( a )
type(bar) :: a
i = threadIdx%x
a%m(i) = i
return
end subroutine
attributes(device) function rayConstructor(origin, dir) result(r)
real :: origin(3), dir(3)
type(r1) :: r
r%origin = origin
end function
end module m
program main
implicit none
integer, parameter :: nx = 400, ny = 200
integer :: i, j
type r1
real :: v(3)
end type r1
type(r1) :: fb(nx, ny)
type(r1), device :: fb_d(nx, ny)
associate (fb => fb_d)
!$cuf kernel do (2) <<<*,*>>>
do j = 1, ny
do i = 1, nx
fb(i,j)%v(1) = real(i)/nx
fb(i,j)%v(2) = real(j)/ny
fb(i,j)%v(3) = 0.2
end do
end do
end associate
end program