提交 eae95969 编写于 作者: S seiriosPlus

add roleMaker

上级 503d8f0f
......@@ -4,8 +4,42 @@ PaddleCloudRoleMaker
-------------------------------
.. py:class:: paddle.distributed.fleet.PaddleCloudRoleMaker
PaddleCloudRoleMaker是基于从环境变量中获取分布式相关信息进行分布式配置初始化的接口.
它会自动根据用户在环境变量中的配置进行分布式训练环境初始化,目前PaddleCloudRoleMaker支持ParameterServer分布式训练及Collective分布式训练两种模式的初始化。
**代码示例**
.. code-block:: python
import os
import paddle.distributed.fleet as fleet
os.environ["PADDLE_PSERVER_NUMS"] = "2"
os.environ["PADDLE_TRAINERS_NUM"] = "2"
os.environ["POD_IP"] = "127.0.0.1"
os.environ["PADDLE_PORT"] = "36001"
os.environ["TRAINING_ROLE"] = "PSERVER"
os.environ["PADDLE_PSERVERS_IP_PORT_LIST"] = \
"127.0.0.1:36001,127.0.0.2:36001"
os.environ["PADDLE_TRAINER_ID"] = "0"
fleet.PaddleCloudRoleMaker(is_collective=False)
.. py:method:: to_string()
将当前环境变量以字符串的形式输出
返回: string
**代码示例**:
.. code-block:: python
import paddle.distributed.fleet as fleet
role = fleet.PaddleCloudRoleMaker(is_collective=False)
role.to_string()
......@@ -6,6 +6,41 @@ UserDefinedRoleMaker
.. py:class:: paddle.distributed.fleet.UserDefinedRoleMaker
UserDefinedRoleMaker是基于从用户自定义的参数中获取分布式相关信息进行分布式配置初始化的接口
它会自动根据用户的自定义配置进行分布式训练环境初始化,目前UserDefinedRoleMaker支持ParameterServer分布式训练及Collective分布式训练两种模式的初始化。
**代码示例**
.. code-block:: python
import paddle.distributed.fleet as fleet
fleet.UserDefinedRoleMaker(
current_id=0,
role=role_maker.Role.SERVER,
worker_num=2,
server_endpoints=["127.0.0.1:36011", "127.0.0.1:36012"])
.. py:method:: to_string()
将当前环境变量以字符串的形式输出
返回: string
**代码示例**:
.. code-block:: python
import paddle.distributed.fleet as fleet
role = fleet.UserDefinedRoleMaker(
current_id=0,
role=role_maker.Role.SERVER,
worker_num=2,
server_endpoints=["127.0.0.1:36011", "127.0.0.1:36012"])
role.to_string()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册