• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2021 Huawei Technologies Co., Ltd
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef MINDSPORE_LITE_SRC_EXTENDRT_DELEGATE_TENSORRT_DISTRIBUTION_DISTRIBUTION_COLLECTIVE_H_
17 #define MINDSPORE_LITE_SRC_EXTENDRT_DELEGATE_TENSORRT_DISTRIBUTION_DISTRIBUTION_COLLECTIVE_H_
18 
19 #include <string>
20 #include "NvInfer.h"
21 #include "mindapi/base/types.h"
22 #include "src/extendrt/delegate/tensorrt/distribution/distribution_base.h"
23 
24 namespace mindspore::lite {
25 class DistributionCollective {
26  public:
27   DistributionCollective(DistributionCollective const &) = delete;
28 
29   DistributionCollective &operator=(const DistributionCollective &) = delete;
30 
31   static DistributionCollective &instance();
32 
33   int ReduceScatterWrapper(const void *input_addr, void *output_addr, size_t count, nvinfer1::DataType data_type,
34                            ReduceMode reduce_type, cudaStream_t stream, const std::string &group);
35 
36   int AllReduceWrapper(const void *input_addr, void *output_addr, size_t count, nvinfer1::DataType data_type,
37                        ReduceMode reduce_type, cudaStream_t stream, const std::string &group);
38 
39   int AllGatherWrapper(const void *input_addr, void *output_addr, size_t count, nvinfer1::DataType data_type,
40                        cudaStream_t stream, const std::string &group_name);
41 
42  private:
43   DistributionCollective();
44 
45   ~DistributionCollective() = default;
46 };
47 }  // namespace mindspore::lite
48 #endif  // MINDSPORE_LITE_SRC_EXTENDRT_DELEGATE_TENSORRT_DISTRIBUTION_DISTRIBUTION_COLLECTIVE_H_
49