• 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_LITE_SRC_RUNTIME_CXX_API_CONTEXT_H_
17 #define MINDSPORE_LITE_SRC_RUNTIME_CXX_API_CONTEXT_H_
18 
19 #include <cstdint>
20 #include <map>
21 #include <vector>
22 #include <string>
23 #include <memory>
24 #ifndef SUPPORT_NNIE
25 #include <any>
26 #else
27 #include <experimental/any>
28 #endif
29 #include "include/api/context.h"
30 #include "include/api/delegate.h"
31 
32 namespace mindspore {
33 struct Context::Data {
34   std::vector<std::shared_ptr<DeviceInfoContext>> device_info_list;
35   int affinity_mode_ = 0;
36   int32_t inter_op_parallel_num_ = 0;
37   std::string group_info_file_ = "";
38   int32_t thread_num = 0;  // defaults are automatically adjusted based on computer performance
39   bool enable_parallel_ = false;
40   std::vector<int32_t> affinity_core_list_;
41   DelegateMode delegate_mode_ = kNoDelegate;
42   std::shared_ptr<Delegate> delegate = nullptr;
43   bool float_mode = false;
44 };
45 
46 struct DeviceInfoContext::Data {
47 #ifndef SUPPORT_NNIE
48   std::map<std::string, std::any> params;
49 #else
50   std::map<std::string, std::experimental::any> params;
51 #endif
52   std::shared_ptr<Allocator> allocator = nullptr;
53 };
54 }  // namespace mindspore
55 
56 #endif  // MINDSPORE_LITE_SRC_RUNTIME_CXX_API_CONTEXT_H_
57