aims-umich / aims-umich/neorl

Use of pathos for multiprocessing within python -- unknown error

オープン
#41 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
71
フォーク
18
PR マージ指標
30日以内にマージされた PR はありません

説明

joblib does not conserve the global variables during multi-processing. In my environment, I utilized some. As a workaround, I used pathos, which seemed to not have any issue. See for instance within ES:
core_list=[]
for key in pop:
core_list.append(pop[key][0])

#with joblib.Parallel(n_jobs=self.ncores) as parallel:
# fitness=parallel(joblib.delayed(self.fit_worker)(item) for item in core_list)
try:
with joblib.Parallel(n_jobs=self.ncores) as parallel:#, prefer="threads" , require='sharedmem'
fitness=parallel(joblib.delayed(self.fit_worker)(item) for item in core_list)
except:
p=pathos.multiprocessing.Pool(processes = self.ncores)
fitness = p.map(self.fit_worker, core_list)
p.close()
p.join()

However, after some number of samples generated (it could be 10,000 as it could be 30,000), the optimization stops running without throwing errors. It happened with ES, SA, TS and multi-objective variants I implemented.

My workaround right now is to re-initialize all global variables before each candidate evaluation, but it eats some computing time.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。