有没有办法在 IPython notebook 中同时运行多个单元? [英] Is there a way to run multiple cells simultaneously in IPython notebook?
问题描述
我笔记本中的一个单元执行了很长时间,而机器中的其他 CPU 处于空闲状态.是否可以并行运行其他单元?
One cell in my notebook executes for a long time, while the other CPU's in the machine are idle. Is it possible to run other cells in parallel?
推荐答案
是的.这里是 ipyparallel
(以前的IPython)的文档parallel
) 将向您展示如何生成多个 IPython 内核.在您可以自由地跨内核分配工作后,您可以使用 %%px0
%%px1
... %%px999
为单元格添加前缀(一旦设置)在特定引擎上执行单元,这实际上对应于单元的并行执行.我建议您也看看 Dask.
Yes. Here is the documentation for ipyparallel
(formerly IPython parallel
) that will show you how to spawn multiple IPython kernel. After you are free to distribute the work across cores, and you can prefix cells with %%px0
%%px1
... %%px999
(once set up) to execute a cell on a specific engine, which in practice correspond to parallel execution of cell. I woudl suggest having a look at Dask as well.
这篇关于有没有办法在 IPython notebook 中同时运行多个单元?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!