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.

tdt_host_interface.h 6.0 kB

5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. /**
  2. * @file tdt_host_interface.h
  3. *
  4. * Copyright (C) Huawei Technologies Co., Ltd. 2019-2020. All Rights Reserved.
  5. *
  6. * This program is used to host server
  7. */
  8. #ifndef HOST_INNER_INC_TDT_HOST_INTERFACE_H_
  9. #define HOST_INNER_INC_TDT_HOST_INTERFACE_H_
  10. #include <string.h>
  11. #include <memory>
  12. #include <vector>
  13. #include "tdt/data_common.h"
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif // __cplusplus
  17. namespace tdt {
  18. /**
  19. * @ingroup TdtHostInit
  20. * @brief Initialize the interface, start and initialize various general thread, log and other services
  21. *
  22. * @par Function
  23. * Initialize the interface, start and initialize various general thread, log and other services
  24. *
  25. * @param deviceId [IN] type #unsigned int. Physical device ID
  26. * @retval #0 Success
  27. * @retval #Not 0 Fail
  28. *
  29. * @par Dependency
  30. * @li libtsdclient.so: Library to which the interface belongs.
  31. * @li tdt_host_interface.h: Header file where the interface declaration is located.
  32. */
  33. int32_t TdtHostInit(uint32_t deviceId);
  34. /**
  35. * @ingroup TdtHostPushData
  36. * @brief Blocking queue. When the queue is full, the Push interface will block.
  37. *
  38. * @par Function
  39. * Blocking queue. When the queue is full, the Push interface will block.
  40. *
  41. * @param channelName [IN] type #String. queue channel name
  42. * @param items [IN] type #vector<DataItem> DataItem is defined in data_common.h. input data
  43. * @retval 0 Success
  44. * @retval OtherValues 0 Fail
  45. *
  46. * @par Dependency
  47. * @li libtsdclient.so: Library to which the interface belongs.
  48. * @li tdt_host_interface.h: Header file where the interface declaration is located.
  49. * @li data_common.h: Header file where 'DataItem' defined
  50. */
  51. int32_t TdtHostPushData(const std::string &channelName, const std::vector<DataItem> &item, uint32_t deviceId = 0);
  52. /**
  53. * @ingroup TdtHostDestroy
  54. * @brief Notify TDT component to close related resources
  55. *
  56. * @par Function
  57. * Notify TDT component to close related resources
  58. *
  59. * @param NA
  60. * @retval 0 Success
  61. * @retval OtherValues Fail
  62. *
  63. * @par Dependency
  64. * @li libtsdclient.so: Library to which the interface belongs.
  65. * @li tdt_host_interface.h: Header file where the interface declaration is located.
  66. */
  67. int32_t TdtHostDestroy();
  68. /**
  69. * @ingroup TdtHostPreparePopData
  70. * @brief Prepare pop data from Tdt data storage queue
  71. *
  72. * @par Function
  73. * Prepare pop data from Tdt data storage queue
  74. *
  75. * @param NA
  76. * @retval 0 Success
  77. * @retval OtherValues 0 Fail
  78. *
  79. * @par Dependency
  80. * @li libtsdclient.so: Library to which the interface belongs.
  81. * @li tdt_host_interface.h: Header file where the interface declaration is located.
  82. * @li data_common.h: Header file where 'DataItem' defined
  83. */
  84. int32_t TdtHostPreparePopData();
  85. /**
  86. * @ingroup TdtHostPopData
  87. * @brief POP data from Tdt data storage queue
  88. *
  89. * @par Function
  90. * POP data from Tdt data storage queue
  91. *
  92. * @param channelName [IN] type #String. queue channel name
  93. * @param items [IN] type #vector<DataItem> DataItem is defined in data_common.h. input data
  94. * @retval 0 Success
  95. * @retval OtherValues 0 Fail
  96. *
  97. * @par Dependency
  98. * @li libtsdclient.so: Library to which the interface belongs.
  99. * @li tdt_host_interface.h: Header file where the interface declaration is located.
  100. * @li data_common.h: Header file where 'DataItem' defined
  101. */
  102. int32_t TdtHostPopData(const std::string &channelName, std::vector<DataItem> &item);
  103. /**
  104. * @ingroup TdtHostStop
  105. * @brief Activate the thread that reads data externally from Tdt and
  106. * send end of sequence data so that the external thread can exit
  107. *
  108. * @par Function
  109. * Activate the thread that reads data externally from Tdt and send
  110. * end of sequence data so that the external thread can exit
  111. *
  112. * @param channelName [IN] type #String. queue channel name
  113. * @retval 0 Success
  114. * @retval OtherValues Fail
  115. *
  116. * @par Dependency
  117. * @li libtsdclient.so: Library to which the interface belongs.
  118. * @li tdt_host_interface.h: Header file where the interface declaration is located.
  119. */
  120. int32_t TdtHostStop(const std::string &channelName);
  121. /**
  122. * @ingroup TdtInFeedInit
  123. * @brief Initialize the interface, start and initialize various general thread, log and other services
  124. *
  125. * @par Function
  126. * Initialize the interface, start and initialize various general thread, log and other services
  127. *
  128. * @param deviceId [IN] type #unsigned int. logic device ID
  129. * @retval #0 Success
  130. * @retval #Not 0 Fail
  131. *
  132. * @par Dependency
  133. * @li libtsdclient.so: Library to which the interface belongs.
  134. * @li tdt_host_interface.h: Header file where the interface declaration is located.
  135. */
  136. int32_t TdtInFeedInit(uint32_t deviceId);
  137. /**
  138. * @ingroup TdtOutFeedInit
  139. * @brief Initialize the interface, start and initialize various general thread, log and other services
  140. *
  141. * @par Function
  142. * Initialize the interface, start and initialize various general thread, log and other services
  143. *
  144. * @param deviceId [IN] type #unsigned int. logic device ID
  145. * @retval #0 Success
  146. * @retval #Not 0 Fail
  147. *
  148. * @par Dependency
  149. * @li libtsdclient.so: Library to which the interface belongs.
  150. * @li tdt_host_interface.h: Header file where the interface declaration is located.
  151. */
  152. int32_t TdtOutFeedInit(uint32_t deviceId);
  153. /**
  154. * @ingroup TdtInFeedDestroy
  155. * @brief Notify TDT component to close related resources
  156. *
  157. * @par Function
  158. * Notify TDT component to close related resources
  159. *
  160. * @param NA
  161. * @retval 0 Success
  162. * @retval OtherValues Fail
  163. *
  164. * @par Dependency
  165. * @li libtsdclient.so: Library to which the interface belongs.
  166. * @li tdt_host_interface.h: Header file where the interface declaration is located.
  167. */
  168. int32_t TdtInFeedDestroy(uint32_t deviceId);
  169. /**
  170. * @ingroup TdtOutFeedDestroy
  171. * @brief Notify TDT component to close related resources
  172. *
  173. * @par Function
  174. * Notify TDT component to close related resources
  175. *
  176. * @param NA
  177. * @retval 0 Success
  178. * @retval OtherValues Fail
  179. *
  180. * @par Dependency
  181. * @li libtsdclient.so: Library to which the interface belongs.
  182. * @li tdt_host_interface.h: Header file where the interface declaration is located.
  183. */
  184. int32_t TdtOutFeedDestroy();
  185. } // namespace tdt
  186. #ifdef __cplusplus
  187. }
  188. #endif // __cplusplus
  189. #endif // HOST_INNER_INC_TDT_HOST_INTERFACE_H_

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