# MadNLPGPU with cuDSS and other linear solvers

**URL:** <https://discourse.julialang.org/t/madnlpgpu-with-cudss-and-other-linear-solvers/124558>\
**Category:** Optimization (Mathematical)\
**Tags:** nonlinear-optimizati\
**Created:** [January 9, 2025, 1:45am UTC](https://discourse.julialang.org/t/madnlpgpu-with-cudss-and-other-linear-solvers/124558 "2025-01-09T01:45:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gangway](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gangway/32/205243_2.png) [@gangway](https://discourse.julialang.org/u/gangway)\
**Post date:** [January 9, 2025, 1:45am UTC](https://discourse.julialang.org/t/madnlpgpu-with-cudss-and-other-linear-solvers/124558/1 "2025-01-09T01:45:06Z")

</div>

Trying to solve nonlinear JuMP models with MadNLP.Optimizer(linear\_solver=CUDSSSolver).  
I have added MadNLP, MadNLPGPU, CUDSS, and CUDSS\_jll.  
While activating project, I keep getting warning for circular dependencies.  
And the error “`CUDSSSolver` not defined” whenever I initialize a model or optimize.  
I was able to run it with LapackGPUsolvers. What’s the correct procedure to run JuMP models with MadNLPGPU cuDSS,solver and how to solve the cirular dependencies?  
My current approach is:  
using JuMP, MadNLP, CUDA, MadNLPGPU  
mod = Model(() -\>MadNLP.Optimizer(linear\_solver=CUDSSSolver))

Would appreciate any support/insight. Thanks!

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [January 9, 2025, 6:53am UTC](https://discourse.julialang.org/t/madnlpgpu-with-cudss-and-other-linear-solvers/124558/2 "2025-01-09T06:53:09Z")

</div>

This is a question for @sshin23 or @amontoison

---

<div class="post-metadata">

**Author:** ![amontoison](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amontoison/32/218741_2.png) [@amontoison](https://discourse.julialang.org/u/amontoison)\
**Post date:** [January 9, 2025, 7:15am UTC](https://discourse.julialang.org/t/madnlpgpu-with-cudss-and-other-linear-solvers/124558/3 "2025-01-09T07:15:59Z")

</div>

The problem of cirlculant dependencies is related to an extension of Atomix.jl and it impacts all the GPU ecosystem.  
I didn’t investigated if we can solve it with a specific bound of some packages.

For solving JuMP problems on GPU, you need to convert them in ExaModels such that we can perform the AD on GPU:

> **[JuMP Interface (experimental) · ExaModels.jl](https://exanauts.github.io/ExaModels.jl/dev/jump/)**
>
> Documentation for ExaModels.jl.

---

<div class="post-metadata">

**Author:** ![gangway](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gangway/32/205243_2.png) [@gangway](https://discourse.julialang.org/u/gangway)\
**Post date:** [January 9, 2025, 5:10pm UTC](https://discourse.julialang.org/t/madnlpgpu-with-cudss-and-other-linear-solvers/124558/4 "2025-01-09T17:10:34Z")

</div>

I converted a JuMP model ( AC-OPF model solves easily with most optimizers) to ExaModels and ran it with LapackGPU and cuDSS.

Firstly, as per MadNLP github I should be using CUDSSSolver, but I get

set\_optimizer(mod, () → ExaModels.MadNLPOptimizer(CUDSSSolver))  
ERROR: UndefVarError: `CUDSSSolver` not defined in `Main`

Instead just ‘CUDSS’ works but then I get:

resutl = madnlp(em)  
EXIT: Internal Error.  
ERROR: Scalar indexing is disallowed.  
Invocation of setindex! resulted in scalar indexing of a GPU array.  
This is typically caused by calling an iterating implementation of a method.  
Such implementations _do not_ execute on the GPU, but very slowly on the CPU,  
and therefore should be avoided.

This error happens with LapackGPUSolver as well.  
Also which packages to I need to access CuCholeskySolver, GLUSolver and RFSolver?

---

<div class="post-metadata">

**Author:** ![amontoison](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amontoison/32/218741_2.png) [@amontoison](https://discourse.julialang.org/u/amontoison)\
**Post date:** [January 9, 2025, 11:55pm UTC](https://discourse.julialang.org/t/madnlpgpu-with-cudss-and-other-linear-solvers/124558/5 "2025-01-09T23:55:12Z")

</div>

Can you please add a complete code snippet with the imported packages as well as the stack trace for the errors?  
I can’t help with what your provided.

For the packages, you need `MadNLP`, `MadNLPGPU` and `ExaModels`.  
`MadNLPGPU` has the dependencies for CUDSS, CUSOLVERRF, GPUSolver, etc…
