Skip to content

Commit 6afbdf4

Browse files
pull
2 parents 046d450 + 51a16a6 commit 6afbdf4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1140
-193
lines changed

_typos.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,12 @@ datas = "datas"
2828
processer = "processer"
2929

3030
# These words need to be fixed
31-
Creenshot = "Creenshot"
3231
Learing = "Learing"
3332
Moible = "Moible"
3433
Operaton = "Operaton"
3534
Optimizaing = "Optimizaing"
3635
Optimzier = "Optimzier"
3736
Setment = "Setment"
38-
Similarily = "Similarily"
3937
Simle = "Simle"
4038
Sovler = "Sovler"
4139
feeded = "feeded"
@@ -60,11 +58,9 @@ intput = "intput"
6058
lable = "lable"
6159
learing = "learing"
6260
legth = "legth"
63-
lengthes = "lengthes"
6461
lenth = "lenth"
6562
leran = "leran"
6663
libary = "libary"
67-
likey = "likey"
6864
mantained = "mantained"
6965
matrics = "matrics"
7066
mdule = "mdule"
@@ -87,7 +83,6 @@ outpus = "outpus"
8783
overrided = "overrided"
8884
overwrited = "overwrited"
8985
samle = "samle"
90-
satifies = "satifies"
9186
schedual = "schedual"
9287
secenarios = "secenarios"
9388
sematic = "sematic"

docs/api/paddle/Overview_cn.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,8 @@ device 相关
636636

637637
" :ref:`paddle.get_cuda_rng_state <cn_api_paddle_get_cuda_rng_state>` ", "获取 cuda 随机数生成器的状态信息"
638638
" :ref:`paddle.set_cuda_rng_state <cn_api_paddle_set_cuda_rng_state>` ", "设置 cuda 随机数生成器的状态信息"
639+
" :ref:`paddle.get_default_device <cn_api_paddle_get_default_device>` ", "获取当前默认设备信息"
640+
" :ref:`paddle.get_device_module <cn_api_paddle_get_device_module>` ", "获取指定设备对应的模块"
639641

640642
.. _about_hapi:
641643

docs/api/paddle/cuda/Overview_cn.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,15 @@ PyTorch 兼容函数
1616

