# Parallelization with Evolutionary.jl

**URL:** https://discourse.julialang.org/t/parallelization-with-evolutionary-jl/135286
**Category:** General Usage
**Tags:** question, package, evolutionary
**Created:** [January 27, 2026, 4:02pm UTC](https://discourse.julialang.org/t/parallelization-with-evolutionary-jl/135286 "2026-01-27T16:02:50Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [January 27, 2026, 4:02pm UTC](https://discourse.julialang.org/t/parallelization-with-evolutionary-jl/135286/1 "2026-01-27T16:02:50Z")

</div>

I would like to run an optimzation with a costly objective function (about 1s execution time) in parallel. The [documentation](https://wildart.github.io/Evolutionary.jl/dev/tutorial/#Parallelization) says:

> If the objective function is heavily CPU-bound, it’s possible to utilize multiple processors/threads to speed up computations. To enable multi-threading evaluation of the objective function, set `parallelization` option to `:thread` in the [`Options`](https://wildart.github.io/Evolutionary.jl/dev/tutorial/#Evolutionary.Options) object.

Is it possible to use multiple processes instead of multiple threads? If yes, how?

EDIT: Currently, according to [Parallelization · Issue #45 · wildart/Evolutionary.jl · GitHub](https://github.com/wildart/Evolutionary.jl/issues/45) that is not possible.

Any ideas on how to make it work, even though it is currently not implemented?

---

<div class="post-metadata">

### Author: ![karei](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/karei/32/214809_2.png) [@karei](https://discourse.julialang.org/u/karei)
#### Post date: [January 27, 2026, 4:14pm UTC](https://discourse.julialang.org/t/parallelization-with-evolutionary-jl/135286/2 "2026-01-27T16:14:52Z")

</div>

I would first recommend using multiprocessing. This approach requires no code changes—simply open multiple Windows terminals or VS Code instances to execute your Julia code. It eliminates the need for code maintenance.

When using multiprocessing, disable parallelism for all libraries. Set linear algebra libraries like BLAS to single-threaded mode. If using HiGHS, configure it to use no more than two threads.

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [January 27, 2026, 4:17pm UTC](https://discourse.julialang.org/t/parallelization-with-evolutionary-jl/135286/3 "2026-01-27T16:17:34Z")

</div>

> [@karei](#):
>
> This approach requires no code changes—simply open multiple Windows terminals or VS Code instances to execute your Julia code.

This will not work. An optimizer calls the cost function. I cannot convince the optimizer to open multiple terminals. It should use DistributedNext.jl and the `addprocs()` function.

---

<div class="post-metadata">

### Author: ![karei](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/karei/32/214809_2.png) [@karei](https://discourse.julialang.org/u/karei)
#### Post date: [January 27, 2026, 4:34pm UTC](https://discourse.julialang.org/t/parallelization-with-evolutionary-jl/135286/4 "2026-01-27T16:34:05Z")

</div>

For multiprocess, I think we can keep parallelism entirely behind the batched fitness hook (`value!`).

Evolutionary.jl already has a batched `value!` hook. We’d “add” a new `Options.parallelization` mode (e.g. `:distributed`) and implement its `value!` method using multiprocess evaluation, while keeping the same in-place contract.

Then you can choose the backend (`pmap`, a worker pool, etc.) without changing the GA loop.

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [January 27, 2026, 5:01pm UTC](https://discourse.julialang.org/t/parallelization-with-evolutionary-jl/135286/5 "2026-01-27T17:01:40Z")

</div>

Would that also work with [CMA-ES](https://wildart.github.io/Evolutionary.jl/dev/cmaes/)?

---

<div class="post-metadata">

### Author: ![Mathieu](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@Mathieu](https://discourse.julialang.org/u/Mathieu)
#### Post date: [January 27, 2026, 5:22pm UTC](https://discourse.julialang.org/t/parallelization-with-evolutionary-jl/135286/6 "2026-01-27T17:22:32Z")

</div>

Metaheuristics.jl supports parallelization.

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [January 27, 2026, 5:24pm UTC](https://discourse.julialang.org/t/parallelization-with-evolutionary-jl/135286/7 "2026-01-27T17:24:10Z")

</div>

Nice! But it does not support CMA-ES, correct?

---

<div class="post-metadata">

### Author: ![Mathieu](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@Mathieu](https://discourse.julialang.org/u/Mathieu)
#### Post date: [January 27, 2026, 5:25pm UTC](https://discourse.julialang.org/t/parallelization-with-evolutionary-jl/135286/8 "2026-01-27T17:25:51Z")

</div>

Ah, indeed.

---

<div class="post-metadata">

### Author: ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)
#### Post date: [January 27, 2026, 6:16pm UTC](https://discourse.julialang.org/t/parallelization-with-evolutionary-jl/135286/9 "2026-01-27T18:16:33Z")

</div>

> [@ufechner7](#):
>
> Would that also work with [CMA-ES](https://wildart.github.io/Evolutionary.jl/dev/cmaes/)?

You can do it with [CMAEvolutionStrategy](https://github.com/jbrea/CMAEvolutionStrategy.jl), by setting `parallel_evaluation = true` and leaving the default value of `false` for the `multi_threading` keyword argument. From [the docstring for `minimize`](https://github.com/jbrea/CMAEvolutionStrategy.jl/blob/6c5544a357db5dfe23ccd663663fbd881f3dca1d/src/CMAEvolutionStrategy.jl#L54-L113):

If `parallel_evaluation = true`, the objective function `f` receives matrices  
of `n` rows (`n = length(x0)`) and `popsize` columns and should return a vector of  
length `popsize`.

So your objective function is responsible for distributing the `popsize` objective vectors to the parallel workers and collecting up the results.
