Coverage for / home / jenkins / .local / lib / python3.10 / site-packages / hyper_parallel / platform / mindspore / platform_graph.py: 0%
30 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-05-20 07:18 +0800
« prev ^ index » next coverage.py v7.13.1, created at 2026-05-20 07:18 +0800
1# Copyright 2025 Huawei Technologies Co., Ltd
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14# ============================================================================
15"""MindSpore platform api for grap mode"""
16from mindspore import ops
18from hyper_parallel.platform.mindspore.platform import MindSporePlatform
21class MindSporeGraphPlatform(MindSporePlatform):
22 """MindSpore platform api"""
24 @staticmethod
25 def all_gather_into_tensor(data, group_info, async_op=False):
26 output = ops.AllGather(group=group_info.group_name)(data)
27 return output, None
29 @staticmethod
30 def all_reduce(data, group_info, async_op=False):
31 output = ops.AllReduce(group=group_info.group_name)(data)
32 return output, None
34 @staticmethod
35 def reduce_scatter_tensor(data, group_info, async_op=False):
36 output = ops.ReduceScatter(group=group_info.group_name)(data)
37 return output, None
39 @staticmethod
40 def ckpt_wrapper(module, checkpoint_fn=None, **checkpoint_fn_kwargs):
41 raise NotImplementedError("ckpt_wrapper is not supported on MindSpore Graph platform")
43 @staticmethod
44 def swap_wrapper(module, policy_fn=None):
45 raise NotImplementedError("swap_wrapper is not supported on MindSpore Graph platform")
47 @property
48 def noop_context_fn(self):
49 raise NotImplementedError("noop_context_fn is not supported on MindSpore Graph platform")
51 @staticmethod
52 def create_selective_checkpoint_contexts(policy_fn_or_list, allow_cache_entry_mutation=False):
53 raise NotImplementedError("create_selective_checkpoint_contexts is not supported on MindSpore Graph platform")
55 @staticmethod
56 def async_save_on_cpu(policy_fn=None):
57 raise NotImplementedError("async_save_on_cpu is not supported on MindSpore Graph platform")