IPython 并行计算实用指南
1. IPython 并行计算基础
在某些情况下,执行操作可能不会返回任何结果,但每个引擎都有其自身的数组对象副本,我们可以对其进行操作。例如:
In [27]: %px numpy.linalg.eigvals(arrays)
Out[0:7]: array([ 1.49907907, 0.28987838, 0.49496096])
Out[1:7]: array([ 1.43756182, 0.27747814, 0.45153931])
Out[2:7]: array([ 1.51325036+0.j, -0.06614375+0.30396195j, -0.06614375-0.30396195j])
Out[3:7]: array([ 1.71117020+0.j, -0.13081468+0.42304986j, -0.13081468-0.42304986j])
魔法命令也可以远程运行。若要在多个引擎上启动 %pylab 魔法命令,可执行:
In [44]: %px %pylab inline
[stdout:0] Populating the interactive namespace from numpy and matplotlib
[stdout:1] Populating the interactive namespace from numpy and matplotlib
[stdout:2] Populating the
超级会员免费看
订阅专栏 解锁全文
2790

被折叠的 条评论
为什么被折叠?



