-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CUDAarray support #12
Comments
Another example using Bijectors
using CUDA
using Distributions
using Random
q0_gpu = MvNormal(cu(ones(2))) # reference distribution
ts_gpu = reduce(∘, [Bijectors.PlanarLayer(rand(CURAND.default_rng(), 2), rand(CURAND.default_rng(), 2), rand(CURAND.default_rng(), 1)) for _ in 1:2]) # transformation
flow_gpu = transformed(q0_gpu, ts_gpu)
rand(flow_gpu, 10) error ERROR: This object is not a GPU array
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] backend(#unused#::Type)
@ GPUArraysCore ~/packages/GPUArraysCore/src/GPUArraysCore.jl:148
[3] backend(x::Matrix{Float32})
@ GPUArraysCore ~/packages/GPUArraysCore/src/GPUArraysCore.jl:149
[4] _copyto!
@ ~/packages/GPUArrays/src/host/broadcast.jl:65 [inlined]
[5] materialize!
@ ~/packages/GPUArrays/src/host/broadcast.jl:41 [inlined]
[6] materialize!
@ ./broadcast.jl:881 [inlined]
[7] unwhiten!(r::Matrix{Float32}, a::PDMats.PDiagMat{Float32, CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}}, x::Matrix{Float32})
@ PDMats ~/packages/PDMats/src/pdiagmat.jl:107
[8] unwhiten!
@ ~/packages/PDMats/src/generics.jl:33 [inlined]
[9] _rand!(rng::TaskLocalRNG, d::MvNormal{Float32, PDMats.PDiagMat{Float32, CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}}, FillArrays.Zeros{Float32, 1, Tuple{Base.OneTo{Int64}}}}, x::Matrix{Float32})
@ Distributions ~/packages/Distributions/src/multivariate/mvnormal.jl:277
[10] rand!
@ ~/packages/Distributions/src/genericrand.jl:108 [inlined]
[11] rand
@ ~/packages/Distributions/src/multivariates.jl:23 [inlined]
[12] rand(rng::TaskLocalRNG, td::MultivariateTransformed{MvNormal{Float32, PDMats.PDiagMat{Float32, CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}}, FillArrays.Zeros{Float32, 1, Tuple{Base.OneTo{Int64}}}}, ComposedFunction{PlanarLayer{CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}, Vector{Float32}}, PlanarLayer{CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}, Vector{Float32}}}}, num_samples::Int64)
@ Bijectors ~/packages/Bijectors/src/transformed_distribution.jl:163
[13] rand(s::MultivariateTransformed{MvNormal{Float32, PDMats.PDiagMat{Float32, CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}}, FillArrays.Zeros{Float32, 1, Tuple{Base.OneTo{Int64}}}}, ComposedFunction{PlanarLayer{CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}, Vector{Float32}}, PlanarLayer{CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}, Vector{Float32}}}}, dims::Int64)
@ Distributions ~/packages/Distributions/src/genericrand.jl:22
[14] top-level scope
@ ~/Workspace/julia_gpu/nf.jl:18 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
output
The text was updated successfully, but these errors were encountered: