# DifferentialEquations Multithreading ; How to use EnsembleProblem

**URL:** <https://discourse.julialang.org/t/differentialequations-multithreading-how-to-use-ensembleproblem/81018>\
**Category:** New to Julia\
**Tags:** differentialequation\
**Created:** [May 13, 2022, 1:30pm UTC](https://discourse.julialang.org/t/differentialequations-multithreading-how-to-use-ensembleproblem/81018 "2022-05-13T13:30:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eurel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eurel/32/35982_2.png) [@Eurel](https://discourse.julialang.org/u/Eurel)\
**Post date:** [May 13, 2022, 1:30pm UTC](https://discourse.julialang.org/t/differentialequations-multithreading-how-to-use-ensembleproblem/81018/1 "2022-05-13T13:30:13Z")

</div>

Hi, would like to parallelize the solving of an ODE with DiferentialEquations.jl utilizing multi-threading, but i fail to understand how EnsembleProblem works exactly, I am a bit confused over the “tarjectories” parameter.

When I solve my ODEProblem that i converted to an EnsembleProblem, the following will use one of my thread

```julia
sim = solve(ensemble_prob,alg,EnsembleThreads(),trajectories=1)

```

Whereas this would use 12 of my threads

```julia
sim = solve(ensemble_prob,alg,EnsembleThreads(),trajectories=12)

```

I see in the provided examples thousands of trajectories are used, what does it mean exactly ?  
Is it the wrong way of parallelizing a solver ?

---

<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:** [May 13, 2022, 6:19pm UTC](https://discourse.julialang.org/t/differentialequations-multithreading-how-to-use-ensembleproblem/81018/2 "2022-05-13T18:19:56Z")

</div>

> [@Eurel](#):
>
> I see in the provided examples thousands of trajectories are used, what does it mean exactly ?

It means that’s the number of ODEs that are being solved.

> [@Eurel](#):
>
> Is it the wrong way of parallelizing a solver ?

It doesn’t “parallelize a solver”, it parallelizes the solver over many parameters, initial conditions, etc.
