ipython / ipython/ipyparallel

ipyparallel and pymoo doesn't work

未關閉
#848 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
bug
主要語言
Jupyter Notebook
星號
2.6k
分支
1k
PR 合併指標
30 天內沒有已合併 PR

描述

Hello all,
I am trying to use ipyparallel with a module for Genetic Algorithm (pymoo) and for that, I need to pass the class name 'MyProblem' to the clusters (don't know really why clusters are not aware but I have also the same problem with function defined in the main program). When I pass the name using 'dview["MyProblem"] = MyProblem' I am facing a recursing error.

This is the simplified code below which reproduce the error. Do you have any idea ?

```python
import numpy as np
import ipyparallel as ipp
from pymoo.algorithms.moo.nsga2 import NSGA2
from pymoo.core.problem import ElementwiseProblem
from pymoo.optimize import minimize

# Very simplified problem
class MyProblem(ElementwiseProblem):

def __init__(self):
super().__init__(n_var = 1,
n_obj = 1,
n_constr = 0,
xl=np.array([0]),
xu=np.array([1]))

def _evaluate(self, x, out, *args, **kwargs):

# Fitness functions (values to minimize)
f1 = -x[0]
out["F"] = [f1]

# Start the clusters
nb_core = 16
rc = ipp.Cluster(n=nb_core).start_and_connect_sync()
rc.wait_for_engines(n=nb_core)
dview = rc[:]

# Send class def to all cluster for further use
dview["MyProblem"] = MyProblem
```

Thanks in advance for your help.
Patrick.

貢獻指南

開啟貢獻指南

研究方向

Start with the simplified reproducer using ipyparallel.Cluster, the connected DirectView, and the MyProblem class inherited from pymoo's ElementwiseProblem. Run it with the stated dependencies and inspect the failure during dview["MyProblem"] = MyProblem; done means identifying the recursion cause and documenting or correcting the supported way to transfer this class.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
distributed-systems
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
25/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。