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

Running into a mysterious zero div error #75

Open
sharabhshukla opened this issue Apr 12, 2024 · 5 comments · Fixed by #77
Open

Running into a mysterious zero div error #75

sharabhshukla opened this issue Apr 12, 2024 · 5 comments · Fixed by #77

Comments

@sharabhshukla
Copy link

sharabhshukla commented Apr 12, 2024

I am getting started with the MadNLPGPU and ExaModels, I am already able to run the native ExaModels and solve nlps on a GPU. However, while using the JuMP Interface, I am running into a mysterious error,

ERROR: LoadError: DivideError: integer division error
Stacktrace:
  [1] div
    @ ./int.jl:295 [inlined]
  [2] div
    @ ./div.jl:308 [inlined]
  [3] div
    @ ./div.jl:353 [inlined]
  [4] fld
    @ ./div.jl:319 [inlined]
  [5] mod
    @ ./int.jl:287 [inlined]
  [6] #4
    @ ~/.julia/packages/KernelAbstractions/zPAn3/src/nditeration.jl:121 [inlined]
  [7] ntuple
    @ ./ntuple.jl:48 [inlined]
  [8] partition
    @ ~/.julia/packages/KernelAbstractions/zPAn3/src/nditeration.jl:119 [inlined]
  [9] partition
    @ ~/.julia/packages/KernelAbstractions/zPAn3/src/KernelAbstractions.jl:628 [inlined]
 [10] launch_config
    @ ~/.julia/packages/CUDA/htRwP/src/CUDAKernels.jl:88 [inlined]
 [11] (::KernelAbstractions.Kernel{CUDABackend, KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.DynamicSize, typeof(MadNLPGPU.gpu__force_lower_triangular!)})(::CuArray{Int32, 1, CUDA.Mem.DeviceBuffer}, ::Vararg{CuArray{Int32, 1, CUDA.Mem.DeviceBuffer}}; ndrange::Int64, workgroupsize::Nothing)
    @ CUDA.CUDAKernels ~/.julia/packages/CUDA/htRwP/src/CUDAKernels.jl:108
 [12] Kernel
    @ ~/.julia/packages/CUDA/htRwP/src/CUDAKernels.jl:105 [inlined]
 [13] force_lower_triangular!
    @ ~/.julia/packages/MadNLPGPU/DvKUv/src/interface.jl:314 [inlined]
 [14] create_kkt_system(::Type{MadNLP.SparseCondensedKKTSystem}, cb::MadNLP.SparseCallback{Float64, CuArray{Float64, 1, CUDA.Mem.DeviceBuffer}, CuArray{Int64, 1, CUDA.Mem.DeviceBuffer}, ExaModel{Float64, CuArray{Float64, 1, CUDA.Mem.DeviceBuffer}, ExaModelsKernelAbstractions.KAExtension{Float64, CuArray{Float64, 1, CUDA.Mem.DeviceBuffer}, Nothing, CuArray{Tuple{Int64, Int64}, 1, CUDA.Mem.DeviceBuffer}, CuArray{Int64, 1, CUDA.Mem.DeviceBuffer}, CUDABackend}, ExaModels.ObjectiveNull, ExaModels.ConstraintAug{ExaModels.ConstraintAug{ExaModels.Constraint{ExaModels.ConstraintNull, ExaModels.SIMDFunction{ExaModels.Null{Nothing}, ExaModels.Compressor{Tuple{}}, ExaModels.Compressor{Tuple{}}}, CuArray{Int64, 1, CUDA.Mem.DeviceBuffer}, Int64}, ExaModels.SIMDFunction{Pair{ExaModels.ParIndexed{ExaModels.ParSource, 3}, ExaModels.Node2{typeof(*), ExaModels.Var{ExaModels.ParIndexed{ExaModels.ParSource, 1}}, ExaModels.ParIndexed{ExaModels.ParSource, 2}}}, ExaModels.Compressor{Tuple{Int64}}, ExaModels.Compressor{Tuple{}}}, CuArray{Tuple{Int64, Float64, Int64}, 1, CUDA.Mem.DeviceBuffer}}, ExaModels.SIMDFunction{ExaModels.Null{Float64}, ExaModels.Compressor{Tuple{}}, ExaModels.Compressor{Tuple{}}}, CuArray{Tuple{Int64}, 1, CUDA.Mem.DeviceBuffer}}}, MadNLP.RelaxBound, MadNLP.RelaxEquality}, ind_cons::@NamedTuple{ind_eq::CuArray{Int64, 1, CUDA.Mem.DeviceBuffer}, ind_ineq::CuArray{Int64, 1, CUDA.Mem.DeviceBuffer}, ind_fixed::CuArray{Int64, 1, CUDA.Mem.DeviceBuffer}, ind_lb::CuArray{Int64, 1, CUDA.Mem.DeviceBuffer}, ind_ub::CuArray{Int64, 1, CUDA.Mem.DeviceBuffer}, ind_llb::CuArray{Int64, 1, CUDA.Mem.DeviceBuffer}, ind_uub::CuArray{Int64, 1, CUDA.Mem.DeviceBuffer}}, linear_solver::Type{MadNLPGPU.CUDSSSolver}; opt_linear_solver::MadNLPGPU.CudssSolverOptions, hessian_approximation::Type)
    @ MadNLP ~/.julia/packages/MadNLP/RRGPv/src/KKT/sparse.jl:480
 [15] MadNLPSolver(nlp::ExaModel{Float64, CuArray{Float64, 1, CUDA.Mem.DeviceBuffer}, ExaModelsKernelAbstractions.KAExtension{Float64, CuArray{Float64, 1, CUDA.Mem.DeviceBuffer}, Nothing, CuArray{Tuple{Int64, Int64}, 1, CUDA.Mem.DeviceBuffer}, CuArray{Int64, 1, CUDA.Mem.DeviceBuffer}, CUDABackend}, ExaModels.ObjectiveNull, ExaModels.ConstraintAug{ExaModels.ConstraintAug{ExaModels.Constraint{ExaModels.ConstraintNull, ExaModels.SIMDFunction{ExaModels.Null{Nothing}, ExaModels.Compressor{Tuple{}}, ExaModels.Compressor{Tuple{}}}, CuArray{Int64, 1, CUDA.Mem.DeviceBuffer}, Int64}, ExaModels.SIMDFunction{Pair{ExaModels.ParIndexed{ExaModels.ParSource, 3}, ExaModels.Node2{typeof(*), ExaModels.Var{ExaModels.ParIndexed{ExaModels.ParSource, 1}}, ExaModels.ParIndexed{ExaModels.ParSource, 2}}}, ExaModels.Compressor{Tuple{Int64}}, ExaModels.Compressor{Tuple{}}}, CuArray{Tuple{Int64, Float64, Int64}, 1, CUDA.Mem.DeviceBuffer}}, ExaModels.SIMDFunction{ExaModels.Null{Float64}, ExaModels.Compressor{Tuple{}}, ExaModels.Compressor{Tuple{}}}, CuArray{Tuple{Int64}, 1, CUDA.Mem.DeviceBuffer}}}; kwargs::@Kwargs{})
    @ MadNLP ~/.julia/packages/MadNLP/RRGPv/src/IPM/IPM.jl:155
 [16] MadNLPSolver
    @ ~/.julia/packages/MadNLP/RRGPv/src/IPM/IPM.jl:115 [inlined]
 [17] madnlp(model::ExaModel{Float64, CuArray{Float64, 1, CUDA.Mem.DeviceBuffer}, ExaModelsKernelAbstractions.KAExtension{Float64, CuArray{Float64, 1, CUDA.Mem.DeviceBuffer}, Nothing, CuArray{Tuple{Int64, Int64}, 1, CUDA.Mem.DeviceBuffer}, CuArray{Int64, 1, CUDA.Mem.DeviceBuffer}, CUDABackend}, ExaModels.ObjectiveNull, ExaModels.ConstraintAug{ExaModels.ConstraintAug{ExaModels.Constraint{ExaModels.ConstraintNull, ExaModels.SIMDFunction{ExaModels.Null{Nothing}, ExaModels.Compressor{Tuple{}}, ExaModels.Compressor{Tuple{}}}, CuArray{Int64, 1, CUDA.Mem.DeviceBuffer}, Int64}, ExaModels.SIMDFunction{Pair{ExaModels.ParIndexed{ExaModels.ParSource, 3}, ExaModels.Node2{typeof(*), ExaModels.Var{ExaModels.ParIndexed{ExaModels.ParSource, 1}}, ExaModels.ParIndexed{ExaModels.ParSource, 2}}}, ExaModels.Compressor{Tuple{Int64}}, ExaModels.Compressor{Tuple{}}}, CuArray{Tuple{Int64, Float64, Int64}, 1, CUDA.Mem.DeviceBuffer}}, ExaModels.SIMDFunction{ExaModels.Null{Float64}, ExaModels.Compressor{Tuple{}}, ExaModels.Compressor{Tuple{}}}, CuArray{Tuple{Int64}, 1, CUDA.Mem.DeviceBuffer}}}; kwargs::@Kwargs{})
    @ MadNLP ~/.julia/packages/MadNLP/RRGPv/src/IPM/solver.jl:10
 [18] madnlp(model::ExaModel{Float64, CuArray{Float64, 1, CUDA.Mem.DeviceBuffer}, ExaModelsKernelAbstractions.KAExtension{Float64, CuArray{Float64, 1, CUDA.Mem.DeviceBuffer}, Nothing, CuArray{Tuple{Int64, Int64}, 1, CUDA.Mem.DeviceBuffer}, CuArray{Int64, 1, CUDA.Mem.DeviceBuffer}, CUDABackend}, ExaModels.ObjectiveNull, ExaModels.ConstraintAug{ExaModels.ConstraintAug{ExaModels.Constraint{ExaModels.ConstraintNull, ExaModels.SIMDFunction{ExaModels.Null{Nothing}, ExaModels.Compressor{Tuple{}}, ExaModels.Compressor{Tuple{}}}, CuArray{Int64, 1, CUDA.Mem.DeviceBuffer}, Int64}, ExaModels.SIMDFunction{Pair{ExaModels.ParIndexed{ExaModels.ParSource, 3}, ExaModels.Node2{typeof(*), ExaModels.Var{ExaModels.ParIndexed{ExaModels.ParSource, 1}}, ExaModels.ParIndexed{ExaModels.ParSource, 2}}}, ExaModels.Compressor{Tuple{Int64}}, ExaModels.Compressor{Tuple{}}}, CuArray{Tuple{Int64, Float64, Int64}, 1, CUDA.Mem.DeviceBuffer}}, ExaModels.SIMDFunction{ExaModels.Null{Float64}, ExaModels.Compressor{Tuple{}}, ExaModels.Compressor{Tuple{}}}, CuArray{Tuple{Int64}, 1, CUDA.Mem.DeviceBuffer}}})
    @ MadNLP ~/.julia/packages/MadNLP/RRGPv/src/IPM/solver.jl:9
 [19] top-level scope
    @ ~/julianlpcuda/test_simple_nlp.jl:11
in expression starting at /home/ubuntu/julianlpcuda/test_simple_nlp.jl:11

Here is the script I am running,

using MadNLP, JuMP, MadNLPGPU, CUDA, ExaModels


model = Model()
@variable(model, x >= 0)
@variable(model, 0 <= y <= 3)
@NLobjective(model, Min, 12x + 20y)
@constraint(model, c1, 6x + 8y >= 100)
@constraint(model, c2, 7x + 12y >= 120)
em = ExaModel(model; backend = CUDABackend())
result = madnlp(em)
@sshin23
Copy link
Collaborator

sshin23 commented Apr 12, 2024

Thanks for reporting this; this seems to be a bug. We'll work on the fix

@sshin23 sshin23 linked a pull request Apr 12, 2024 that will close this issue
@sshin23
Copy link
Collaborator

sshin23 commented Apr 12, 2024

We have fixed this in #77 and MadNLP/MadNLP.jl#326. We'll do a patch release in the next few days.

A side note: we currently do not support @NL.... Please try @objective

@sharabhshukla
Copy link
Author

@sshin23 , Thank you for the prompt response. Looking forward to the new release

@sharabhshukla
Copy link
Author

Ok, I tried objective instead of NL, still the same error

@sshin23 sshin23 reopened this Apr 17, 2024
@sshin23
Copy link
Collaborator

sshin23 commented Apr 17, 2024

@sharabhshukla It will work once MadNLP/MadNLP.jl#326 is merged and a new version is released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants