# DAE - Sundials parallel capabilities access through sundials.jl or DifferentialEquation.jl

**URL:** <https://discourse.julialang.org/t/dae-sundials-parallel-capabilities-access-through-sundials-jl-or-differentialequation-jl/99924>\
**Category:** Numerics\
**Tags:** question, differentialequation, sundials\
**Created:** [June 6, 2023, 7:50am UTC](https://discourse.julialang.org/t/dae-sundials-parallel-capabilities-access-through-sundials-jl-or-differentialequation-jl/99924 "2023-06-06T07:50:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Relojuca](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/relojuca/32/50512_2.png) [@Relojuca](https://discourse.julialang.org/u/Relojuca)\
**Post date:** [June 6, 2023, 7:50am UTC](https://discourse.julialang.org/t/dae-sundials-parallel-capabilities-access-through-sundials-jl-or-differentialequation-jl/99924/1 "2023-06-06T07:50:24Z")

</div>

Hi People.

I am implementing a code for solving a DAE system using sundials and IDA (through the DifferentialEquation.jl interface). However, as my simulation requires the solution of several equations \> 500. It is taking a long time for ending each simulation. So, I am wondering, if it is possible to use the native sundials capabilities to achieve a parallel solution. It is possible from the Julia sundials or DifferentialEquation.jl wrappers?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [June 6, 2023, 8:16am UTC](https://discourse.julialang.org/t/dae-sundials-parallel-capabilities-access-through-sundials-jl-or-differentialequation-jl/99924/2 "2023-06-06T08:16:03Z")

</div>

Someone would have to implement it. Right now it’s all setup to use NVectorSerial

---

<div class="post-metadata">

**Author:** ![Relojuca](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/relojuca/32/50512_2.png) [@Relojuca](https://discourse.julialang.org/u/Relojuca)\
**Post date:** [June 6, 2023, 11:29am UTC](https://discourse.julialang.org/t/dae-sundials-parallel-capabilities-access-through-sundials-jl-or-differentialequation-jl/99924/3 "2023-06-06T11:29:08Z")

</div>

Thank you for your response. I am new in Julia and C++ but I am really interested to use this functionality. So, there is an similar implementation that I could use as a guide?

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [June 6, 2023, 11:27pm UTC](https://discourse.julialang.org/t/dae-sundials-parallel-capabilities-access-through-sundials-jl-or-differentialequation-jl/99924/4 "2023-06-06T23:27:07Z")

</div>

This unfortunately isn’t the most trivial thing to implement. The steps are:

1. Update the generator in order to get the other NVector type APIs wrapped ([Sundials.jl/generate.jl at master · SciML/Sundials.jl · GitHub](https://github.com/SciML/Sundials.jl/blob/master/gen/generate.jl)) into ([Sundials.jl/libsundials\_api.jl at master · SciML/Sundials.jl · GitHub](https://github.com/SciML/Sundials.jl/blob/master/lib/libsundials_api.jl)).
2. Improve the Yggdrasil build [GitHub - JuliaPackaging/Yggdrasil: Collection of builder repositories for BinaryBuilder.jl](https://github.com/JuliaPackaging/Yggdrasil) so that the binaries are built with the right parallelism extensions.
3. Make the SciML common interface part be generic to the NVector choice and make a new high level alg.

3, the Julia code part, is relatively easy. 1 and 2 are the hard parts.

---

<div class="post-metadata">

**Author:** ![Relojuca](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/relojuca/32/50512_2.png) [@Relojuca](https://discourse.julialang.org/u/Relojuca)\
**Post date:** [June 25, 2023, 9:56am UTC](https://discourse.julialang.org/t/dae-sundials-parallel-capabilities-access-through-sundials-jl-or-differentialequation-jl/99924/5 "2023-06-25T09:56:24Z")

</div>

Hi! For now I am getting some parallel capabilities after using linear\_solver=:LapackDense. However, I am wondering if there is a way to increase the number of threads. Because, I have the impression that the solver didn’t use all the computer threads. So there is some kind of configuration key that I can use through the DifferentialEquation.jl wrapper?

Thank you so much for your help!

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [June 25, 2023, 11:29am UTC](https://discourse.julialang.org/t/dae-sundials-parallel-capabilities-access-through-sundials-jl-or-differentialequation-jl/99924/6 "2023-06-25T11:29:28Z")

</div>

> [@Relojuca](#):
>
> Hi! For now I am getting some parallel capabilities after using linear\_solver=:LapackDense. However, I am wondering if there is a way to increase the number of threads. Because, I have the impression that the solver didn’t use all the computer threads. So there is some kind of configuration key that I can use through the DifferentialEquation.jl wrapper?

For BLAS that’s done via Julia’s BLAS commands. `BLAS.set_num_threads(n)`
