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.

tsd_client.h 6.7 kB

5 years ago
5 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. /**
  2. * Copyright 2019-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. #ifndef TDT_HOST_INNER_INC_TSD_CLIENT_H_
  17. #define TDT_HOST_INNER_INC_TSD_CLIENT_H_
  18. #include <condition_variable>
  19. #include <map>
  20. #include <memory>
  21. #include <mutex>
  22. #include "tdt/status.h"
  23. #include "tdt/data_common.h"
  24. #include "toolchain/prof_callback.h"
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif // __cplusplus
  28. /**
  29. * @ingroup Open
  30. * @brief Used for the Framework process to communicate with the TSDDaemon process,
  31. * and notify TSD to complete the initialization of other processes
  32. *
  33. * @par Function
  34. * Used for the Framework process to communicate with the TSDDaemon process,
  35. * and notify TSD to complete the initialization of other processes
  36. *
  37. * @param logicDeviceId [IN] type #unsigned int. Logic device ID
  38. * @param rankSize [IN] type #unsigned int. The rankSize of the training.
  39. * The default value is 1. When rankSize is greater than 1,
  40. * HCCP will be pulled to perform set communication related operations.
  41. * @retval TDT_OK Success
  42. * @retval OtherValues Failure
  43. *
  44. * @par Dependency
  45. * @li libtsdclient.so: Library to which the interface belongs.
  46. * @li tsd_client.h: Header file where the interface declaration is located.
  47. * @li data_common.h: Header file where 'TDT_StatusT' defined
  48. */
  49. TDT_LIB_EXPORT TDT_StatusT TsdOpen(const uint32_t logicDeviceId, const uint32_t rankSize);
  50. /**
  51. * @ingroup Close
  52. * @brief notify TSDClient close resource
  53. *
  54. * @par Function
  55. * notify TSDClient close resource
  56. *
  57. * @param NA
  58. * @retval TDT_OK Success
  59. * @retval OtherValues Failure
  60. *
  61. * @par Dependency
  62. * @li libtsdclient.so: Library to which the interface belongs.
  63. * @li tsd_client.h: Header file where the interface declaration is located.
  64. * @li data_common.h: Header file where 'TDT_StatusT' defined
  65. */
  66. TDT_LIB_EXPORT TDT_StatusT TsdClose(const uint32_t logicDeviceId);
  67. /**
  68. * @ingroup UpdateProfilingMode
  69. * @brief notify TSDClient update profiling mode
  70. *
  71. * @par Function
  72. * notify TSDClient update profiling mode
  73. *
  74. * @param NA
  75. * @retval TDT_OK Success
  76. * @retval OtherValues Failure
  77. *
  78. * @par Dependency
  79. * @li libtsdclient.so: Library to which the interface belongs.
  80. * @li tsd_client.h: Header file where the interface declaration is located.
  81. * @li data_common.h: Header file where 'TDT_StatusT' defined
  82. */
  83. TDT_LIB_EXPORT TDT_StatusT UpdateProfilingMode(const uint32_t logicDeviceId, const uint32_t flag);
  84. /**
  85. * @ingroup TsdSetMsprofReporterCallback
  86. * @brief 用于推理场景下设置aicpu的profilng的callback函数
  87. *
  88. * @par Function
  89. * 设置offline模式下aicpu_sd进程的profiling的callback函数
  90. *
  91. * @param callback [IN] type #MsprofReporterCallback. 回调函数
  92. * @retval TDT_OK Success
  93. * @retval OtherValues Failure
  94. *
  95. * @par Dependency
  96. * @li libtsdclient.so: Library to which the interface belongs.
  97. * @li tsd_client.h: Header file where the interface declaration is located.
  98. * @li data_common.h: Header file where 'TDT_StatusT' defined
  99. * @li prof_callback.h: Headerfile where 'MsprofReporterCallback' defined
  100. */
  101. TDT_LIB_EXPORT TDT_StatusT TsdSetMsprofReporterCallback(MsprofReporterCallback callback);
  102. /**
  103. * @ingroup CreateCmdParameterObj
  104. * @brief creat tsdclient func parameter obj.
  105. *
  106. * @par Function
  107. * creat tsdclient func parameter obj.
  108. *
  109. * @param type [IN] type tdt::TsdCmdType, tsd func type.
  110. * @param cmdParameterObj [IN] type void *, func parameter obj.
  111. * @retval TDT_OK Success
  112. * @retval TDT_INTERFACE_NOT_SUPPORT
  113. *
  114. * @par Dependency
  115. * @li libtsdclient.so: Library to which the interface belongs.
  116. * @li data_common.h: Header file where tdt::TsdCmdType and tdt::InputItem defined.
  117. * @li status.h: Header file where 'TDT_StatusT' defined
  118. */
  119. TDT_StatusT CreateCmdParameterObj(tdt::TsdCmdType type, void **cmdParameterObj);
  120. /**
  121. * @ingroup SetCmdParameterObjAttribute
  122. * @brief set cmdParameterObj input value.
  123. *
  124. * @par Function
  125. * set cmdParameterObj input value.
  126. *
  127. * @param type [IN] type tdt::TsdCmdType, tsd func type.
  128. * @param cmdParameterObj [IN] type void *, func parameter obj.
  129. * @param itemType [IN] type tdt::InputItem, func input type.
  130. * @param valuePtr [IN] type const void *, input value.
  131. * @param valueLength [IN] type int, input value length.
  132. * @retval TDT_OK Success
  133. * @retval TDT_INTERFACE_NOT_SUPPORT
  134. *
  135. * @par Dependency
  136. * @li libtsdclient.so: Library to which the interface belongs.
  137. * @li data_common.h: Header file where tdt::TsdCmdType and tdt::InputItem defined.
  138. * @li status.h: Header file where 'TDT_StatusT' defined
  139. */
  140. TDT_StatusT SetCmdParameterObjAttribute(tdt::TsdCmdType type, void *cmdParameterObj, tdt::InputItem itemType, const void *valuePtr, int valueLength);
  141. /**
  142. * @ingroup GetCmdParameterObjAttribute
  143. * @brief set cmdParameterObj input value.
  144. *
  145. * @par Function
  146. * set cmdParameterObj input value.
  147. *
  148. * @param type [IN] type tdt::TsdCmdType, tsd func type.
  149. * @param cmdParameterObj [IN] type void *, func parameter obj.
  150. * @param itemType [IN] type tdt::InputItem, func input type.
  151. * @param valuePtr [IN] type const void *, input value.
  152. * @param valueLength [IN] type int, input value length.
  153. * @retval TDT_OK Success
  154. * @retval TDT_INTERFACE_NOT_SUPPORT
  155. *
  156. * @par Dependency
  157. * @li libtsdclient.so: Library to which the interface belongs.
  158. * @li data_common.h: Header file where tdt::TsdCmdType and tdt::InputItem defined.
  159. * @li status.h: Header file where 'TDT_StatusT' defined
  160. */
  161. TDT_StatusT GetCmdParameterObjAttribute(tdt::TsdCmdType type, void *cmdParameterObj, tdt::InputItem itemType, void *valuePtr, int &valueLength);
  162. /**
  163. * @ingroup TsdClientCmd
  164. * @brief creat tsdclient func parameter obj.
  165. *
  166. * @par Function
  167. * creat tsdclient func parameter obj.
  168. *
  169. * @param type [IN] type tdt::TsdCmdType, tsd func type.
  170. * @param cmdParameterObj [IN] type void *, func parameter obj.
  171. * @retval TDT_OK Success
  172. * @retval TDT_INTERFACE_NOT_SUPPORT
  173. *
  174. * @par Dependency
  175. * @li libtsdclient.so: Library to which the interface belongs.
  176. * @li data_common.h: Header file where tdt::TsdCmdType and tdt::InputItem defined.
  177. * @li status.h: Header file where 'TDT_StatusT' defined
  178. */
  179. TDT_StatusT TsdClientCmd(tdt::TsdCmdType cmd, void *cmdParameterObj);
  180. #ifdef __cplusplus
  181. }
  182. #endif // __cplusplus
  183. #endif // TDT_HOST_INNER_INC_TSD_CLIENT_H_

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