diff --git a/doc/paddle/api/paddle/distributed/fleet/PaddleCloudRoleMaker_cn.rst b/doc/paddle/api/paddle/distributed/fleet/PaddleCloudRoleMaker_cn.rst index ef860b04fab47b4c439b6ef2a18f0dab857f7a7c..809e1c2c303cb3e74a1a64cea871efe21273c727 100644 --- a/doc/paddle/api/paddle/distributed/fleet/PaddleCloudRoleMaker_cn.rst +++ b/doc/paddle/api/paddle/distributed/fleet/PaddleCloudRoleMaker_cn.rst @@ -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() diff --git a/doc/paddle/api/paddle/distributed/fleet/UserDefinedRoleMaker_cn.rst b/doc/paddle/api/paddle/distributed/fleet/UserDefinedRoleMaker_cn.rst index 3e02b1446897e93bfc2176662af869ed7bf024a5..05f61202c68e307a75fad15b36691e6331c71ac9 100644 --- a/doc/paddle/api/paddle/distributed/fleet/UserDefinedRoleMaker_cn.rst +++ b/doc/paddle/api/paddle/distributed/fleet/UserDefinedRoleMaker_cn.rst @@ -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() +