Hi.
I know how to create a gpu array, but has no clue how to convert an initialized array to a gpu array in a julia file rather than the julia prompt.
I tried code like this:
# In a julia file
A = [1.0, 2.0, 3.0] |> gpu
C = [1.0, 2.0, 3.0]
println(typeof(C)) #Vector{Float64}
C |> gpu
println(typeof(C)) #Vector{Float64}
println(typeof(A)) #CuArray{Float32, 1, CUDA.DeviceMemory}
So in a julia file, I cannot convert using “|> gpu”
However, it works in julia prompt.
julia> C = [1.0,2.0,3.0]
3-element Vector{Float64}:
1.0
2.0
3.0
julia> C |> gpu
3-element CuArray{Float32, 1, CUDA.DeviceMemory}:
1.0
2.0
3.0
I wonder how to convert in a julia file