# Cuda - run code with list

**URL:** <https://discourse.julialang.org/t/cuda-run-code-with-list/26441>\
**Category:** General Usage\
**Tags:** question, cudanative, cuda\
**Created:** [July 16, 2019, 8:54pm UTC](https://discourse.julialang.org/t/cuda-run-code-with-list/26441 "2019-07-16T20:54:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wiktorkujawa](https://avatars.discourse-cdn.com/v4/letter/w/bc8723/32.png) [@wiktorkujawa](https://discourse.julialang.org/u/wiktorkujawa)\
**Post date:** [July 16, 2019, 8:54pm UTC](https://discourse.julialang.org/t/cuda-run-code-with-list/26441/1 "2019-07-16T20:54:05Z")

</div>

I wanted to get line coordinates from startpoint to endpoint, but it didn’t work. I guess that the problem is in data type of `Segment` list(and overally a lists).  
In my program I will use lists to load data.

```julia
using CUDAdrv

using CUDAnative

function divideLine(Segment,numberofsegments,SegmentsCalculated)

numberOfElement = (blockIdx().x-1) * blockDim().x + threadIdx().x

segmentNumber = (blockIdx().y-1) * blockDim().y + threadIdx().y

coor = (blockIdx().z-1) * blockDim().z + threadIdx().z

SegmentsCalculated[numberOfElement][segmentNumber][coor]=Segment[segmentNumber][1][coor]+(segmentNumber-1)%numberofsegments*(Segment[segmentNumber][2][coor]-Segment[segmentNumber][1][coor])/(numberofsegments-1)

return nothing

end

numberofsegments=100

Segment=[]

startline1=Float32[-500.0,0.0,1.0]

endline1=Float32[500.0,0.0,1.0]

startline2=Float32[0.0.-500,0.0,1.0]

endline2=Float32[0.0,500.0,1.0]

push!(Segment,[startline1,endline1])

push!(Segment,[startline2,endline2])

SegmentsCalculated=similar(Segment)

optimalBlocks=2*attribute(CuDevice(0),CUDAdrv.MULTIPROCESSOR_COUNT)

@cuda blocks=1,optimalBlocks,1 threads=length(S),numberofsegments/optimalBlocks,3 divideLine(Segment,numberofsegments,SegmentsCalculated)

```

```julia
ERROR: GPU compilation of divideLine(Array{Any,1}, Int64, Array{Any,1}) failed
KernelError: passing and using non-bitstype argument

Argument 2 to your kernel function is of type Array{Any,1}.
That type is not isbits, and such arguments are only allowed when they are unused by the kernel.

```

What’s the easiest way to avoid this?
