Skip to content
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

Element-wise conversion to Duals #127

Closed
ChrisRackauckas opened this issue Jun 29, 2019 · 2 comments
Closed

Element-wise conversion to Duals #127

ChrisRackauckas opened this issue Jun 29, 2019 · 2 comments
Labels
bug Something isn't working cuda array Stuff about CuArray.

Comments

@ChrisRackauckas
Copy link
Member

MWE:

using ForwardDiff
a = CuArray(ForwardDiff.Dual{Nothing}.([1.0,2.0,3.0]))
b = [1.0,2.0,3.0]
convert.(eltype(a),b) # Works
convert.(eltype(a),CuArray(b)) # Fails
@maleadt maleadt transferred this issue from JuliaGPU/CuArrays.jl May 27, 2020
@maleadt maleadt added bug Something isn't working cuda array Stuff about CuArray. labels May 27, 2020
@vpuri3
Copy link
Contributor

vpuri3 commented Oct 26, 2023

Looks like this is fixed now.

julia> using ForwardDiff

julia> a = CuArray(ForwardDiff.Dual{Nothing}.([1.0,2.0,3.0]))
3-element CuArray{ForwardDiff.Dual{Nothing, Float64, 0}, 1, CUDA.Mem.DeviceBuffer}:
 Dual{Nothing}(1.0)
 Dual{Nothing}(2.0)
 Dual{Nothing}(3.0)

julia> b = [1.0,2.0,3.0]
3-element Vector{Float64}:
 1.0
 2.0
 3.0

julia> convert.(eltype(a),b) # Works
3-element Vector{ForwardDiff.Dual{Nothing, Float64, 0}}:
 Dual{Nothing}(1.0)
 Dual{Nothing}(2.0)
 Dual{Nothing}(3.0)

julia> convert.(eltype(a),CuArray(b)) # Works
3-element CuArray{ForwardDiff.Dual{Nothing, Float64, 0}, 1, CUDA.Mem.DeviceBuffer}:
 Dual{Nothing}(1.0)
 Dual{Nothing}(2.0)
 Dual{Nothing}(3.0)
julia> versioninfo()
Julia Version 1.10.0-beta3
Commit 404750f8586 (2023-10-03 12:53 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 24 × Intel(R) Core(TM) i9-7920X CPU @ 2.90GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, skylake-avx512)
  Threads: 30 on 24 virtual cores
Environment:
  JULIA_NUM_PRECOMPILE_TASKS = 24
  JULIA_DEPOT_PATH = /home/vedantpu/.julia
  JULIA_PKG_DEVDIR = /home/vedantpu/.julia/dev

(MyPkg) pkg> st CUDA ForwardDiff
Project GeometryLearning v0.0.1
Status `~/.julia/dev/GeometryLearning.jl/Project.toml`
  [052768ef] CUDA v5.0.0
  [f6369f11] ForwardDiff v0.10.36

@maleadt
Copy link
Member

maleadt commented Oct 26, 2023

Great, thanks for checking!

@maleadt maleadt closed this as completed Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cuda array Stuff about CuArray.
Projects
None yet
Development

No branches or pull requests

3 participants