Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes multithreading problem from ipython kernel #287

Merged
merged 2 commits into from
May 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions HARK/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ def multiThreadCommands(agent_list,command_list,num_jobs=None):
multiThreadCommandsFake(agent_list,command_list)
return None

# Default umber of parallel jobs is the smaller of number of AgentTypes in
# Default number of parallel jobs is the smaller of number of AgentTypes in
# the input and the number of available cores.
if num_jobs is None:
num_jobs = min(len(agent_list),multiprocessing.cpu_count())

# Send each command in command_list to each of the types in agent_list to be run
agent_list_out = Parallel(n_jobs=num_jobs)(delayed(runCommands)(*args) for args in zip(agent_list, len(agent_list)*[command_list]))
agent_list_out = Parallel(backend='multiprocessing',n_jobs=num_jobs)(delayed(runCommands)(*args) for args in zip(agent_list, len(agent_list)*[command_list]))

# Replace the original types with the output from the parallel call
for j in range(len(agent_list)):
Expand Down