我有一个相当复杂的python算法,我需要在HPC集群中分发。
代码是从一个60 gb内存的木星中心实例中运行的。PBS集群的配置是:一个进程,一个核心,每个工作人员30 of,nanny=False (计算不会在其他情况下运行),总共有26个工作人员(内存总量约为726 of )。
我不需要取回任何数据,因为所需的是在计算结束时直接写入磁盘。注意,当独立运行时,每次计算大约需要7分钟。
我遇到的问题是:每个独立工作者(Jobname :dask)似乎运行良好,大约有20 5Gb可用,其中最多使用5GB。但是,每当我尝试启动超过50个作业时,中心员工(Jobname : jupyterhub)在大约20分钟后就会耗尽内存。
下面是我如何分配计算:
def complex_python_func(params):
return compute(params=params).run()然后,我尝试使用client.map或延迟:
list_of_params = [1, 2, 3, 4, 5, ... n] # with n > 256
# With delayed
lazy = [dask.delayed(complex_python_func)(l) for l in list_of_params]
futures = client.compute(lazy)
# Or with map
chain = client.map(complex_python_func, list_of_params)以下是集群的配置:
cluster = PBSCluster(
cores=1,
memory="30GB",
interface="ib0",
queue=queue,
processes=1,
nanny=False,
walltime="12:00:00",
shebang="#!/bin/bash",
env_extra=env_extra,
python=python_bin,
)
cluster.scale(32)我不明白它为什么不起作用。我希望Dask运行每一次计算,然后释放内存(每6/7分钟用于每个单独的任务)。我用qstat -f jobId检查工作人员的内存使用情况,它一直在增加,直到工人被杀死为止。
是什么导致jupyterhub工作人员失败,实现这一目标的好方法(或至少是更好的)是什么?
发布于 2021-02-16 06:30:39
两个潜在的线索是:
如果不期望工作人员返回任何内容,则可能值得将语句更改为return None (尚不清楚compute()在脚本中做了什么):
def complex_python_func(params):
return compute(params=params).run()resources时可以执行的任务数,例如使用:# add resources when creating the cluster
cluster = PBSCluster(
# all other settings are unchanged, but add this line to give each worker
extra=['--resources foo=1'],
)
# rest of code skipped, but make sure to specify resources needed by task
# when submitting it for computation
lazy = [dask.delayed(complex_python_func)(l) for l in list_of_params]
futures = client.compute(lazy, resources={'foo': 1})
# Or with map
chain = client.map(complex_python_func, list_of_params, resources={'foo': 1})有关资源的更多信息,请参见文档或相关问题Specifying Task Resources: Fractional gpu。
https://stackoverflow.com/questions/66215069
复制相似问题