# Question about parallel computation in OpenTURNS Pareto frontier optimization

**URL:** <https://openturns.discourse.group/t/question-about-parallel-computation-in-openturns-pareto-frontier-optimization/427>\
**Category:** Python usage\
**Created:** [November 12, 2025, 4:06pm UTC](https://openturns.discourse.group/t/question-about-parallel-computation-in-openturns-pareto-frontier-optimization/427 "2025-11-12T16:06:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![XavierFaure](https://avatars.discourse-cdn.com/v4/letter/x/f6c823/32.png) [@XavierFaure](https://openturns.discourse.group/u/XavierFaure)\
**Post date:** [November 12, 2025, 4:06pm UTC](https://openturns.discourse.group/t/question-about-parallel-computation-in-openturns-pareto-frontier-optimization/427/1 "2025-11-12T16:06:29Z")

</div>

Dear all,

I’m using **OpenTURNS** to compute the Pareto frontier of some problems with two objective (cost) functions. I’ve managed to use it as intended, but I’m struggling with the computational burden. Currently, all runs are executed sequentially, regardless of the population size.

As I understand it, an initial population is generated, and then the next generation is formed by selecting the best individuals from the previous one to perform genetic crossover, and so on. However, I haven’t been able to make use of parallel computation within each population. The `blockSize` option doesn’t seem to have any effect.

Could you please confirm whether I’ve understood the algorithm correctly? And is there a way to make it more time-efficient by using parallel computing (i.e., evaluating several individuals in parallel)?

Thank you very much for any help.

Best Regards

---

<div class="post-metadata">

**Author:** ![schueller](https://yyz2.discourse-cdn.com/free1/user_avatar/openturns.discourse.group/schueller/32/3_2.png) [@schueller](https://openturns.discourse.group/u/schueller)\
**Post date:** [November 13, 2025, 8:53am UTC](https://openturns.discourse.group/t/question-about-parallel-computation-in-openturns-pareto-frontier-optimization/427/2 "2025-11-13T08:53:57Z")

</div>

Hello,

First, check that the Pagmo algorithm you are using supports batch evaluation (“Batch” column of the algorithm tab in the notes section):

> **[Pagmo — OpenTURNS 1.25 documentation](https://openturns.github.io/openturns/latest/user_manual/_generated/openturns.Pagmo.html)**

Then as you noticed, you must use of the setBlockSize method to send multiple points at once to the function.

Finally, your function must support parallel evaluation, for example by setting the n\_cpus option of the PythonFunction (using multiprocessing):

> **[PythonFunction — OpenTURNS 1.25 documentation](https://openturns.github.io/openturns/latest/user_manual/_generated/openturns.PythonFunction.html#pythonfunction)**

But there are other parallelization options for Python models using the otwrapy or othpc external modules:

- [Welcome to otwrapy’s documentation! — otwrapy documentation](http://openturns.github.io/otwrapy/master/) for local or ssh parallelization
- [othpc documentation — othpc 0.1 documentation](http://openturns.github.io/othpc/main/) for SLURM clusters

j

---

<div class="post-metadata">

**Author:** ![XavierFaure](https://avatars.discourse-cdn.com/v4/letter/x/f6c823/32.png) [@XavierFaure](https://openturns.discourse.group/u/XavierFaure)\
**Post date:** [May 10, 2026, 5:00pm UTC](https://openturns.discourse.group/t/question-about-parallel-computation-in-openturns-pareto-frontier-optimization/427/3 "2026-05-10T17:00:46Z")

</div>

Hi, I’m coming back on this topic but with a slightly different issue. I found a way to parallelize my function, but now I’d like to save the process and start it again later. I need to save the current state of the optimization but setting the max number of iteration simply to 1 doesn’t exit the \*.run() function and it seems that the optimization is going on endless. I can see some convergence while looking at the saved output files of each run, so things are going pretty well inside, but if I kill the process, I also loose the entire convergence knowledge so I cannot stop and resume a studied case… Any idea on how I could handle this ? (chatGPT or other tools seems also useless as \*.setMaximumIterationNumber doesn’t seem to do the expected job…)

thanks in advance for any help.

---

<div class="post-metadata">

**Author:** ![schueller](https://yyz2.discourse-cdn.com/free1/user_avatar/openturns.discourse.group/schueller/32/3_2.png) [@schueller](https://openturns.discourse.group/u/schueller)\
**Post date:** [May 11, 2026, 7:56am UTC](https://openturns.discourse.group/t/question-about-parallel-computation-in-openturns-pareto-frontier-optimization/427/4 "2026-05-11T07:56:00Z")

</div>

here is an example how you can save the optimization evaluations at each iterations into csv files  
if you stop the script during the optimization and rerun it, it will restart from the last completed block

```auto
import openturns as ot
from pathlib import Path
import time
import math

def zdt1(X):
    x1, x2 = X
    g = 1.0 + 9.0 * (x1 + x2)
    y = g * (1.0 - math.sqrt(x1 / g))
    time.sleep(0.1)
    print("--", [x1, x2], y)
    return [x1, y]
f = ot.PythonFunction(2, 2, zdt1)
memoize = ot.MemoizeFunction(f)

if Path("input.csv").exists():
    X = ot.Sample.ImportFromCSVFile("input.csv")
    Y = ot.Sample.ImportFromCSVFile("output.csv")
    memoize.addCacheContent(X, Y)

def progress(prog):
    X = memoize.getCacheInput()
    Y = memoize.getCacheOutput()
    X.exportToCSVFile("input.csv")
    Y.exportToCSVFile("output.csv")

problem = ot.OptimizationProblem(memoize)
problem.setBounds(ot.Interval([0.0] * 2, [1.0] * 2))
pop0 = ot.JointDistribution([ot.Uniform(0.0, 1.0)] * 2).getSample(50)
algo = ot.Pagmo(problem, "nsga2", pop0)
algo.setBlockSize(8)
algo.setProgressCallback(progress)
algo.setMaximumIterationNumber(10)
algo.run()

pop1 = algo.getResult().getFinalPoints()
fronts = algo.getResult().getParetoFrontsIndices()

```

---

<div class="post-metadata">

**Author:** ![XavierFaure](https://avatars.discourse-cdn.com/v4/letter/x/f6c823/32.png) [@XavierFaure](https://openturns.discourse.group/u/XavierFaure)\
**Post date:** [May 11, 2026, 4:40pm UTC](https://openturns.discourse.group/t/question-about-parallel-computation-in-openturns-pareto-frontier-optimization/427/5 "2026-05-11T16:40:01Z")

</div>

I’m surprised about how the output file is appended as it does not seems to correspond to step by step runs (to visualized the convergence process). Am I missing something ?

---

<div class="post-metadata">

**Author:** ![XavierFaure](https://avatars.discourse-cdn.com/v4/letter/x/f6c823/32.png) [@XavierFaure](https://openturns.discourse.group/u/XavierFaure)\
**Post date:** [May 12, 2026, 9:57am UTC](https://openturns.discourse.group/t/question-about-parallel-computation-in-openturns-pareto-frontier-optimization/427/6 "2026-05-12T09:57:58Z")

</div>

I’ve got my answer, the order is sorted regarding the cost function. I’ve add some extra files to store and check the iterations. We can close this subject I guess

---

<div class="post-metadata">

**Author:** ![schueller](https://yyz2.discourse-cdn.com/free1/user_avatar/openturns.discourse.group/schueller/32/3_2.png) [@schueller](https://openturns.discourse.group/u/schueller)\
**Post date:** [July 6, 2026, 8:35am UTC](https://openturns.discourse.group/t/question-about-parallel-computation-in-openturns-pareto-frontier-optimization/427/7 "2026-07-06T08:35:38Z")

</div>

yes, this reflects the cache internal state which reorder points
