# Integer-Arrays to CuArrays

**URL:** <https://discourse.julialang.org/t/integer-arrays-to-cuarrays/20703>\
**Category:** General Usage\
**Tags:** cudanative, gpuarrays, cuda\
**Created:** [February 12, 2019, 2:15pm UTC](https://discourse.julialang.org/t/integer-arrays-to-cuarrays/20703 "2019-02-12T14:15:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DavidBerghaus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidberghaus/32/4623_2.png) [@DavidBerghaus](https://discourse.julialang.org/u/DavidBerghaus)\
**Post date:** [February 12, 2019, 2:15pm UTC](https://discourse.julialang.org/t/integer-arrays-to-cuarrays/20703/1 "2019-02-12T14:15:11Z")

</div>

Is there a way to cast an Array{Int64} to CuArray{Int64}?

CuArrays seems to be always transforming integers to floats:

```julia
julia> cu([0,1])
2-element CuArray{Float32,1}:
 0.0
 1.0

```

A workaround (which also proves that CuArrays seem to be working for Int64) would be this:

```julia
A = CuArray{Int64}(2);
A[1],A[2] = 0,1;
julia> A
2-element CuArray{Int64,1}:
 0
 1

```

But this seems to be very slow.  
It is also less convenient since operations like push!(A,2) appear to be not available for CuArrays so one always would have to know the final array-size and set each element one by one.

Thanks in advance!
