Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
bcc34724
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
bcc34724
编写于
10月 09, 2020
作者:
C
Chen Weihang
提交者:
GitHub
10月 09, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
polish api code & example (#27696)
上级
c826bcb2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
18 addition
and
10 deletion
+18
-10
python/paddle/fluid/framework.py
python/paddle/fluid/framework.py
+18
-10
未找到文件。
python/paddle/fluid/framework.py
浏览文件 @
bcc34724
...
@@ -380,31 +380,35 @@ def cuda_places(device_ids=None):
...
@@ -380,31 +380,35 @@ def cuda_places(device_ids=None):
For multi-card tasks, please use `FLAGS_selected_gpus` environment variable to set the visible GPU device.
For multi-card tasks, please use `FLAGS_selected_gpus` environment variable to set the visible GPU device.
The next version will fix the problem with `CUDA_VISIBLE_DEVICES` environment variable.
The next version will fix the problem with `CUDA_VISIBLE_DEVICES` environment variable.
This function creates a list of :code:`
fluid
.CUDAPlace` objects.
This function creates a list of :code:`
paddle
.CUDAPlace` objects.
If :code:`device_ids` is None, environment variable of
If :code:`device_ids` is None, environment variable of
:code:`FLAGS_selected_gpus` would be checked first. For example, if
:code:`FLAGS_selected_gpus` would be checked first. For example, if
:code:`FLAGS_selected_gpus=0,1,2`, the returned list would
:code:`FLAGS_selected_gpus=0,1,2`, the returned list would
be [
fluid.CUDAPlace(0), fluid.CUDAPlace(1), fluid
.CUDAPlace(2)].
be [
paddle.CUDAPlace(0), paddle.CUDAPlace(1), paddle
.CUDAPlace(2)].
If :code:`FLAGS_selected_gpus` is not set, all visible
If :code:`FLAGS_selected_gpus` is not set, all visible
gpu places would be returned according to the :code:`CUDA_VISIBLE_DEVICES` environment variable.
gpu places would be returned according to the :code:`CUDA_VISIBLE_DEVICES` environment variable.
If :code:`device_ids` is not None, it should be the device
If :code:`device_ids` is not None, it should be the device
ids of GPUs. For example, if :code:`device_ids=[0,1,2]`,
ids of GPUs. For example, if :code:`device_ids=[0,1,2]`,
the returned list would be
the returned list would be
[
fluid.CUDAPlace(0), fluid.CUDAPlace(1), fluid
.CUDAPlace(2)].
[
paddle.CUDAPlace(0), paddle.CUDAPlace(1), paddle
.CUDAPlace(2)].
Parameters:
Parameters:
device_ids (list or tuple of int, optional): list of GPU device ids.
device_ids (list or tuple of int, optional): list of GPU device ids.
Returns:
Returns:
list of
fluid
.CUDAPlace: Created GPU place list.
list of
paddle
.CUDAPlace: Created GPU place list.
Examples:
Examples:
.. code-block:: python
.. code-block:: python
import paddle.fluid as fluid
import paddle
cuda_places = fluid.cuda_places()
import paddle.static as static
paddle.enable_static()
cuda_places = static.cuda_places()
"""
"""
assert
core
.
is_compiled_with_cuda
(),
\
assert
core
.
is_compiled_with_cuda
(),
\
...
@@ -418,7 +422,7 @@ def cuda_places(device_ids=None):
...
@@ -418,7 +422,7 @@ def cuda_places(device_ids=None):
def
cpu_places
(
device_count
=
None
):
def
cpu_places
(
device_count
=
None
):
"""
"""
This function creates a list of :code:`
fluid
.CPUPlace` objects, and returns the created list.
This function creates a list of :code:`
paddle
.CPUPlace` objects, and returns the created list.
If :code:`device_count` is None, the device count would
If :code:`device_count` is None, the device count would
be determined by environment variable :code:`CPU_NUM`.
be determined by environment variable :code:`CPU_NUM`.
...
@@ -431,13 +435,17 @@ def cpu_places(device_count=None):
...
@@ -431,13 +435,17 @@ def cpu_places(device_count=None):
device_count (int, optional): device number. Default: None.
device_count (int, optional): device number. Default: None.
Returns:
Returns:
list of
fluid
.CPUPlace: Created list of CPU places.
list of
paddle
.CPUPlace: Created list of CPU places.
Examples:
Examples:
.. code-block:: python
.. code-block:: python
import paddle.fluid as fluid
import paddle
cpu_places = fluid.cpu_places()
import paddle.static as static
paddle.enable_static()
cpu_places = static.cpu_places()
"""
"""
if
device_count
is
None
:
if
device_count
is
None
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录