Dear all,
I have a question about how to pass a structure built with a constructor on a GPU card. My structure is defined as
struct FieldParams{T}
I₀ :: T
λ₀ :: T
α :: T
r :: T
ω :: T
E₀ :: T
Up :: T
T₀ :: T
NbCycles :: Int
function FieldParams{T}(I₀, λ₀, α,r,NbCycles) where {T}
c = 299792458.0
ω = 2 * π * c / (λ₀ * 1e-9) * 2.4e-17
E₀ = sqrt(I₀)
Up = I₀ / (4.0 * ω^2)
T₀ = 2.0 * π / ω
new{T}(I₀, λ₀, α, r, ω, E₀, Up, T₀,NbCycles)
end
end
Where T=Float32 for example.
I call it using
T = Float32 #Better to work with Flux and CUDA
Field parameters
λ₀ = T(800.) #En nanometres
I₀ = T(3.e13/3.5e16) #(3.0e13/3.5e16)
r = T(0.1)
α = T(-1.)
NbCycles = 4
fdp=FieldParams{T}(I₀,λ₀,α,r,NbCycles)
I tried with the Adapt.jl but without any success. Do you have some recommendations about how I can manage to put this structure on my GPU.
Thanks a lot.
Baptiste