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

hprod/jprod not GPU-compatible #225

Open
4 tasks
tmigot opened this issue May 7, 2024 · 0 comments
Open
4 tasks

hprod/jprod not GPU-compatible #225

tmigot opened this issue May 7, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@tmigot
Copy link
Member

tmigot commented May 7, 2024

See the following tests:

  • multiple_precision_nls_array(T -> nls_from_T(T; jacobian_backend = ADNLPModels.ForwardDiffADJacobian, hessian_backend = ADNLPModels.ForwardDiffADHessian, jacobian_residual_backend = ADNLPModels.ForwardDiffADJacobian, hessian_residual_backend = ADNLPModels.ForwardDiffADHessian), CuArray, exclude = [jprod, jprod_residual, hprod_residual], linear_api = true)
  • multiple_precision_nlp_array(T -> nlp_from_T(T; jacobian_backend = ADNLPModels.ForwardDiffADJacobian, hessian_backend = ADNLPModels.ForwardDiffADHessian), CuArray, exclude = [jth_hprod, hprod, jprod], linear_api = true)
  • multiple_precision_nls_array(T -> nls_from_T(T; jacobian_backend = ADNLPModels.ForwardDiffADJacobian, hessian_backend = ADNLPModels.ForwardDiffADHessian, jacobian_residual_backend = ADNLPModels.ForwardDiffADJacobian, hessian_residual_backend = ADNLPModels.ForwardDiffADHessian), CuArray, exclude = [jprod, jprod_residual, hprod_residual], linear_api = true)
  • multiple_precision_nlp_array(T -> nlp_from_T(T; jacobian_backend = ADNLPModels.ForwardDiffADJacobian, hessian_backend = ADNLPModels.ForwardDiffADHessian), CuArray, exclude = [jth_hprod, hprod, jprod], linear_api = true)

    A MWE:
using CUDA, ADNLPModels, NLPModels

hs6_autodiff(::Type{T}; kwargs...) where {T <: Number} = hs6_autodiff(Vector{T}; kwargs...)
function hs6_autodiff(::Type{S} = Vector{Float64}; kwargs...) where {S}
  x0 = S([-12 // 10; 1])
  f(x) = (1 - x[1])^2
  c(x) = [10 * (x[2] - x[1]^2)]
  lcon = fill!(S(undef, 1), 0)
  ucon = fill!(S(undef, 1), 0)

  return ADNLPModel(f, x0, c, lcon, ucon, name = "hs6_autodiff"; kwargs...)
end

nlp = hs6_autodiff(CuArray{Float64})
CUDA.allowscalar()
jth_hprod(nlp, nlp.meta.x0, nlp.meta.x0, 1) # same for hprod(nlp, nlp.meta.x0, nlp.meta.x0)
#=
ERROR: GPU compilation of MethodInstance for (::GPUArrays.var"#map_kernel#38"{…})(::CUDA.CuKernelContext, ::CuDeviceVector{…}, ::Base.Broadcast.Broadcasted{…}, ::Int64) failed
KernelError: passing and using non-bitstype argument

Argument 4 to your kernel function is of type Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Tuple{Base.OneTo{Int64}}, ForwardDiff.var"#85#86"{ForwardDiff.Tag{ADNLPModels.var"#lag#141"{Int64, var"#f#6", Int64, ADNLPModels.var"#c!#319"{var"#c#7"}, ADNLPModels.var"#lag#134#142"}, Float64}}, Tuple{Base.Broadcast.Extruded{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ADNLPModels.var"#lag#141"{Int64, var"#f#6", Int64, ADNLPModels.var"#c!#319"{var"#c#7"}, ADNLPModels.var"#lag#134#142"}, Float64}, Float64, 1}}, Tuple{Bool}, Tuple{Int64}}}}, which is not isbits:
  .args is of type Tuple{Base.Broadcast.Extruded{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ADNLPModels.var"#lag#141"{Int64, var"#f#6", Int64, ADNLPModels.var"#c!#319"{var"#c#7"}, ADNLPModels.var"#lag#134#142"}, Float64}, Float64, 1}}, Tuple{Bool}, Tuple{Int64}}} which is not isbits.
    .1 is of type Base.Broadcast.Extruded{Vector{ForwardDiff.Dual{ForwardDiff.Tag{ADNLPModels.var"#lag#141"{Int64, var"#f#6", Int64, ADNLPModels.var"#c!#319"{var"#c#7"}, ADNLPModels.var"#lag#134#142"}, Float64}, Float64, 1}}, Tuple{Bool}, Tuple{Int64}} which is not isbits.
      .x is of type Vector{ForwardDiff.Dual{ForwardDiff.Tag{ADNLPModels.var"#lag#141"{Int64, var"#f#6", Int64, ADNLPModels.var"#c!#319"{var"#c#7"}, ADNLPModels.var"#lag#134#142"}, Float64}, Float64, 1}} which is not isbits.
=#
@tmigot tmigot added the bug Something isn't working label May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant