• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2024 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 
17 #ifndef MINDSPORE_CCSRC_FRONTEND_OPTIMIZER_FLASH_SP_H_
18 #define MINDSPORE_CCSRC_FRONTEND_OPTIMIZER_FLASH_SP_H_
19 
20 #include <vector>
21 #include <string>
22 #include <algorithm>
23 
24 #include "ir/anf.h"
25 #include "include/common/utils/utils.h"
26 #include "include/common/utils/parallel_context.h"
27 #include "include/backend/optimizer/optimizer.h"
28 #include "pipeline/jit/ps/resource.h"
29 
30 namespace mindspore {
31 namespace parallel {
32 bool SetFlashSP(const FuncGraphPtr &func_graph);
33 
34 class FlashSPInfo {
35  public:
36   explicit FlashSPInfo(CNodePtr fa_score_node);
37   ~FlashSPInfo() = default;
GetSPNum()38   int64_t GetSPNum() const { return flashsp_num_; }
GetRankId()39   int64_t GetRankId() const { return dev_rank_id_; }
GetSendRankId()40   int64_t GetSendRankId() const { return send_rank_id_; }
GetRecvRankId()41   int64_t GetRecvRankId() const { return recv_rank_id_; }
42 
DisplayInfo()43   void DisplayInfo() {
44     MS_LOG(DEBUG) << "sp_num_ " << flashsp_num_;
45     MS_LOG(DEBUG) << "dev_rank_id_ " << dev_rank_id_;
46     MS_LOG(DEBUG) << "send_rank_id_ " << send_rank_id_;
47     MS_LOG(DEBUG) << "recv_rank_id_ " << recv_rank_id_;
48   }
49 
50  private:
51   int64_t flashsp_num_;
52   int64_t send_rank_id_;
53   int64_t recv_rank_id_;
54   int64_t dev_rank_id_;
55 };
56 }  // namespace parallel
57 }  // namespace mindspore
58 #endif  // MINDSPORE_CCSRC_FRONTEND_OPTIMIZER_FLASH_SP_H_
59