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.4 kB

5 years ago
5 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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_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_StatusT TsdClose(const uint32_t phyDeviceId);
  66. /**
  67. * @ingroup CreateCmdParameterObj
  68. * @brief creat tsdclient func parameter obj.
  69. *
  70. * @par Function
  71. * creat tsdclient func parameter obj.
  72. *
  73. * @param type [IN] type tdt::TsdCmdType, tsd func type.
  74. * @param cmdParameterObj [IN] type void *, func parameter obj.
  75. * @retval TDT_OK Success
  76. * @retval TDT_INTERFACE_NOT_SUPPORT
  77. *
  78. * @par Dependency
  79. * @li libtsdclient.so: Library to which the interface belongs.
  80. * @li data_common.h: Header file where tdt::TsdCmdType and tdt::InputItem defined.
  81. * @li status.h: Header file where 'TDT_StatusT' defined
  82. */
  83. TDT_StatusT CreateCmdParameterObj(tdt::TsdCmdType type, void **cmdParameterObj);
  84. /**
  85. * @ingroup SetCmdParameterObjAttribute
  86. * @brief set cmdParameterObj input value.
  87. *
  88. * @par Function
  89. * set cmdParameterObj input value.
  90. *
  91. * @param type [IN] type tdt::TsdCmdType, tsd func type.
  92. * @param cmdParameterObj [IN] type void *, func parameter obj.
  93. * @param itemType [IN] type tdt::InputItem, func input type.
  94. * @param valuePtr [IN] type const void *, input value.
  95. * @param valueLength [IN] type int, input value length.
  96. * @retval TDT_OK Success
  97. * @retval TDT_INTERFACE_NOT_SUPPORT
  98. *
  99. * @par Dependency
  100. * @li libtsdclient.so: Library to which the interface belongs.
  101. * @li data_common.h: Header file where tdt::TsdCmdType and tdt::InputItem defined.
  102. * @li status.h: Header file where 'TDT_StatusT' defined
  103. */
  104. TDT_StatusT SetCmdParameterObjAttribute(tdt::TsdCmdType type, void *cmdParameterObj, tdt::InputItem itemType, const void *valuePtr, int valueLength);
  105. /**
  106. * @ingroup GetCmdParameterObjAttribute
  107. * @brief set cmdParameterObj input value.
  108. *
  109. * @par Function
  110. * set cmdParameterObj input value.
  111. *
  112. * @param type [IN] type tdt::TsdCmdType, tsd func type.
  113. * @param cmdParameterObj [IN] type void *, func parameter obj.
  114. * @param itemType [IN] type tdt::InputItem, func input type.
  115. * @param valuePtr [IN] type const void *, input value.
  116. * @param valueLength [IN] type int, input value length.
  117. * @retval TDT_OK Success
  118. * @retval TDT_INTERFACE_NOT_SUPPORT
  119. *
  120. * @par Dependency
  121. * @li libtsdclient.so: Library to which the interface belongs.
  122. * @li data_common.h: Header file where tdt::TsdCmdType and tdt::InputItem defined.
  123. * @li status.h: Header file where 'TDT_StatusT' defined
  124. */
  125. TDT_StatusT GetCmdParameterObjAttribute(tdt::TsdCmdType type, void *cmdParameterObj, tdt::InputItem itemType, void *valuePtr, int &valueLength);
  126. /**
  127. * @ingroup TsdClientCmd
  128. * @brief creat tsdclient func parameter obj.
  129. *
  130. * @par Function
  131. * creat tsdclient func parameter obj.
  132. *
  133. * @param type [IN] type tdt::TsdCmdType, tsd func type.
  134. * @param cmdParameterObj [IN] type void *, func parameter obj.
  135. * @retval TDT_OK Success
  136. * @retval TDT_INTERFACE_NOT_SUPPORT
  137. *
  138. * @par Dependency
  139. * @li libtsdclient.so: Library to which the interface belongs.
  140. * @li data_common.h: Header file where tdt::TsdCmdType and tdt::InputItem defined.
  141. * @li status.h: Header file where 'TDT_StatusT' defined
  142. */
  143. TDT_StatusT TsdClientCmd(tdt::TsdCmdType cmd, void *cmdParameterObj);
  144. #ifdef __cplusplus
  145. }
  146. #endif // __cplusplus
  147. #endif // TDT_HOST_INNER_INC_TSD_CLIENT_H_

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