You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

session_manager.cc 18 kB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. /**
  2. * Copyright 2020 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. #include "session/session_manager.h"
  17. #include <memory>
  18. #include <utility>
  19. #include "common/ge/ge_util.h"
  20. #include "framework/common/debug/ge_log.h"
  21. #include "graph/ge_context.h"
  22. #include "graph/load/model_manager/model_manager.h"
  23. #include "graph/manager/util/rt_context_util.h"
  24. using std::map;
  25. using std::string;
  26. using std::vector;
  27. namespace ge {
  28. Status SessionManager::Initialize(const std::map<std::string, std::string> &options) {
  29. if (init_flag_) {
  30. GELOGW("Session Manager has been initialized.");
  31. return SUCCESS;
  32. }
  33. init_flag_ = true;
  34. return SUCCESS;
  35. }
  36. Status SessionManager::Finalize() {
  37. if (!init_flag_) {
  38. GELOGW("Session Manager has not been initialized.");
  39. return SUCCESS;
  40. }
  41. std::lock_guard<std::mutex> lock(mutex_);
  42. for (auto iter = session_manager_map_.begin(); iter != session_manager_map_.end(); ++iter) {
  43. (void)iter->second->Finalize();
  44. }
  45. session_manager_map_.clear();
  46. init_flag_ = false;
  47. return SUCCESS;
  48. }
  49. Status SessionManager::SetRtContext(SessionId session_id, rtContext_t rt_context) {
  50. GELOGI("set rt_context RT_CTX_NORMAL_MODE, device id:%u.", GetContext().DeviceId());
  51. GE_CHK_RT_RET(rtCtxCreate(&rt_context, RT_CTX_NORMAL_MODE, static_cast<int32_t>(GetContext().DeviceId())));
  52. GE_CHK_RT_RET(rtCtxSetCurrent(rt_context));
  53. RtContextUtil::GetInstance().AddRtContext(session_id, rt_context);
  54. return SUCCESS;
  55. }
  56. Status SessionManager::CreateSession(const std::map<std::string, std::string> &options, SessionId &session_id) {
  57. if (!init_flag_) {
  58. GELOGE(GE_SESSION_MANAGER_NOT_INIT, "[Create][Session]fail for Session manager is not initialized.");
  59. REPORT_INNER_ERROR("E19999", "CreateSession fail for Session manager is not initialized.");
  60. return GE_SESSION_MANAGER_NOT_INIT;
  61. }
  62. SessionId next_session_id = 0;
  63. std::lock_guard<std::mutex> lock(mutex_);
  64. Status nextSessionIdRet = GetNextSessionId(next_session_id);
  65. if (nextSessionIdRet != SUCCESS) {
  66. return nextSessionIdRet;
  67. }
  68. SessionPtr sessionPtr = MakeShared<InnerSession>(next_session_id, options);
  69. if (sessionPtr == nullptr) {
  70. return MEMALLOC_FAILED;
  71. }
  72. Status ret = sessionPtr->Initialize();
  73. if (ret != SUCCESS) {
  74. return ret;
  75. }
  76. (void)session_manager_map_.emplace(std::pair<SessionId, SessionPtr>(next_session_id, sessionPtr));
  77. session_id = next_session_id;
  78. // create a context
  79. ret = SetRtContext(session_id, rtContext_t());
  80. return ret;
  81. }
  82. Status SessionManager::DestroySession(SessionId session_id) {
  83. if (!init_flag_) {
  84. GELOGE(GE_SESSION_MANAGER_NOT_INIT, "[Destroy][Session]fail for Session manager is not initialized, session_id:%lu.",
  85. session_id);
  86. REPORT_INNER_ERROR("E19999",
  87. "DestroySession fail for Session manager is not initialized, session_id:%lu.", session_id);
  88. return GE_SESSION_MANAGER_NOT_INIT;
  89. }
  90. std::lock_guard<std::mutex> lock(mutex_);
  91. std::map<SessionId, SessionPtr>::iterator it = session_manager_map_.find(session_id);
  92. if (it == session_manager_map_.end()) {
  93. return GE_SESSION_NOT_EXIST;
  94. }
  95. if (ModelManager::GetInstance() != nullptr) {
  96. ModelManager::GetInstance()->DestroyAicpuSession(session_id);
  97. }
  98. // Unified destruct rt_context
  99. RtContextUtil::GetInstance().DestroyRtContexts(session_id);
  100. SessionPtr innerSession = it->second;
  101. Status ret = innerSession->Finalize();
  102. if (ret != SUCCESS) {
  103. return ret;
  104. }
  105. (void)session_manager_map_.erase(session_id);
  106. return ret;
  107. }
  108. Status SessionManager::GetVariable(SessionId session_id, const std::string &name, Tensor &val) {
  109. if (!init_flag_) {
  110. GELOGE(GE_SESSION_MANAGER_NOT_INIT,
  111. "[Get][Variable]fail for Session manager is not initialized, session_id:%lu, input_name:%s.",
  112. session_id, name.c_str());
  113. REPORT_INNER_ERROR("E19999",
  114. "GetVariable fail for Session manager is not initialized, session_id:%lu, input_name:%s.",
  115. session_id, name.c_str());
  116. return GE_SESSION_MANAGER_NOT_INIT;
  117. }
  118. SessionPtr innerSession = nullptr;
  119. {
  120. std::lock_guard<std::mutex> lock(mutex_);
  121. std::map<SessionId, SessionPtr>::iterator it = session_manager_map_.find(session_id);
  122. if (it == session_manager_map_.end()) {
  123. return GE_SESSION_NOT_EXIST;
  124. } else {
  125. innerSession = it->second;
  126. }
  127. }
  128. return innerSession->GetVariable(name, val);
  129. }
  130. Status SessionManager::AddGraph(SessionId session_id, uint32_t graph_id, const Graph &graph) {
  131. std::map<std::string, std::string> options;
  132. return AddGraph(session_id, graph_id, graph, options);
  133. }
  134. Status SessionManager::AddGraph(SessionId session_id, uint32_t graph_id, const Graph &graph,
  135. const std::map<std::string, std::string> &options) {
  136. if (!init_flag_) {
  137. GELOGE(GE_SESSION_MANAGER_NOT_INIT,
  138. "[Add][Graph]fail for Session manager is not initialized, session_id:%lu, graph_id:%u.", session_id, graph_id);
  139. REPORT_INNER_ERROR("E19999",
  140. "AddGraph fail for Session manager is not initialized, session_id:%lu, graph_id:%u.", session_id, graph_id);
  141. return GE_SESSION_MANAGER_NOT_INIT;
  142. }
  143. SessionPtr innerSession = nullptr;
  144. {
  145. std::lock_guard<std::mutex> lock(mutex_);
  146. std::map<SessionId, SessionPtr>::iterator it = session_manager_map_.find(session_id);
  147. if (it == session_manager_map_.end()) {
  148. return GE_SESSION_NOT_EXIST;
  149. } else {
  150. innerSession = it->second;
  151. }
  152. auto compute_graph = GraphUtils::GetComputeGraph(graph);
  153. GE_CHECK_NOTNULL(compute_graph);
  154. std::string session_graph_id = std::to_string(session_id) + "_" + std::to_string(graph_id);
  155. if (!AttrUtils::SetStr(*compute_graph, ATTR_NAME_SESSION_GRAPH_ID, session_graph_id)) {
  156. GELOGW("Set graph session_graph_id attr failed.");
  157. } else {
  158. GELOGD("Set graph session_graph_id attr to [%s]", session_graph_id.c_str());
  159. }
  160. for (auto graph : compute_graph->GetAllSubgraphs()) {
  161. AttrUtils::SetStr(*graph, ATTR_NAME_SESSION_GRAPH_ID, session_graph_id);
  162. }
  163. }
  164. return innerSession->AddGraph(graph_id, graph, options);
  165. }
  166. Status SessionManager::AddGraphWithCopy(SessionId session_id, uint32_t graph_id, const Graph &graph,
  167. const std::map<std::string, std::string> &options) {
  168. if (!init_flag_) {
  169. GELOGE(GE_SESSION_MANAGER_NOT_INIT,
  170. "[Add][GraphWithCopy]fail for Session manager is not initialized, session_id:%lu, graph_id:%u.",
  171. session_id, graph_id);
  172. REPORT_INNER_ERROR("E19999",
  173. "AddGraphWithCopy fail for Session manager is not initialized, session_id:%lu, graph_id:%u.",
  174. session_id, graph_id);
  175. return GE_SESSION_MANAGER_NOT_INIT;
  176. }
  177. SessionPtr innerSession = nullptr;
  178. {
  179. std::lock_guard<std::mutex> lock(mutex_);
  180. std::map<SessionId, SessionPtr>::iterator it = session_manager_map_.find(session_id);
  181. if (it == session_manager_map_.end()) {
  182. return GE_SESSION_NOT_EXIST;
  183. } else {
  184. innerSession = it->second;
  185. }
  186. auto compute_graph = GraphUtils::GetComputeGraph(graph);
  187. GE_CHECK_NOTNULL(compute_graph);
  188. std::string session_graph_id = std::to_string(session_id) + "_" + std::to_string(graph_id);
  189. if (!AttrUtils::SetStr(*compute_graph, ATTR_NAME_SESSION_GRAPH_ID, session_graph_id)) {
  190. GELOGW("Set graph session_graph_id attr failed.");
  191. } else {
  192. GELOGD("Set graph session_graph_id attr to [%s]", session_graph_id.c_str());
  193. }
  194. for (auto graph : compute_graph->GetAllSubgraphs()) {
  195. AttrUtils::SetStr(*graph, ATTR_NAME_SESSION_GRAPH_ID, session_graph_id);
  196. }
  197. }
  198. return innerSession->AddGraphWithCopy(graph_id, graph, options);
  199. }
  200. Status SessionManager::RunGraph(SessionId session_id, uint32_t graph_id, const std::vector<Tensor> &inputs,
  201. std::vector<Tensor> &outputs) {
  202. if (!init_flag_) {
  203. GELOGE(GE_SESSION_MANAGER_NOT_INIT,
  204. "[Run][Graph]fail for Session manager is not initialized, session_id:%lu, graph_id:%u.", session_id, graph_id);
  205. REPORT_INNER_ERROR("E19999",
  206. "RunGraph fail for Session manager is not initialized, session_id:%lu, graph_id:%u.", session_id, graph_id);
  207. return GE_SESSION_MANAGER_NOT_INIT;
  208. }
  209. SessionPtr innerSession = nullptr;
  210. {
  211. std::lock_guard<std::mutex> lock(mutex_);
  212. std::map<SessionId, SessionPtr>::iterator it = session_manager_map_.find(session_id);
  213. if (it == session_manager_map_.end()) {
  214. return GE_SESSION_NOT_EXIST;
  215. } else {
  216. innerSession = it->second;
  217. }
  218. }
  219. return innerSession->RunGraph(graph_id, inputs, outputs);
  220. }
  221. Status SessionManager::RemoveGraph(SessionId session_id, uint32_t graph_id) {
  222. if (!init_flag_) {
  223. GELOGE(GE_SESSION_MANAGER_NOT_INIT,
  224. "[Remove][Graph]fail for Session manager is not initialized, session_id:%lu graph_id:%u.",
  225. session_id, graph_id);
  226. REPORT_INNER_ERROR("E19999",
  227. "RemoveGraph fail for Session manager is not initialized, session_id:%lu graph_id:%u.",
  228. session_id, graph_id);
  229. return GE_SESSION_MANAGER_NOT_INIT;
  230. }
  231. SessionPtr innerSession = nullptr;
  232. {
  233. std::lock_guard<std::mutex> lock(mutex_);
  234. std::map<SessionId, SessionPtr>::iterator it = session_manager_map_.find(session_id);
  235. if (it == session_manager_map_.end()) {
  236. return GE_SESSION_NOT_EXIST;
  237. } else {
  238. innerSession = it->second;
  239. }
  240. }
  241. return innerSession->RemoveGraph(graph_id);
  242. }
  243. bool SessionManager::HasSession(SessionId session_id) {
  244. if (!init_flag_) {
  245. GELOGE(GE_SESSION_MANAGER_NOT_INIT,
  246. "[Has][Session]fail for Session manager is not initialized, session_id:%lu.", session_id);
  247. REPORT_INNER_ERROR("E19999",
  248. "HasSession fail for Session manager is not initialized, session_id:%lu.", session_id);
  249. return false;
  250. }
  251. return session_manager_map_.find(session_id) != session_manager_map_.end();
  252. }
  253. Status SessionManager::GetNextSessionId(SessionId &next_session_id) {
  254. if (!init_flag_) {
  255. GELOGE(GE_SESSION_MANAGER_NOT_INIT, "[Get][NextSessionId]fail for Session manager is not initialized.");
  256. REPORT_INNER_ERROR("E19999", "GetNextSessionId fail for Session manager is not initialized.");
  257. return GE_SESSION_MANAGER_NOT_INIT;
  258. }
  259. static SessionId session_id = 0;
  260. next_session_id = session_id++;
  261. return SUCCESS;
  262. }
  263. Status SessionManager::RegisterCallBackFunc(
  264. SessionId session_id, const std::string &key,
  265. const std::function<Status(uint32_t, const std::map<std::string, ge::Tensor> &)> &callback) {
  266. if (!init_flag_) {
  267. GELOGE(GE_SESSION_MANAGER_NOT_INIT,
  268. "[Register][CallBackFunc]fail for Session manager is not initialized, session_id:%lu, input_key:%s.",
  269. session_id, key.c_str());
  270. REPORT_INNER_ERROR("E19999",
  271. "RegisterCallBackFunc fail for Session manager is not initialized, session_id:%lu, input_key:%s.",
  272. session_id, key.c_str());
  273. return GE_SESSION_MANAGER_NOT_INIT;
  274. }
  275. SessionPtr innerSession = nullptr;
  276. {
  277. std::lock_guard<std::mutex> lock(mutex_);
  278. std::map<SessionId, SessionPtr>::iterator it = session_manager_map_.find(session_id);
  279. if (it == session_manager_map_.end()) {
  280. return GE_SESSION_NOT_EXIST;
  281. } else {
  282. innerSession = it->second;
  283. }
  284. }
  285. return innerSession->RegisterCallBackFunc(key, callback);
  286. }
  287. Status SessionManager::RegisterCallBackFunc(
  288. SessionId session_id, const std::string &key,
  289. const std::function<Status(uint32_t, const std::map<AscendString, ge::Tensor> &)> &callback) {
  290. if (!init_flag_) {
  291. GELOGE(GE_SESSION_MANAGER_NOT_INIT,
  292. "[Register][CallBackFunc]fail for Session manager is not initialized, session_id:%lu, input_key:%s.",
  293. session_id, key.c_str());
  294. REPORT_INNER_ERROR("E19999",
  295. "RegisterCallBackFunc fail for Session manager is not initialized, session_id:%lu, input_key:%s.",
  296. session_id, key.c_str());
  297. return GE_SESSION_MANAGER_NOT_INIT;
  298. }
  299. SessionPtr innerSession = nullptr;
  300. {
  301. std::lock_guard<std::mutex> lock(mutex_);
  302. std::map<SessionId, SessionPtr>::iterator it = session_manager_map_.find(session_id);
  303. if (it == session_manager_map_.end()) {
  304. return GE_SESSION_NOT_EXIST;
  305. } else {
  306. innerSession = it->second;
  307. }
  308. }
  309. return innerSession->RegisterCallBackFunc(key, callback);
  310. }
  311. Status SessionManager::BuildGraph(SessionId session_id, uint32_t graph_id, const std::vector<InputTensorInfo> &inputs) {
  312. if (!init_flag_) {
  313. GELOGE(GE_SESSION_MANAGER_NOT_INIT,
  314. "[Build][Graph]fail for Session manager is not initialized, session_id:%lu, graph_id:%u.", session_id, graph_id);
  315. REPORT_INNER_ERROR("E19999",
  316. "BuildGraph fail for Session manager is not initialized, session_id:%lu, graph_id:%u.", session_id, graph_id);
  317. return GE_SESSION_MANAGER_NOT_INIT;
  318. }
  319. SessionPtr innerSession = nullptr;
  320. {
  321. std::lock_guard<std::mutex> lock(mutex_);
  322. std::map<SessionId, SessionPtr>::iterator it = session_manager_map_.find(session_id);
  323. if (it == session_manager_map_.end()) {
  324. return GE_SESSION_NOT_EXIST;
  325. } else {
  326. innerSession = it->second;
  327. }
  328. }
  329. return innerSession->BuildGraph(graph_id, inputs);
  330. }
  331. Status SessionManager::RunGraphAsync(SessionId session_id, uint32_t graph_id,
  332. const std::vector<InputTensorInfo> &inputs, RunAsyncCallback callback) {
  333. if (!init_flag_) {
  334. GELOGE(GE_SESSION_MANAGER_NOT_INIT,
  335. "[AsyncRun][Graph]fail for Session manager is not initialized, session_id:%lu, graph_id:%u.",
  336. session_id, graph_id);
  337. REPORT_INNER_ERROR("E19999",
  338. "RunGraphAsync fail for Session manager is not initialized, session_id:%lu, graph_id:%u.",
  339. session_id, graph_id);
  340. return GE_SESSION_MANAGER_NOT_INIT;
  341. }
  342. SessionPtr innerSession = nullptr;
  343. {
  344. std::lock_guard<std::mutex> lock(mutex_);
  345. std::map<SessionId, SessionPtr>::iterator it = session_manager_map_.find(session_id);
  346. if (it == session_manager_map_.end()) {
  347. return GE_SESSION_NOT_EXIST;
  348. } else {
  349. innerSession = it->second;
  350. }
  351. }
  352. return innerSession->RunGraphAsync(graph_id, inputs, callback);
  353. }
  354. Status SessionManager::GetVariables(SessionId session_id, const std::vector<std::string> &var_names,
  355. std::vector<Tensor> &var_values) {
  356. // step 0: init session manager
  357. if (!init_flag_) {
  358. GELOGE(GE_SESSION_MANAGER_NOT_INIT,
  359. "[Get][Variables]fail for Session manager is not initialized, session_id:%lu", session_id);
  360. REPORT_INNER_ERROR("E19999",
  361. "GetVariables fail for Session manager is not initialized, session_id:%lu", session_id);
  362. return GE_SESSION_MANAGER_NOT_INIT;
  363. }
  364. SessionPtr innerSession = nullptr;
  365. {
  366. std::lock_guard<std::mutex> lock(mutex_);
  367. std::map<SessionId, SessionPtr>::iterator it = session_manager_map_.find(session_id);
  368. if (it == session_manager_map_.end()) {
  369. return GE_SESSION_NOT_EXIST;
  370. } else {
  371. innerSession = it->second;
  372. }
  373. }
  374. // step 1: get all variable
  375. std::map<std::string, GeTensorDesc> all_variables;
  376. Status ret = innerSession->GetAllVariables(all_variables);
  377. if (ret != SUCCESS) {
  378. GELOGE(FAILED, "[Get][AllVariables]failed.");
  379. return FAILED;
  380. }
  381. // srep 2: create check point graph
  382. Graph graph = Graph("checkpoint");
  383. ret = innerSession->GenCheckPointGraph(all_variables, graph);
  384. if (ret != SUCCESS) {
  385. GELOGE(FAILED, "[GenCheck][PointGraph] failed.");
  386. return FAILED;
  387. }
  388. // step 3: run check point graph
  389. uint32_t graph_id = GetCurrentSecondTimestap();
  390. ret = AddGraph(session_id, graph_id, graph);
  391. if (ret != SUCCESS) {
  392. GELOGE(FAILED, "[Add][Graph] failed.");
  393. return FAILED;
  394. }
  395. vector<Tensor> inputs;
  396. vector<Tensor> outputs;
  397. ret = RunGraph(session_id, graph_id, inputs, outputs);
  398. if (ret != SUCCESS) {
  399. GELOGE(FAILED, "[Run][Graph] failed.");
  400. return FAILED;
  401. }
  402. // step 4: save variables
  403. ret = innerSession->SaveVariables(graph, var_names, outputs, var_values);
  404. GELOGD("[SessionManager] outputs size is [%zu], var values size is [%zu].", outputs.size(), var_values.size());
  405. if (ret != SUCCESS) {
  406. GELOGE(FAILED, "[Save][Variables] failed.");
  407. return FAILED;
  408. }
  409. // step 5: remove graph
  410. ret = innerSession->RemoveGraph(graph_id);
  411. if (ret != SUCCESS) {
  412. GELOGE(FAILED, "[Remove][Graph] failed.");
  413. return FAILED;
  414. }
  415. return ret;
  416. }
  417. bool SessionManager::IsGraphNeedRebuild(SessionId session_id, uint32_t graph_id) {
  418. if (!init_flag_) {
  419. GELOGE(GE_SESSION_MANAGER_NOT_INIT,
  420. "[Check][GraphNeedRebuild]fail for Session manager is not initialized, session_id:%lu, graph_id:%u.",
  421. session_id, graph_id);
  422. REPORT_INNER_ERROR("E19999",
  423. "IsGraphNeedRebuild fail for Session manager is not initialized, session_id:%lu, graph_id:%u.",
  424. session_id, graph_id);
  425. return true;
  426. }
  427. SessionPtr innerSession = nullptr;
  428. {
  429. std::lock_guard<std::mutex> lock(mutex_);
  430. auto it = session_manager_map_.find(session_id);
  431. if (it == session_manager_map_.end()) {
  432. GELOGE(GE_SESSION_NOT_EXIST, "[Find][InnerSession] fail for %lu does not exists", session_id);
  433. REPORT_INNER_ERROR("E19999",
  434. "IsGraphNeedRebuild fail for InnerSession is not exists, session_id:%lu, graph_id:%u.",
  435. session_id, graph_id);
  436. return true;
  437. } else {
  438. innerSession = it->second;
  439. }
  440. }
  441. return innerSession->IsGraphNeedRebuild(graph_id);
  442. }
  443. } // namespace ge

图引擎模块(GE)是MindSpore的一个子模块,其代码由C++实现,位于前端模块ME和底层硬件之间,起到承接作用。图引擎模块以ME下发的图作为输入,然后进行一系列的深度图优化操作,最后输出一张可以在底层硬件上高效运行的图。GE针对昇腾AI处理器的硬件结构特点,做了特定的优化工作,以此来充分发挥出昇腾AI处理器的强大算力。在进行模型训练/推理时,GE会被自动调用而用户并不感知。GE主要由GE API和GE Core两部分组成,详细的架构图如下所示