From 8539cc6a72aab1297abcd3bd7482612f81a88466 Mon Sep 17 00:00:00 2001 From: lichen Date: Tue, 27 Sep 2022 15:49:59 +0800 Subject: [PATCH] code_docs_fix_parallel_api --- docs/api/api_python/mindspore.communication.rst | 4 ++-- mindspore/python/mindspore/communication/management.py | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/api/api_python/mindspore.communication.rst b/docs/api/api_python/mindspore.communication.rst index 14d2f501867..da3562ea51e 100644 --- a/docs/api/api_python/mindspore.communication.rst +++ b/docs/api/api_python/mindspore.communication.rst @@ -18,7 +18,7 @@ mindspore.communication .. py:function:: mindspore.communication.init(backend_name=None) - 初始化通信服务需要的分布式后端,例如 `HCCL` 或 `NCCL` 服务。 + 初始化通信服务需要的分布式后端,例如 `HCCL` 或 `NCCL` 服务。通常在分布式并行场景下使用,并在使用通信服务前设置。 .. note:: - HCCL的全称是华为集合通信库(Huawei Collective Communication Library)。 @@ -27,7 +27,7 @@ mindspore.communication - 在运行以下示例之前,用户需要预设通信环境变量,请查看mindspore.communication的文档注释。 参数: - - **backend_name** (str) - 分布式后端的名称,可选HCCL或NCCL。如果未设置则根据硬件平台类型(device_target)进行推断,默认值为None。 + - **backend_name** (str) - 分布式后端的名称,可选HCCL或NCCL。在Ascend硬件平台下,应使用HCCL,在GPU硬件平台下,应使用NCCL。如果未设置则根据硬件平台类型(device_target)自动进行推断,默认值为None。 异常: - **TypeError** - 参数 `backend_name` 不是字符串。 diff --git a/mindspore/python/mindspore/communication/management.py b/mindspore/python/mindspore/communication/management.py index d90dd7b1376..8eda032ec39 100755 --- a/mindspore/python/mindspore/communication/management.py +++ b/mindspore/python/mindspore/communication/management.py @@ -83,7 +83,8 @@ def _check_parallel_envs(): def init(backend_name=None): """ - Initialize distributed backend, e.g. HCCL/NCCL, it is required before using the communication service. + Initialize distributed backends required by communication services, e.g. HCCL/NCCL. It is usually used in + distributed parallel scenarios and set before using communication services. Note: - The full name of HCCL is Huawei Collective Communication Library. @@ -93,8 +94,9 @@ def init(backend_name=None): before running the following example, please see the docstring of the mindspore.communication. Args: - backend_name (str): Backend, using HCCL/NCCL/MCCL. If the `backend_name` is None, system will recognize - `device_target` by devices. Default: None. + backend_name (str): Backend, using HCCL/NCCL/MCCL. HCCL should be used for Ascend hardware platforms and + NCCL for GPU hardware platforms. If not set, inference is automatically made based on the + hardware platform type (device_target). Default: None. Raises: TypeError: If `backend_name` is not a string.