1717
" :ref:`check_error <cn_api_paddle_cuda_check_error>` ", "检测 CUDA 错误码"
1818
" :ref:`cudart <cn_api_paddle_cuda_cudart>` ", "以模块的形式返回 CUDA Runtime 对象"
19+
" :ref:`current_stream <cn_api_paddle_cuda_current_stream>` ", "获取当前 CUDA 流"
20+
" :ref:`get_device_properties <cn_api_paddle_cuda_get_device_properties>` ", "获取 CUDA 设备属性"
21+
" :ref:`get_rng_state <cn_api_paddle_cuda_get_rng_state>` ", "获取随机数生成器状态"
22+
" :ref:`is_available <cn_api_paddle_cuda_is_available>` ", "检查 CUDA 是否可用"
1923
" :ref:`is_initialized <cn_api_paddle_cuda_is_initialized>` ", "判断 CUDA 是否已经初始化"
24+
" :ref:`manual_seed_all <cn_api_paddle_cuda_manual_seed_all>` ", "设置全局随机种子"
2025
" :ref:`mem_get_info <cn_api_paddle_cuda_mem_get_info>` ", "获取指定设备上的全局空闲显存和显存总量"
26+
" :ref:`set_rng_state <cn_api_paddle_cuda_set_rng_state>` ", "设置随机数生成器状态"
27+
" :ref:`synchronize <cn_api_paddle_cuda_synchronize>` ", "同步 CUDA 设备"
2128
" :ref:`current_device <cn_api_paddle_cuda_current_device>` ", "返回当前设备的索引"
2229
" :ref:`device_count <cn_api_paddle_cuda_device_count>` ", "返回可用的 CUDA 设备数量"
2330
" :ref:`empty_cache <cn_api_paddle_cuda_empty_cache>` ", "释放当前设备上所有未占用的缓存内存"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.. _cn_api_paddle_cuda_current_stream:
2+
3+
current_stream
4+
-------------------------------
5+
6+
.. py:function:: paddle.cuda.current_stream(device=None)
7+
8+
该功能用于获取指定 CUDA 设备上当前正在使用的计算流(Stream)。
9+
10+
参数
11+
:::::::::
12+
- **device** (int | str | CUDAPlace | CustomPlace | None,可选) – 指定需要查询的设备。
13+
- None:获取当前设备上的默认计算流。
14+
- int:设备索引,例如 0 表示 cuda:0。
15+
- str:设备字符串,例如 'cuda:0' 或 'gpu:1'。
16+
- CUDAPlace:Paddle 的 CUDAPlace 对象。
17+
- CustomPlace:Paddle 的自定义设备 Place 对象。
18+
19+
返回
20+
:::::::::
21+
core.CUDAStream,当前设备对应的 CUDA 计算流对象。
22+
23+
代码示例
24+
:::::::::
25+
COPY-FROM: paddle.cuda.current_stream
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.. _cn_api_paddle_cuda_get_device_properties:
2+
3+
get_device_properties
4+
-------------------------------
5+
6+
.. py:function:: paddle.cuda.get_device_properties(device=None)
7+
8+
获取 CUDA 设备的属性信息。
9+
10+
参数
11+
:::::::::
12+
- **device** (int | str | paddle.CUDAPlace | paddle.CustomPlace | None, 可选) - 要查询的目标设备:
13+
14+
- None: 使用当前设备
15+
- int: 设备索引 (例如: 0 -> 'gpu:0')
16+
- str: 设备字符串 (例如: "cuda:0", "gpu:1")
17+
- CUDAPlace 或 CustomPlace: Paddle 设备对象
18+
19+
返回
20+
:::::::::
21+
DeviceProperties: 包含设备属性的对象,如名称、总内存、计算能力和多处理器数量等。
22+
23+
代码示例
24+
::::::::::::
25+
COPY-FROM: paddle.cuda.get_device_properties
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.. _cn_api_paddle_cuda_get_rng_state:
2+
3+
get_rng_state
4+
-------------------------------
5+
6+
.. py:function:: paddle.cuda.get_rng_state(device=None)
7+
8+
返回指定设备的随机数生成器状态,以 GeneratorState 形式表示。
9+
10+
参数
11+
:::::::::
12+
- **device** (DeviceLike, 可选) - 要获取 RNG 状态的设备:
13+
14+
- 如果不指定,则使用当前默认设备(由 paddle.framework._current_expected_place_()返回)
15+
- 可以是设备对象、整数设备 ID 或设备字符串
16+
17+
返回
18+
:::::::::
19+
core.GeneratorState: 指定设备的当前 RNG 状态,以 GeneratorState 形式表示。
20+
21+
代码示例
22+
::::::::::::
23+
COPY-FROM: paddle.cuda.get_rng_state
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.. _cn_api_paddle_cuda_is_available:
2+
3+
is_available
4+
-------------------------------
5+
6+
.. py:function:: paddle.cuda.is_available()
7+
8+
检查当前环境中是否有任何支持的设备可用。
9+
10+
该函数检查 Paddle 是否编译了至少一种加速器支持(如 CUDA、XPU、CustomDevice 等),
11+
以及当前系统是否有至少一个该类型的设备可用。
12+
13+
如果有任何支持的设备可用,则返回 True,否则返回 False。
14+
15+
返回
16+
:::::::::
17+
bool: 如果有至少一个可用设备(GPU/XPU/CustomDevice)则返回 True,否则返回 False。
18+
19+
20+
代码示例
21+
::::::::::::
22+
COPY-FROM: paddle.cuda.is_available
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.. _cn_api_paddle_cuda_manual_seed_all:
2+
3+
manual_seed_all
4+
-------------------------------
5+
6+
.. py:function:: paddle.cuda.manual_seed_all(seed)
7+
8+
设置全局默认随机数生成器的种子值,用于管理随机数生成。
9+
10+
参数
11+
:::::::::
12+
- **seed** (int) - 要设置的随机种子值
13+
14+
返回
15+
:::::::::
16+
None
17+
18+
代码示例
19+
::::::::::::
20+
COPY-FROM: paddle.cuda.manual_seed_all
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.. _cn_api_paddle_cuda_set_rng_state:
2+
3+
set_rng_state
4+
-------------------------------
5+
6+
.. py:function:: paddle.cuda.set_rng_state(new_state, device=None)
7+
8+
设置指定设备的随机数生成器状态。
9+
10+
参数
11+
:::::::::
12+
- **new_state** (core.GeneratorState) - 要设置的 RNG 状态对象,通常从 ``get_rng_state()`` 获取
13+
- **device** (DeviceLike, 可选) - 要设置 RNG 状态的设备:
14+
15+
- 如果不指定,则使用当前默认设备(由 ``paddle.framework._current_expected_place_()`` 返回)
16+
- 可以是设备对象、整数设备 ID 或设备字符串
17+
18+
返回
19+
:::::::::
20+
None
21+
22+
代码示例
23+
:::::::::
24+
COPY-FROM: paddle.cuda.set_rng_state
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.. _cn_api_paddle_cuda_synchronize:
2+
3+
synchronize
4+
5+
.. py:function:: paddle.cuda.synchronize(device=None)
6+
7+
该功能用于同步指定 CUDA 设备上的计算流,确保所有在该设备上提交的计算任务执行完成。
8+
9+
参数
10+
:::::::::
11+
- **device** (int | str | CUDAPlace | CustomPlace | None, optional) – 指定需要同步的设备。
12+
- None:同步当前设备上的计算流。
13+
- int:设备索引,例如 0 表示 cuda:0。
14+
- str:设备字符串,例如 'cuda:0' 或 'gpu:0'。
15+
- CUDAPlace:Paddle 的 CUDAPlace 对象。
16+
- CustomPlace:Paddle 的自定义设备 Place 对象。
17+
18+
返回
19+
:::::::::
20+
无。
21+
22+
代码示例
23+
:::::::::
24+
COPY-FROM: paddle.cuda.synchronize

0 commit comments

Comments
 (0)