Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
FluidDoc
提交
56ffdc8d
F
FluidDoc
项目概览
PaddlePaddle
/
FluidDoc
通知
7
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
23
列表
看板
标记
里程碑
合并请求
111
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
FluidDoc
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
23
Issue
23
列表
看板
标记
里程碑
合并请求
111
合并请求
111
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
56ffdc8d
编写于
12月 07, 2018
作者:
T
Tink_Y
提交者:
GitHub
12月 07, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #456 from tink2123/new_commit_1207
fix some typo in api_cn
上级
b06883f0
6e6fc9c9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
256 deletion
+12
-256
doc/fluid/api_cn/index_cn.rst
doc/fluid/api_cn/index_cn.rst
+1
-1
doc/fluid/api_cn/profiler_cn.rst
doc/fluid/api_cn/profiler_cn.rst
+11
-11
doc/fluid/api_cn/transpliter_cn.rst
doc/fluid/api_cn/transpliter_cn.rst
+0
-244
未找到文件。
doc/fluid/api_cn/index_cn.rst
浏览文件 @
56ffdc8d
...
...
@@ -22,4 +22,4 @@ API Reference
param_attr_cn.rst
profiler_cn.rst
regularizer_cn.rst
transp
lit
er_cn.rst
transp
il
er_cn.rst
doc/fluid/api_cn/profiler_cn.rst
浏览文件 @
56ffdc8d
...
...
@@ -18,10 +18,10 @@ CUDA分析器。通过CUDA运行时应用程序编程接口对CUDA程序进行
参数:
- **output_file** (string) – 输出文件名称, 输出结果将会写入该文件
- **output_mode** (string) – 输出格式是有 key-value 键值对 和 逗号的分割的格式。格式应该是' kvp '或' csv '
- **config** (list of string) – 参考
“Compute Command Line Profiler User Guide”
查阅 profiler options 和 counter相关信息
- **config** (list of string) – 参考
"Compute Command Line Profiler User Guide"
查阅 profiler options 和 counter相关信息
抛出异常:
- ``ValueError`` - 如果 ``output_mode`` 不在 [
‘kvp’, ‘csv’
] 中
- ``ValueError`` - 如果 ``output_mode`` 不在 [
'kvp', 'csv'
] 中
**代码示例**
...
...
@@ -70,12 +70,12 @@ profile interface 。与cuda_profiler不同,此profiler可用于分析CPU和GP
如果 state== ' All ',在profile_path 中写入文件 profile proto 。该文件记录执行期间的时间顺序信息。然后用户可以看到这个文件的时间轴,请参考 `https://github.com/PaddlePaddle/Paddle/blob/develop/doc/fluid/howto/optimization/timeline.md <https://github.com/PaddlePaddle/Paddle/blob/develop/doc/fluid/howto/optimization/timeline.md>`_
参数:
- **state** (string) – profiling state, 取值为
‘CPU’ 或 ‘GPU’
, profiler 使用 CPU timer 或GPU timer 进行 profiling. 虽然用户可能在开始时指定了执行位置(CPUPlace/CUDAPlace),但是为了灵活性,profiler不会使用这个位置。
- **sorted_key** (string) – 如果为None,prfile的结果将按照事件的第一次结束时间顺序打印。否则,结果将按标志排序。标志取值为
“call”、“total”、“max”、“min” “ave”
之一,根据调用着的数量进行排序。total表示按总执行时间排序,max 表示按最大执行时间排序。min 表示按最小执行时间排序。ave表示按平均执行时间排序。
- **profile_path** (string) – 如果 state ==
‘All’
, 结果将写入文件 profile proto.
- **state** (string) – profiling state, 取值为
'CPU' 或 'GPU'
, profiler 使用 CPU timer 或GPU timer 进行 profiling. 虽然用户可能在开始时指定了执行位置(CPUPlace/CUDAPlace),但是为了灵活性,profiler不会使用这个位置。
- **sorted_key** (string) – 如果为None,prfile的结果将按照事件的第一次结束时间顺序打印。否则,结果将按标志排序。标志取值为
"call"、"total"、"max"、"min" "ave"
之一,根据调用着的数量进行排序。total表示按总执行时间排序,max 表示按最大执行时间排序。min 表示按最小执行时间排序。ave表示按平均执行时间排序。
- **profile_path** (string) – 如果 state ==
'All'
, 结果将写入文件 profile proto.
抛出异常:
- ``ValueError`` – 如果state 取值不在 [
‘CPU’, ‘GPU’, ‘All’]中. 如果 sorted_key 取值不在 [‘calls’, ‘total’, ‘max’, ‘min’, ‘ave’
]
- ``ValueError`` – 如果state 取值不在 [
'CPU', 'GPU', 'All']中. 如果 sorted_key 取值不在 ['calls', 'total', 'max', 'min', 'ave'
]
**代码示例**
...
...
@@ -139,10 +139,10 @@ start_profiler
如果 state== ' All ',在profile_path 中写入文件 profile proto 。该文件记录执行期间的时间顺序信息。然后用户可以看到这个文件的时间轴,请参考 `https://github.com/PaddlePaddle/Paddle/blob/develop/doc/fluid/howto/optimization/timeline.md <https://github.com/PaddlePaddle/Paddle/blob/develop/doc/fluid/howto/optimization/timeline.md>`_
参数:
- **state** (string) – profiling state, 取值为
‘CPU’ 或 ‘GPU’ 或 ‘All’, ‘CPU’ 代表只分析 cpu. ‘GPU’ 代表只分析 GPU . ‘All’
会产生 timeline.
- **state** (string) – profiling state, 取值为
'CPU' 或 'GPU' 或 'All', 'CPU' 代表只分析 cpu. 'GPU' 代表只分析 GPU . 'All'
会产生 timeline.
抛出异常:
- ``ValueError`` – 如果state 取值不在 [
‘CPU’, ‘GPU’, ‘All’
]中
- ``ValueError`` – 如果state 取值不在 [
'CPU', 'GPU', 'All'
]中
**代码示例**
...
...
@@ -177,12 +177,12 @@ stop_profiler
不能使用 fluid.profiler.profiler``
参数:
- **sorted_key** (string) – 如果为None,prfile的结果将按照事件的第一次结束时间顺序打印。否则,结果将按标志排序。标志取值为
“call”、“total”、“max”、“min” “ave”
之一,根据调用着的数量进行排序。total表示按总执行时间排序,max 表示按最大执行时间排序。min 表示按最小执行时间排序。ave表示按平均执行时间排序。
- **profile_path** (string) - 如果 state ==
‘All’
, 结果将写入文件 profile proto.
- **sorted_key** (string) – 如果为None,prfile的结果将按照事件的第一次结束时间顺序打印。否则,结果将按标志排序。标志取值为
"call"、"total"、"max"、"min" "ave"
之一,根据调用着的数量进行排序。total表示按总执行时间排序,max 表示按最大执行时间排序。min 表示按最小执行时间排序。ave表示按平均执行时间排序。
- **profile_path** (string) - 如果 state ==
'All'
, 结果将写入文件 profile proto.
抛出异常:
- ``ValueError`` – 如果state 取值不在 [
‘CPU’, ‘GPU’, ‘All’
]中
- ``ValueError`` – 如果state 取值不在 [
'CPU', 'GPU', 'All'
]中
**代码示例**
...
...
doc/fluid/api_cn/transpliter_cn.rst
已删除
100644 → 0
浏览文件 @
b06883f0
#################
fluid.transpiler
#################
.. _cn_api_fluid_DistributeTranspiler:
DistributeTranspiler
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.. py:class:: paddle.fluid.transpiler.DistributeTranspiler (config=None)
该类可以把fluid program转变为分布式数据并行计算程序(distributed data-parallelism programs),可以有Pserver和NCCL2两种模式。
当program在Pserver(全称:parameter server)模式下, ``main_program`` (主程序)转为使用一架远程parameter server(即pserver,参数服务器)来进行参数优化,并且优化图会被输入到一个pserver program中。
在NCCL2模式下,transpiler会在 ``startup_program`` 中附加一个 ``NCCL_ID`` 广播算子(broadcasting operators)来实现在该集群中所有工作结点共享``NCCL_ID`` 。
调用 ``transpile_nccl2`` 后, 你 **必须** 将 ``trainer_id`` , ``num_trainers`` 参数提供给 ``ParallelExecutor`` 来启动NCCL2分布式模式。
**代码示例**
.. code-block:: python
# for pserver mode
pserver_endpoints = "192.168.0.1:6174,192.168.0.2:6174"
trainer_endpoints = "192.168.0.1:6174,192.168.0.2:6174"
current_endpoint = "192.168.0.1:6174"
trainer_id = 0
trainers = 4
role = os.getenv("PADDLE_TRAINING_ROLE")
t = fluid.DistributeTranspiler()
t.transpile(
trainer_id, pservers=pserver_endpoints, trainers=trainers)
if role == "PSERVER":
pserver_program = t.get_pserver_program(current_endpoint)
pserver_startup_program = t.get_startup_program(current_endpoint,
pserver_program)
elif role == "TRAINER":
trainer_program = t.get_trainer_program()
# for nccl2 mode
config = fluid.DistributeTranspilerConfig()
config.mode = "nccl2"
t = fluid.DistributeTranspiler(config=config)
t.transpile(trainer_id, workers=workers, current_endpoint=curr_ep)
exe = fluid.ParallelExecutor(
use_cuda,
loss_name=loss_var.name,
num_trainers=len(trainers.split(",)),
trainer_id=trainer_id
)
.. py:method:: transpile(trainer_id, program=None, pservers='127.0.0.1:6174', trainers=1, sync_mode=True, startup_program=None, current_endpoint='127.0.0.1:6174')
该方法可以运行该transpiler(转译器)。
参数:
- **trainer_id** (int) – 当前Trainer worker的id, 如果有n个Trainer worker, id 取值范围为0 ~ n-1
- **program** (Program|None) – 待transpile(转译)的program, 缺省为 ``fluid.default_main_program()``
- **pservers** (str) – 内容为Pserver列表的字符串,格式为:按逗号区分不同的Pserver,每个Pserver的格式为 *ip地址:端口号*
- **trainers** (int|str) – 在Pserver模式下,该参数指Trainer机的个数;在nccl2模式下,它是一个内容为Trainer终端列表的字符串
- **sync_mode** (bool) – 是否做同步训练(synchronous training), 默认为True
- **startup_program** (Program|None) – 待transpile(转译)的startup_program,默认为 ``fluid.default_main_program()``
- **current_endpoint** (str) – 当需要把program转译(transpile)至NCCL2模式下时,需要将当前endpoint(终端)传入该参数。Pserver模式不使用该参数
.. py:method:: get_trainer_program(wait_port=True)
该方法可以得到Trainer侧的program。
返回: Trainer侧的program
返回类型: Program
.. py:method:: get_pserver_program(endpoint)
该方法可以得到Pserver(参数服务器)侧的程序
参数:
- **endpoint** (str) – 当前Pserver终端
返回: 当前Pserver需要执行的program
返回类型: Program
.. py:method:: get_pserver_programs(endpoint)
该方法可以得到Pserver侧用于分布式训练的 ``main_program`` 和 ``startup_program`` 。
参数:
- **endpoint** (str) – 当前Pserver终端
返回: (main_program, startup_program), “Program”类型的元组
返回类型: tuple
.. py:method:: get_startup_program(endpoint, pserver_program=None, startup_program=None)
**该函数已停止使用**
获取当前Pserver的startup_program,如果有多个被分散到不同blocks的变量,则修改operator的输入变量。
参数:
- **endpoint** (str) – 当前Pserver终端
- **pserver_program** (Program) – 已停止使用。 先调用get_pserver_program
- **startup_program** (Program) – 已停止使用。应在初始化时传入startup_program
返回: Pserver侧的startup_program
返回类型: Program
英文版API文档: :ref:`api_fluid_DistributeTranspiler`
.. _cn_api_fluid_transpiler_DistributeTranspilerConfig:
DistributeTranspilerConfig
>>>>>>>>>>>>
.. py:class:: paddle.fluid.transpiler.DistributeTranspilerConfig
.. py:method:: slice_var_up (bool)
为Pserver将张量切片, 默认为True
.. py:method:: split_method (PSDispatcher)
可使用 RoundRobin 或者 HashName
注意: 尝试选择最佳方法来达到负载均衡。
.. py:attribute:: min_block_size (int)
最小数据块的大小
注意: 根据:https://github.com/PaddlePaddle/Paddle/issues/8638#issuecomment-369912156, 当数据块大小超过2MB时,我们可以有效地使用带宽。如果你想更改它,请详细查看slice_variable函数。
英文版API文档: :ref:`api_fluid_transpiler_DistributeTranspilerConfig`
.. _cn_api_fluid_transpiler_HashName:
HashName
>>>>>>>>>>>>
.. py:class:: paddle.fluid.transpiler.HashName(pserver_endpoints)
使用 python ``Hash()`` 函数将变量名散列到多个pserver终端。
参数:
- **pserver_endpoints** (list) - endpoint (ip:port)的 list
英文版API文档: :ref:`api_fluid_transpiler_HashName`
.. _cn_api_fluid_transpiler_memory_optimize:
memory_optimize
>>>>>>>>>>>>
.. py:function:: paddle.fluid.transpiler.memory_optimize(input_program, skip_opt_set=None, print_log=False, level=0, skip_grads=False)
通过重用var内存来优化内存。
注意:它不支持block中嵌套子block。
参数:
- **input_program** (str) – 输入Program。
- **skip_opt_set** (set) – set中的vars将不被内存优化。
- **print_log** (bool) – 是否打印debug日志。
- **level** (int) - 如果 level=0 并且shape是完全相等,则重用。
返回: None
英文版API文档: :ref:`api_fluid_transpiler_memory_optimize`
.. _cn_api_fluid_transpiler_release_memory:
release_memory
>>>>>>>>>>>>>>>>>>>>>>>>>>>
.. py:function:: paddle.fluid.transpiler.release_memory(input_program, skip_opt_set=None)
该函数可以调整输入program,插入 ``delete_op`` 删除算子,提前删除不需要的变量。
改动是在变量本身上进行的。
.. note::
该API还在试验阶段,会在后期版本中删除。不建议用户使用。
参数:
- **input_program** (Program) – 在此program中插入 ``delete_op``
- **skip_opt_set** (set) – 在内存优化时跳过的变量的集合
返回: None
英文版API文档: :ref:`api_fluid_transpiler_release_memory`
.. _cn_api_fluid_transpiler_RoundRobin:
RoundRobin
>>>>>>>>>>>>
.. py:class:: paddle.fluid.transpiler.RoundRobin(pserver_endpoints)
使用 ``RondRobin`` 方法将变量分配给服务器端点。
`RondRobin <https://en.wikipedia.org/wiki/Round-robin_scheduling>`_
参数:
- **pserver_endpoints** (list) - endpoint (ip:port)的 list
英文版API文档: :ref:`api_fluid_transpiler_RoundRobin`
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录