diff --git a/mindspore/ops/operations/comm_ops.py b/mindspore/ops/operations/comm_ops.py index 04575ef0b57ed8d39b86631fca6a1ad7b8b5a61b..449da93177a836b4b928e53af601a281cd2ad8c3 100644 --- a/mindspore/ops/operations/comm_ops.py +++ b/mindspore/ops/operations/comm_ops.py @@ -182,6 +182,9 @@ class HostAllGather(PrimitiveWithInfer): Note: Tensor must have the same shape and format in all processes participating in the collective. + HostAllGather is a host-side operator, it depends on OpenMPI and must use build option -M on + to enable it. Using mpirun command to run it: + mpirun -output-filename log -merge-stderr-to-stdout -np 3 python test_host_all_gather.py Args: group (Union[tuple[int],list[int]]): The rand_ids of communication group to work on. @@ -200,9 +203,13 @@ class HostAllGather(PrimitiveWithInfer): Examples: >>> import mindspore.nn as nn + >>> import mindspore.context as context >>> import mindspore.ops.operations as P >>> from mindspore import Tensor >>> + >>> context.set_context(mode=context.GRAPH_MODE, device_target='CPU') + >>> context.set_mpi_config(enable_mpi=True) + >>> >>> class Net(nn.Cell): >>> def __init__(self): >>> super(Net, self).__init__() @@ -308,6 +315,9 @@ class HostReduceScatter(PrimitiveWithInfer): Note: Tensor must have the same shape and format in all processes participating in the collective. + HostReduceScatter is a host-side operator, it depends on OpenMPI and must use build option + -M on to enable it. Using mpirun command to run it: + mpirun -output-filename log -merge-stderr-to-stdout -np 3 python test_host_reduce_scatter.py Args: op (str): Specifies an operation used for element-wise reductions, @@ -322,10 +332,14 @@ class HostReduceScatter(PrimitiveWithInfer): Examples: >>> import mindspore.nn as nn + >>> import mindspore.context as context >>> import mindspore.ops.operations as P >>> from mindspore import Tensor >>> from mindspore.ops.operations.comm_ops import ReduceOp >>> + >>> context.set_context(mode=context.GRAPH_MODE, device_target='CPU') + >>> context.set_mpi_config(enable_mpi=True) + >>> >>> class Net(nn.Cell): >>> def __init__(self): >>> super(Net, self).__init__()