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 5.9 kB

5 years ago
5 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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. #ifdef __cplusplus
  25. extern "C" {
  26. #endif // __cplusplus
  27. /**
  28. * @ingroup Open
  29. * @brief Used for the Framework process to communicate with the TSDDaemon process,
  30. * and notify TSD to complete the initialization of other processes
  31. *
  32. * @par Function
  33. * Used for the Framework process to communicate with the TSDDaemon process,
  34. * and notify TSD to complete the initialization of other processes
  35. *
  36. * @param phyDeviceId [IN] type #unsigned int. Physical device ID
  37. * @param rankSize [IN] type #unsigned int. The rankSize of the training.
  38. * The default value is 1. When rankSize is greater than 1,
  39. * HCCP will be pulled to perform set communication related operations.
  40. * @retval TDT_OK Success
  41. * @retval OtherValues Failure
  42. *
  43. * @par Dependency
  44. * @li libtsdclient.so: Library to which the interface belongs.
  45. * @li tsd_client.h: Header file where the interface declaration is located.
  46. * @li data_common.h: Header file where 'TDT_StatusT' defined
  47. */
  48. TDT_LIB_EXPORT TDT_StatusT TsdOpen(const uint32_t phyDeviceId, const uint32_t rankSize);
  49. /**
  50. * @ingroup Close
  51. * @brief notify TSDClient close resource
  52. *
  53. * @par Function
  54. * notify TSDClient close resource
  55. *
  56. * @param NA
  57. * @retval TDT_OK Success
  58. * @retval OtherValues Failure
  59. *
  60. * @par Dependency
  61. * @li libtsdclient.so: Library to which the interface belongs.
  62. * @li tsd_client.h: Header file where the interface declaration is located.
  63. * @li data_common.h: Header file where 'TDT_StatusT' defined
  64. */
  65. TDT_LIB_EXPORT TDT_StatusT TsdClose(const uint32_t phyDeviceId);
  66. /**
  67. * @ingroup UpdateProfilingMode
  68. * @brief notify TSDClient update profiling mode
  69. *
  70. * @par Function
  71. * notify TSDClient update profiling mode
  72. *
  73. * @param NA
  74. * @retval TDT_OK Success
  75. * @retval OtherValues Failure
  76. *
  77. * @par Dependency
  78. * @li libtsdclient.so: Library to which the interface belongs.
  79. * @li tsd_client.h: Header file where the interface declaration is located.
  80. * @li data_common.h: Header file where 'TDT_StatusT' defined
  81. */
  82. TDT_LIB_EXPORT TDT_StatusT UpdateProfilingMode(const uint32_t phyDeviceId, const uint32_t flag);
  83. /**
  84. * @ingroup CreateCmdParameterObj
  85. * @brief creat tsdclient func parameter obj.
  86. *
  87. * @par Function
  88. * creat tsdclient func parameter obj.
  89. *
  90. * @param type [IN] type tdt::TsdCmdType, tsd func type.
  91. * @param cmdParameterObj [IN] type void *, func parameter obj.
  92. * @retval TDT_OK Success
  93. * @retval TDT_INTERFACE_NOT_SUPPORT
  94. *
  95. * @par Dependency
  96. * @li libtsdclient.so: Library to which the interface belongs.
  97. * @li data_common.h: Header file where tdt::TsdCmdType and tdt::InputItem defined.
  98. * @li status.h: Header file where 'TDT_StatusT' defined
  99. */
  100. TDT_StatusT CreateCmdParameterObj(tdt::TsdCmdType type, void **cmdParameterObj);
  101. /**
  102. * @ingroup SetCmdParameterObjAttribute
  103. * @brief set cmdParameterObj input value.
  104. *
  105. * @par Function
  106. * set cmdParameterObj input value.
  107. *
  108. * @param type [IN] type tdt::TsdCmdType, tsd func type.
  109. * @param cmdParameterObj [IN] type void *, func parameter obj.
  110. * @param itemType [IN] type tdt::InputItem, func input type.
  111. * @param valuePtr [IN] type const void *, input value.
  112. * @param valueLength [IN] type int, input value length.
  113. * @retval TDT_OK Success
  114. * @retval TDT_INTERFACE_NOT_SUPPORT
  115. *
  116. * @par Dependency
  117. * @li libtsdclient.so: Library to which the interface belongs.
  118. * @li data_common.h: Header file where tdt::TsdCmdType and tdt::InputItem defined.
  119. * @li status.h: Header file where 'TDT_StatusT' defined
  120. */
  121. TDT_StatusT SetCmdParameterObjAttribute(tdt::TsdCmdType type, void *cmdParameterObj, tdt::InputItem itemType, const void *valuePtr, int valueLength);
  122. /**
  123. * @ingroup GetCmdParameterObjAttribute
  124. * @brief set cmdParameterObj input value.
  125. *
  126. * @par Function
  127. * set cmdParameterObj input value.
  128. *
  129. * @param type [IN] type tdt::TsdCmdType, tsd func type.
  130. * @param cmdParameterObj [IN] type void *, func parameter obj.
  131. * @param itemType [IN] type tdt::InputItem, func input type.
  132. * @param valuePtr [IN] type const void *, input value.
  133. * @param valueLength [IN] type int, input value length.
  134. * @retval TDT_OK Success
  135. * @retval TDT_INTERFACE_NOT_SUPPORT
  136. *
  137. * @par Dependency
  138. * @li libtsdclient.so: Library to which the interface belongs.
  139. * @li data_common.h: Header file where tdt::TsdCmdType and tdt::InputItem defined.
  140. * @li status.h: Header file where 'TDT_StatusT' defined
  141. */
  142. TDT_StatusT GetCmdParameterObjAttribute(tdt::TsdCmdType type, void *cmdParameterObj, tdt::InputItem itemType, void *valuePtr, int &valueLength);
  143. /**
  144. * @ingroup TsdClientCmd
  145. * @brief creat tsdclient func parameter obj.
  146. *
  147. * @par Function
  148. * creat tsdclient func parameter obj.
  149. *
  150. * @param type [IN] type tdt::TsdCmdType, tsd func type.
  151. * @param cmdParameterObj [IN] type void *, func parameter obj.
  152. * @retval TDT_OK Success
  153. * @retval TDT_INTERFACE_NOT_SUPPORT
  154. *
  155. * @par Dependency
  156. * @li libtsdclient.so: Library to which the interface belongs.
  157. * @li data_common.h: Header file where tdt::TsdCmdType and tdt::InputItem defined.
  158. * @li status.h: Header file where 'TDT_StatusT' defined
  159. */
  160. TDT_StatusT TsdClientCmd(tdt::TsdCmdType cmd, void *cmdParameterObj);
  161. #ifdef __cplusplus
  162. }
  163. #endif // __cplusplus
  164. #endif // TDT_HOST_INNER_INC_TSD_CLIENT_H_

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