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_PARALLEL_SHARED_PARAMETER_TENSOR_LAYOUT_H_ 18 #define MINDSPORE_CCSRC_FRONTEND_PARALLEL_SHARED_PARAMETER_TENSOR_LAYOUT_H_ 19 20 #include <string> 21 22 namespace mindspore { 23 namespace parallel { 24 class SharedParameter { 25 public: SharedParameter(bool pipeline_shared,bool is_send,int64_t peer_rank,int64_t sr_tag)26 SharedParameter(bool pipeline_shared, bool is_send, int64_t peer_rank, int64_t sr_tag) 27 : pipeline_shared_(pipeline_shared), is_send_(is_send), peer_rank_(peer_rank), sr_tag_(sr_tag) {} 28 ~SharedParameter() = default; 29 set_pipeline_shared(bool pipeline_shared)30 void set_pipeline_shared(bool pipeline_shared) { pipeline_shared_ = pipeline_shared; } pipeline_shared()31 bool pipeline_shared() const { return pipeline_shared_; } 32 set_is_send(bool is_send)33 void set_is_send(bool is_send) { is_send_ = is_send; } is_send()34 bool is_send() const { return is_send_; } 35 set_peer_rank(int64_t peer_rank)36 void set_peer_rank(int64_t peer_rank) { peer_rank_ = peer_rank; } peer_rank()37 int64_t peer_rank() const { return peer_rank_; } 38 set_sr_tag(int64_t sr_tag)39 void set_sr_tag(int64_t sr_tag) { sr_tag_ = sr_tag; } sr_tag()40 int64_t sr_tag() const { return sr_tag_; } 41 42 // Key for user data. 43 constexpr static char key[] = "SharedParameter"; 44 45 private: 46 bool pipeline_shared_ = false; 47 bool is_send_ = false; 48 int64_t peer_rank_{0}; 49 int64_t sr_tag_{0}; 50 }; 51 } // namespace parallel 52 } // namespace mindspore 53 54 #endif // MINDSPORE_CCSRC_FRONTEND_PARALLEL_SHARED_PARAMETER_TENSOR_LAYOUT_H_ 55