简体   繁体   English

多个节点的numpy并行化?

[英]Numpy parallelization for more than one node?

It is possible to use more cores for certain numpy operations like np.dot . 对于某些numpy操作,例如np.dot可以使用更多的内核。 Is it also possible to use more than one node? 是否还可以使用多个节点?

Numpy is not designed for easy splitting into multiple nodes. Numpy并非旨在轻松拆分为多个节点而设计。 You have to perform the split manually, ie split into subarrays processed by different nodes (if possible at all for your operation). 您必须手动执行拆分,即拆分为由不同节点处理的子数组(如果可能的话,完全针对您的操作)。

You may be using multiple cores, depending on the underlying library [1] . 您可能使用多个内核,具体取决于基础库[1]

Alternatively, you can look at Blaze and Dask modules for Numpy type of operations with multicore support. 另外,您可以查看BlazeDask模块以了解具有多核支持的Numpy类型的操作。

For splitting work on several process you have to implement Process (not Thread)! 为了拆分多个进程的工作,您必须实现Process (不是Thread)!

Example (extract from official doc): 示例(摘自官方文档):

from multiprocessing import Process

def f(name):
    print('hello', name)

if __name__ == '__main__':
    p = Process(target=f, args=('bob',))
    p.start()
    p.join()

See for detail the official documentation 有关详细信息,请参阅官方文档

Additionally, this topic may be of interest regarding the numpy optimized syntax related to your situation. 此外, 该主题可能是与您的情况相关的numpy优化语法所感兴趣的。

EDIT As stated on this link , you can use this to split over cores or nodes! 编辑如该链接所述 ,您可以使用它来拆分核心或节点!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM