python - 有没有办法限制 Ray 对象存储的最大内存使用量
问题描述
我正在尝试利用 Ray 的并行化模型来逐条处理文件记录。代码运行良好,但对象存储增长迅速并最终崩溃。我避免使用 ray.get(function.remote()) 因为它会降低性能,因为该任务由几百万个子任务和等待任务完成的开销组成。有没有办法为对象存储设置全局限制?
#code which constantly backpressusre the obejct storage, freeing space, but causes performance to be worse than serial execution
for record in infile:
ray.get(createNucleotideCount.remote(record, copy.copy(dinucDict), copy.copy(tetranucDict),dinucList,tetranucList, filename))
#code that maximizes throughput but makes the object storage grow constantly
for record in infile:
createNucleotideCount.remote(record, copy.copy(dinucDict), copy.copy(tetranucDict),dinucList,tetranucList, filename)
#the called function returns either 0 or 1.
解决方案
您可以ray.init(object_store_memory=10**9)
限制对象存储使用 1GB。
在https://ray.readthedocs.io/en/latest/memory-management.html的内存管理文档中有更多信息。
推荐阅读
- javafx - 每次创建新的 javafx 项目时如何避免添加 vm 参数?
- python - 使用 m 和 n 整数生成围栏矩阵
- parsing - 用Java从字符串中打印IP地址和子网掩码
- python - 在文本框中排列文本
- reactjs - React-Native 动画视图进出
- javascript - 为什么节点文档在描述这个函数时会在逗号之前列出这个左括号?
- python-3.x - 支持的目标类型是:('binary', 'multiclass')。改为“连续”
- bash - 在 bash 中,我可以将进度表及其格式保存到 cURL 请求的变量中吗?
- php - 邮递员:以数字形式查询正文值
- python - scipy 最小化在优化期间不探索所有样本空间