forked from mindspore-Ecosystem/mindspore
!44327 Add meory offload doc
Merge pull request !44327 from tanghuikang/code_docs_memory_offload
This commit is contained in:
commit
a030fc8e1a
|
@ -74,6 +74,8 @@ mindspore.set_context
|
|||
| | support_binary | CPU/GPU/Ascend |
|
||||
| +------------------------------+----------------------------+
|
||||
| | memory_optimize_level | CPU/GPU/Ascend |
|
||||
| +------------------------------+----------------------------+
|
||||
| | memory_offload | GPU/Ascend |
|
||||
+-------------------------+------------------------------+----------------------------+
|
||||
|
||||
参数:
|
||||
|
@ -146,6 +148,10 @@ mindspore.set_context
|
|||
|
||||
- O0: 执行性能优先,关闭 SOMAS (Safe Optimized Memory Allocation Solver)。
|
||||
- O1: 内存性能优先,使能 SOMAS。
|
||||
- **memory_offload** (str) - 是否开启Offload功能,在内存不足场景下将空闲数据临时拷贝至Host侧内存。其值必须在['ON', 'OFF']范围中,默认值为'OFF'。
|
||||
|
||||
- ON:开启memory offload功能。在Ascend硬件平台,未设置环境变量“GRAPH_OP_RUN=1”时本参数不生效;设置memory_optimize_level='O1'时本参数不生效。
|
||||
- OFF:关闭memory offload功能。
|
||||
|
||||
异常:
|
||||
- **ValueError** - 输入key不是上下文中的属性。
|
||||
|
|
|
@ -789,6 +789,8 @@ def set_context(**kwargs):
|
|||
| | support_binary | CPU/GPU/Ascend |
|
||||
| +------------------------------+----------------------------+
|
||||
| | memory_optimize_level | CPU/GPU/Ascend |
|
||||
| +------------------------------+----------------------------+
|
||||
| | memory_offload | GPU/Ascend |
|
||||
+-------------------------+------------------------------+----------------------------+
|
||||
|
||||
Args:
|
||||
|
@ -938,6 +940,14 @@ def set_context(**kwargs):
|
|||
|
||||
- O0: priority performance option, disable SOMAS (Safe Optimized Memory Allocation Solver).
|
||||
- O1: priority memory option, enable SOMAS.
|
||||
memory_offload (str): Whether to enable the memory offload function. When it is enabled, the idle data will be
|
||||
temporarily copied to the host side in the case of insufficient device memory. The value must be in the
|
||||
range of ['ON', 'OFF'], and the default value is 'OFF'.
|
||||
|
||||
- ON: Enable the memory Offload function. On Ascend hardware platform, this parameter does not take effect
|
||||
when the environment variable "GRAPH_OP_RUN=1" is not set; This parameter does not take effect when
|
||||
memory_optimize_level is set 'O1'.
|
||||
- OFF: Turn off the memory Offload function.
|
||||
|
||||
Raises:
|
||||
ValueError: If input key is not an attribute in context.
|
||||
|
@ -968,6 +978,7 @@ def set_context(**kwargs):
|
|||
>>> ms.set_context(inter_op_parallel_num=4)
|
||||
>>> ms.set_context(disable_format_transform=True)
|
||||
>>> ms.set_context(memory_optimize_level='O0')
|
||||
>>> ms.set_context(memory_offload='ON')
|
||||
"""
|
||||
ctx = _context()
|
||||
# set device target first
|
||||
|
|
Loading…
Reference in New Issue