cvx.simulator.backtest_many with parallel=True get stuck on Linux #182
Unanswered
andersontigerzhang
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I run cvxportfolio (1.3.0), SinglePeriodOptimization on Linux with a few policies. It runs OK when the policy is simple policies such as AdaptiveRebalance, but it gets stuck when I change to SinglePeriodOptimization. I googled the answer, it looks like it is the behavior on multiprocessing.Pool.starmap on simulator.py, line 707. If I changed the code from:
with Pool(initializer=_mp_init, initargs=(Lock(),)) as p:
to
with get_context('spawn').Pool(initializer=_mp_init, initargs=(Lock(),)) as p:
then it all worked.
I could not find a solution without changing the library code. I tried to put multiprocess.set_start_method('spawn') as the first statement right after:
if name == 'main':
as suggested by google search, the process still stuck. Anyone have any idea how to solve this problem? I understand it is not quite a cvxportfolio issue.
Beta Was this translation helpful? Give feedback.
All reactions