/** * Copyright 2019-2020 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "ge_local_engine/engine/ge_local_engine.h" #include #include #include #include "framework/common/debug/ge_log.h" #include "common/ge_inner_error_codes.h" #include "common/constant/constant.h" #include "common/ge/ge_util.h" #include "ops_kernel_store/ge_local_ops_kernel_info.h" namespace ge { namespace ge_local { GeLocalEngine &GeLocalEngine::Instance() { static GeLocalEngine instance; return instance; } Status GeLocalEngine::Initialize(const std::map &options) { if (ops_kernel_store_ == nullptr) { ops_kernel_store_ = MakeShared(); if (ops_kernel_store_ == nullptr) { GELOGE(FAILED, "Make GeLocalOpsKernelInfoStore failed."); return FAILED; } } return SUCCESS; } void GeLocalEngine::GetOpsKernelInfoStores(std::map &ops_kernel_map) { if (ops_kernel_store_ != nullptr) { // add buildin opsKernel to opsKernelInfoMap ops_kernel_map[kGeLocalOpKernelLibName] = ops_kernel_store_; } } void GeLocalEngine::GetGraphOptimizerObjs(std::map &) { // no optimizer for ge local engine } Status GeLocalEngine::Finalize() { ops_kernel_store_ = nullptr; return SUCCESS; } } // namespace ge_local } // namespace ge ge::Status Initialize(const std::map &options) { return ge::ge_local::GeLocalEngine::Instance().Initialize(options); } void GetOpsKernelInfoStores(std::map &ops_kernel_map) { ge::ge_local::GeLocalEngine::Instance().GetOpsKernelInfoStores(ops_kernel_map); } void GetGraphOptimizerObjs(std::map &graph_optimizers) { ge::ge_local::GeLocalEngine::Instance().GetGraphOptimizerObjs(graph_optimizers); } ge::Status Finalize() { return ge::ge_local::GeLocalEngine::Instance().Finalize(); }