• 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_RUNTIME_HCCL_ADAPTER_ALL_TO_ALL_V_CALC_PARAM_H
17 #define MINDSPORE_RUNTIME_HCCL_ADAPTER_ALL_TO_ALL_V_CALC_PARAM_H
18 
19 #include <memory>
20 #include <vector>
21 #include <string>
22 #include "mindspore/core/ir/anf.h"
23 
24 namespace mindspore::hccl {
25 class AllToAllvCalcParam {
26  public:
27   AllToAllvCalcParam(const CNodeWeakPtr &cnode, uint32_t rank_size);
28   ~AllToAllvCalcParam() = default;
29   void CalcOpParam();
30 
GetSendCounts()31   const std::vector<int64_t> &GetSendCounts() const { return send_counts_; }
GetSendDispls()32   const std::vector<int64_t> &GetSendDispls() const { return sdispls_; }
GetRecvCounts()33   const std::vector<int64_t> &GetRecvCounts() const { return recv_counts_; }
GetRecvDispls()34   const std::vector<int64_t> &GetRecvDispls() const { return rdispls_; }
35 
36  private:
37   void CalcMemOffset(const std::vector<size_t> &mem_sizes, const std::vector<size_t> &real_sizes,
38                      const std::string &rank_ids_attr, std::vector<int64_t> *counts, std::vector<int64_t> *displs);
39   CNodeWeakPtr node_;
40   uint32_t rank_size_;
41   std::vector<int64_t> send_counts_;
42   std::vector<int64_t> sdispls_;
43   std::vector<int64_t> recv_counts_;
44   std::vector<int64_t> rdispls_;
45 };
46 }  // namespace mindspore::hccl
47 #endif  // MINDSPORE_RUNTIME_HCCL_ADAPTER_ALL_TO_ALL_V_CALC_PARAM_H
48