集群上的IPY并行模块负载

2024-04-25 05:55:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我创建了一个48节点集群,由host0到{}(所有节点都是g2.2xlargeamazonec2实例,具有noNFS)。 根据https://ipyparallel.readthedocs.io/en/latest/process.html,我在host0上创建了一个控制器,host1到{}上创建了47个引擎。我已经从StarCluster项目复制了sshipyparallel集群的大部分配置(但是,正如我所说的,没有NFS)。 集群工作正常,似乎产生了正确的结果,但加载模块有时需要很长时间。 例如

import ipyparallel as ipp
client = ipp.Client('/path/to/ipcontroller-client.json',sshkey='mykey')
view = client[:]
view.block=True

with view.sync_imports():
    import time
    import numpy
    from keras.models import Sequential
    from keras.layers import Dense, Dropout
    from keras.regularizers import l1
    from keras.optimizers import SGD
    from subprocess import check_output

需要30多分钟才能完成。如果我更改为block=Falseview.wait(),则此选项不会更改。同时使用view.execute("import time; import numpy; import keras.models ...")也没有帮助。我知道加载keras模块有点慢,但在我的本地机器上,通常不到1分钟就完成了。我试过pickle和{}(un)包装。 我应该提到,当我使用相同的集群进行另一个计算时,模块的加载工作正常。我猜加载的模块在某个地方被缓存了。但是当我终止实例、创建新实例并配置新的ipyparallel集群时,我在模块加载方面遇到了相同的问题。在

查看ipcontroller日志,我可以发现大多数与sync_imports对应的请求

^{pr2}$

在几分钟内完成。然而,其中一些需要30分钟左右。请参见以下来自ipcontroller日志的complete_time - submit_time的柱状图。在

enter image description here

我最近才开始使用python,我不知道这里会出现什么问题。完成时间和提交时间之间的最大时间差似乎随着集群的大小而增加。 任何可能的问题都非常欢迎。在

顺便说一句:我使用的是python2.7.6和ipyparallel5.1.1


Tags: 模块实例fromimportclientview节点time
1条回答
网友
1楼 · 发布于 2024-04-25 05:55:35

我目前最好的猜测是,这个问题是由EBS卷的初始化引起的,它有时会有点慢。 集群实例总是从映像开始,并在计算完成后立即终止。从快照创建的EBS卷必须从S3获取数据。参见AWS EBS documentation

New EBS volumes receive their maximum performance the moment that they are available and do not require initialization (formerly known as pre-warming). However, storage blocks on volumes that were restored from snapshots must be initialized (pulled down from Amazon S3 and written to the volume) before you can access the block. This preliminary action takes time and can cause a significant increase in the latency of an I/O operation the first time each block is accessed. For most applications, amortizing this cost over the lifetime of the volume is acceptable. Performance is restored after the data is accessed once.

相关问题 更多 >