From 19377f5fba537bdfba557153dc296699ef51b762 Mon Sep 17 00:00:00 2001 From: chenruibiao <chenruibiao@baidu.com> Date: Mon, 17 Jan 2022 16:06:33 +0800 Subject: [PATCH 1/2] Add CN docs for new GPU memory monitoring APIs --- .../device/cuda/max_memory_allocated_cn.rst | 30 +++++++++++++++++++ .../device/cuda/max_memory_reserved_cn.rst | 27 +++++++++++++++++ .../device/cuda/memory_allocated_cn.rst | 30 +++++++++++++++++++ .../paddle/device/cuda/memory_reserved_cn.rst | 27 +++++++++++++++++ 4 files changed, 114 insertions(+) create mode 100644 docs/api/paddle/device/cuda/max_memory_allocated_cn.rst create mode 100644 docs/api/paddle/device/cuda/max_memory_reserved_cn.rst create mode 100644 docs/api/paddle/device/cuda/memory_allocated_cn.rst create mode 100644 docs/api/paddle/device/cuda/memory_reserved_cn.rst diff --git a/docs/api/paddle/device/cuda/max_memory_allocated_cn.rst b/docs/api/paddle/device/cuda/max_memory_allocated_cn.rst new file mode 100644 index 00000000000..d696c51dda0 --- /dev/null +++ b/docs/api/paddle/device/cuda/max_memory_allocated_cn.rst @@ -0,0 +1,30 @@ +.. _cn_api_device_cuda_max_memory_allocated_cn: + + +max_memory_allocated +------------------------------- + +.. py:function:: paddle.device.cuda.max_memory_allocated(device=None) + +返回给定设备上分配给Tensor的显存峰值。 + +.. note:: +Paddle中分配给Tensor的显存块大小会进行256字节对齐,因此可能大于Tensor实际需要的显存大小。例如,一个shape为[1]的float32类型Tensor会占用256字节的显存,即使存储一个floatt32类型数据实际只需要4字节。 + +参数 +:::::::: + +**device** (paddle.CUDAPlace|int|str,可选) - 设备、设备ID或形如 ``gpu:x`` 的设备名称。如果 ``device`` 为None,则 ``device`` 为当前的设备。默认值为None。 + + +返回 +:::::::: + +一个整数,表示给定设备上分配给Tensor的显存峰值,以字节为单位。 + +代码示例 +:::::::: + +COPY-FROM: paddle.device.cuda.max_memory_allocated + + diff --git a/docs/api/paddle/device/cuda/max_memory_reserved_cn.rst b/docs/api/paddle/device/cuda/max_memory_reserved_cn.rst new file mode 100644 index 00000000000..1deed435a53 --- /dev/null +++ b/docs/api/paddle/device/cuda/max_memory_reserved_cn.rst @@ -0,0 +1,27 @@ +.. _cn_api_device_cuda_max_memory_reserved_cn: + + +max_memory_reserved +------------------------------- + +.. py:function:: paddle.device.cuda.max_memory_reserved(device=None) + +返回给定设备上由Allocator管理的显存峰值。 + +参数 +:::::::: + +**device** (paddle.CUDAPlace|int|str,可选) - 设备、设备ID或形如 ``gpu:x`` 的设备名称。如果 ``device`` 为None,则 ``device`` 为当前的设备。默认值为None。 + + +返回 +:::::::: + +一个整数,表示给定设备上当前由Allocator管理的显存峰值,以字节为单位。 + +代码示例 +:::::::: + +COPY-FROM: paddle.device.cuda.max_memory_reserved + + diff --git a/docs/api/paddle/device/cuda/memory_allocated_cn.rst b/docs/api/paddle/device/cuda/memory_allocated_cn.rst new file mode 100644 index 00000000000..de09db0b823 --- /dev/null +++ b/docs/api/paddle/device/cuda/memory_allocated_cn.rst @@ -0,0 +1,30 @@ +.. _cn_api_device_cuda_memory_allocated_cn: + + +memory_allocated +------------------------------- + +.. py:function:: paddle.device.cuda.memory_allocated(device=None) + +返回给定设备上当前分配给Tensor的显存大小。 + +.. note:: +Paddle中分配给Tensor的显存块大小会进行256字节对齐,因此可能大于Tensor实际需要的显存大小。例如,一个shape为[1]的float32类型Tensor会占用256字节的显存,即使存储一个floatt32类型数据实际只需要4字节。 + +参数 +:::::::: + +**device** (paddle.CUDAPlace|int|str,可选) - 设备、设备ID或形如 ``gpu:x`` 的设备名称。如果 ``device`` 为None,则 ``device`` 为当前的设备。默认值为None。 + + +返回 +:::::::: + +一个整数,表示给定设备上当前分配给Tensor的显存大小,以字节为单位。 + +代码示例 +:::::::: + +COPY-FROM: paddle.device.cuda.memory_allocated + + diff --git a/docs/api/paddle/device/cuda/memory_reserved_cn.rst b/docs/api/paddle/device/cuda/memory_reserved_cn.rst new file mode 100644 index 00000000000..4ce160c48f0 --- /dev/null +++ b/docs/api/paddle/device/cuda/memory_reserved_cn.rst @@ -0,0 +1,27 @@ +.. _cn_api_device_cuda_memory_reserved_cn: + + +memory_reserved +------------------------------- + +.. py:function:: paddle.device.cuda.memory_reserved(device=None) + +返回给定设备上当前由Allocator管理的显存大小。 + +参数 +:::::::: + +**device** (paddle.CUDAPlace|int|str,可选) - 设备、设备ID或形如 ``gpu:x`` 的设备名称。如果 ``device`` 为None,则 ``device`` 为当前的设备。默认值为None。 + + +返回 +:::::::: + +一个整数,表示给定设备上当前由Allocator管理的显存大小,以字节为单位。 + +代码示例 +:::::::: + +COPY-FROM: paddle.device.cuda.memory_reserved + + From 00cd52891f0dacc2f2c6946d085d983ae30b9b17 Mon Sep 17 00:00:00 2001 From: chenruibiao <chenruibiao@baidu.com> Date: Mon, 17 Jan 2022 19:46:38 +0800 Subject: [PATCH 2/2] Fix typo --- docs/api/paddle/device/cuda/max_memory_allocated_cn.rst | 2 +- docs/api/paddle/device/cuda/memory_allocated_cn.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/paddle/device/cuda/max_memory_allocated_cn.rst b/docs/api/paddle/device/cuda/max_memory_allocated_cn.rst index d696c51dda0..b89f66016db 100644 --- a/docs/api/paddle/device/cuda/max_memory_allocated_cn.rst +++ b/docs/api/paddle/device/cuda/max_memory_allocated_cn.rst @@ -9,7 +9,7 @@ max_memory_allocated 返回给定设备上分配给Tensor的显存峰值。 .. note:: -Paddle中分配给Tensor的显存块大小会进行256字节对齐,因此可能大于Tensor实际需要的显存大小。例如,一个shape为[1]的float32类型Tensor会占用256字节的显存,即使存储一个floatt32类型数据实际只需要4字节。 + Paddle中分配给Tensor的显存块大小会进行256字节对齐,因此可能大于Tensor实际需要的显存大小。例如,一个shape为[1]的float32类型Tensor会占用256字节的显存,即使存储一个floatt32类型数据实际只需要4字节。 参数 :::::::: diff --git a/docs/api/paddle/device/cuda/memory_allocated_cn.rst b/docs/api/paddle/device/cuda/memory_allocated_cn.rst index de09db0b823..f26d77bf2a0 100644 --- a/docs/api/paddle/device/cuda/memory_allocated_cn.rst +++ b/docs/api/paddle/device/cuda/memory_allocated_cn.rst @@ -9,7 +9,7 @@ memory_allocated 返回给定设备上当前分配给Tensor的显存大小。 .. note:: -Paddle中分配给Tensor的显存块大小会进行256字节对齐,因此可能大于Tensor实际需要的显存大小。例如,一个shape为[1]的float32类型Tensor会占用256字节的显存,即使存储一个floatt32类型数据实际只需要4字节。 + Paddle中分配给Tensor的显存块大小会进行256字节对齐,因此可能大于Tensor实际需要的显存大小。例如,一个shape为[1]的float32类型Tensor会占用256字节的显存,即使存储一个floatt32类型数据实际只需要4字节。 参数 ::::::::