有没有办法在IPython笔记本中同时运行多个单元格? [英] Is there a way to run multiple cells simultaneously in IPython notebook?

查看:270
本文介绍了有没有办法在IPython笔记本中同时运行多个单元格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的笔记本中的一个单元格执行了很长时间,而机器中的另一个单元格处于空闲状态。是否有可能并行运行其他单元格?

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

Not magically, and probably not what you think but 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 as Dask as well.

这篇关于有没有办法在IPython笔记本中同时运行多个单元格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