PYTORCH_NPU_ALLOC_CONF

功能描述

PyTorch训练或在线推理场景,可通过此环境变量控制缓存分配器行为。

可选参数:

参数配置格式PYTORCH_NPU_ALLOC_CONF=<option1>:<value1>,<option2>:<value2>。

max_split_size_mb和garbage_collection_threshold中任意一个为非默认值时,expandable_segments必须设置为False。

expandable_segments设置为True,即开启虚拟内存特性时,不能使用单进程多卡特性。

配置示例

示例一:

export PYTORCH_NPU_ALLOC_CONF=max_split_size_mb:32,garbage_collection_threshold:0.6

示例二:

export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True

是否必选

使用约束

expandable_segments特性需在Ascend HDK 23.0.0及以上版本上使用。

支持的型号

Atlas 训练系列产品

Atlas A2 训练系列产品