# Is KNITRO.jl thread-safe

**URL:** https://discourse.julialang.org/t/is-knitro-jl-thread-safe/130717
**Category:** Optimization (Mathematical)
**Tags:** question, jump, multithreading, optimization, knitro
**Created:** [July 14, 2025, 7:55pm UTC](https://discourse.julialang.org/t/is-knitro-jl-thread-safe/130717 "2025-07-14T19:55:04Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![CeterisPartybus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ceterispartybus/32/46868_2.png) [@CeterisPartybus](https://discourse.julialang.org/u/CeterisPartybus)
#### Post date: [July 14, 2025, 7:55pm UTC](https://discourse.julialang.org/t/is-knitro-jl-thread-safe/130717/1 "2025-07-14T19:55:04Z")

</div>

Hi everyone,

is it save to launch multiple instances of Knitro with JuMP at the same time?

I aim to solve a couple of problems at the same time for different parameter combinations on multiple Julia threads. I would define a new JuMP model on each thread and solve it with Knitro simultaneously. Do you see any issues with that?

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: [July 14, 2025, 8:46pm UTC](https://discourse.julialang.org/t/is-knitro-jl-thread-safe/130717/2 "2025-07-14T20:46:34Z")

</div>

I don’t know that I’ve tested it, but I’m not aware of any reason why KNITRO.jl would not be thread-safe.

Did you try? Did it work?

---

<div class="post-metadata">

### Author: ![CeterisPartybus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ceterispartybus/32/46868_2.png) [@CeterisPartybus](https://discourse.julialang.org/u/CeterisPartybus)
#### Post date: [July 14, 2025, 9:00pm UTC](https://discourse.julialang.org/t/is-knitro-jl-thread-safe/130717/3 "2025-07-14T21:00:05Z")

</div>

OK, thanks for the fast reply. I just read that there are issues with multithreading when Julia calls C libraries - Knitro.jl also disables all multithreading on Knitro’s C-side - and wanted to make sure I am not missing something obvious.

I am setting it up right now and will let you know if I encountered any issues.

---

<div class="post-metadata">

### Author: ![CeterisPartybus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ceterispartybus/32/46868_2.png) [@CeterisPartybus](https://discourse.julialang.org/u/CeterisPartybus)
#### Post date: [July 14, 2025, 11:14pm UTC](https://discourse.julialang.org/t/is-knitro-jl-thread-safe/130717/4 "2025-07-14T23:14:14Z")

</div>

Update: My quick implementation seems to work fine. This is by no means a proof that there will never be any issues but my simple implementations with and without multi-threading produce exactly the same results.

High-level summary of what I did:

- Solve a problem whose solution for the unknowns depends on parameters b which are kept fixed while solving the model.
- Loop over a set of values for b.
- In each loop:
  - Set up JuMP model given values for b
  - Optimize JuMP model with Knitro
  - Record results

- Results seem to be exactly identical.
