module gitf contains attributes(global) subroutine calc_d(list_) implicit none integer :: list_(:) integer :: i, n n = size(list_) i = blockDim%x * (blockIdx%x - 1) + threadIdx%x if (mod(n, i) == 0) list_(i) = i end subroutine calc_d end module gitf program gitgall use cudafor use gitf implicit none integer :: input = -1 integer, allocatable :: list(:) integer, allocatable, device :: list_d(:) type(dim3) :: grid, tBlock do while (input < 1) read(*,*) input enddo tBlock = dim3(10,1,1) grid = dim3(ceiling(real(input)/tBlock%x),1,1) allocate(list(input)) allocate(list_d(input)) call calc_d<<<grid, tBlock>>>(list_d) list = list_d WRITE(*, *) pack(list, list /= 0) deallocate(list) deallocate(list_d) end program gitgall
돌아가면 됐죠 그죠?
이거 컴파일러 엔비디아꺼 맞죠?
넹 nvfortran이에요