1 /** 2 * Copyright 2019 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_UTILS_CONTEXT_CONTEXT_EXTENDS_H 18 #define MINDSPORE_CCSRC_UTILS_CONTEXT_CONTEXT_EXTENDS_H 19 20 #include <map> 21 #include <string> 22 #include <memory> 23 #include "utils/ms_context.h" 24 #include "utils/tensorprint_utils.h" 25 26 namespace mindspore { 27 namespace context { 28 bool OpenTsd(const std::shared_ptr<MsContext> &ms_context_ptr); 29 bool CloseTsd(const std::shared_ptr<MsContext> &ms_context_ptr, bool force = false); 30 void SetHcclOptions(const std::shared_ptr<MsContext> &inst_context, std::map<std::string, std::string> *ge_options); 31 void GetGeOptions(const std::shared_ptr<MsContext> &inst_context, std::map<std::string, std::string> *ge_options); 32 void SetDisableReuseMemoryFlag(std::map<std::string, std::string> *ge_options); 33 bool InitGe(const std::shared_ptr<MsContext> &inst_context); 34 bool FinalizeGe(const std::shared_ptr<MsContext> &inst_context, bool force = false); 35 bool PynativeInitGe(const std::shared_ptr<MsContext> &inst_context); 36 bool IsTsdOpened(const std::shared_ptr<MsContext> &inst_context); 37 bool IsGeInited(const std::shared_ptr<MsContext> &inst_context); 38 } // namespace context 39 } // namespace mindspore 40 41 #endif // MINDSPORE_CCSRC_UTILS_CONTEXT_CONTEXT_EXTENDS_H 42