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.

CMakeLists.txt 5.8 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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. set(PROTO_LIST
  2. "${METADEF_DIR}/proto/task.proto"
  3. )
  4. protobuf_generate(ge PROTO_SRCS PROTO_HDRS ${PROTO_LIST})
  5. set(SRC_LIST
  6. "engine/host_cpu_engine.cc"
  7. "ops_kernel_store/host_cpu_ops_kernel_info.cc"
  8. "ops_kernel_store/op/op_factory.cc"
  9. "ops_kernel_store/op/host_op.cc"
  10. )
  11. set(CPU_OPS_KERNEL_LIST
  12. "ops_kernel_store/host_cpu_ops_kernel_builder.cc"
  13. )
  14. ############ libhost_cpu_engine.so ############
  15. add_library(host_cpu_engine SHARED ${SRC_LIST} ${PROTO_HDRS})
  16. target_compile_options(host_cpu_engine PRIVATE
  17. -Werror
  18. -fno-common
  19. )
  20. target_compile_definitions(host_cpu_engine PRIVATE
  21. google=ascend_private
  22. )
  23. target_include_directories(host_cpu_engine PRIVATE
  24. ${CMAKE_CURRENT_LIST_DIR}
  25. ${GE_CODE_DIR}/ge
  26. ${GE_CODE_DIR}/inc
  27. ${GE_CODE_DIR}/inc/external
  28. ${GE_CODE_DIR}/inc/framework
  29. ${METADEF_DIR}/inc
  30. ${METADEF_DIR}/inc/external
  31. ${METADEF_DIR}/inc/external/graph
  32. ${CMAKE_BINARY_DIR}
  33. ${CMAKE_BINARY_DIR}/proto/ge
  34. #### yellow zone ####
  35. ${GE_CODE_DIR}/../inc
  36. #### blue zone ####
  37. ${GE_CODE_DIR}/third_party/fwkacllib/inc
  38. )
  39. target_link_libraries(host_cpu_engine PRIVATE
  40. $<BUILD_INTERFACE:intf_pub>
  41. -Wl,--no-as-needed
  42. ascend_protobuf
  43. c_sec
  44. graph
  45. slog
  46. -Wl,--as-needed
  47. )
  48. ############ atcstub/libhost_cpu_engine.so ############
  49. add_library(atc_host_cpu_engine SHARED ${SRC_LIST} ${PROTO_HDRS})
  50. target_compile_options(atc_host_cpu_engine PRIVATE
  51. -Werror
  52. -fno-common
  53. )
  54. target_compile_definitions(atc_host_cpu_engine PRIVATE
  55. COMPILE_OMG_PACKAGE
  56. google=ascend_private
  57. )
  58. target_include_directories(atc_host_cpu_engine PRIVATE
  59. ${CMAKE_CURRENT_LIST_DIR}
  60. ${GE_CODE_DIR}/ge
  61. ${GE_CODE_DIR}/inc
  62. ${GE_CODE_DIR}/inc/external
  63. ${GE_CODE_DIR}/inc/framework
  64. ${METADEF_DIR}/inc
  65. ${METADEF_DIR}/inc/external
  66. ${METADEF_DIR}/inc/external/graph
  67. ${CMAKE_BINARY_DIR}
  68. ${CMAKE_BINARY_DIR}/proto/ge
  69. #### yellow zone ####
  70. ${GE_CODE_DIR}/../inc
  71. #### blue zone ####
  72. ${GE_CODE_DIR}/third_party/fwkacllib/inc
  73. )
  74. target_link_libraries(atc_host_cpu_engine PRIVATE
  75. $<BUILD_INTERFACE:intf_pub>
  76. -Wl,--no-as-needed
  77. ascend_protobuf
  78. c_sec
  79. graph
  80. slog
  81. -Wl,--as-needed
  82. )
  83. set_target_properties(atc_host_cpu_engine PROPERTIES
  84. OUTPUT_NAME host_cpu_engine
  85. LIBRARY_OUTPUT_DIRECTORY atclib
  86. )
  87. ############ libhost_cpu_opskernel_builder.so ############
  88. add_library(host_cpu_opskernel_builder SHARED ${CPU_OPS_KERNEL_LIST})
  89. target_compile_options(host_cpu_opskernel_builder PRIVATE
  90. -Werror
  91. -fno-common
  92. )
  93. target_compile_definitions(host_cpu_opskernel_builder PRIVATE
  94. google=ascend_private
  95. )
  96. target_include_directories(host_cpu_opskernel_builder PRIVATE
  97. ${CMAKE_CURRENT_LIST_DIR}
  98. ${GE_CODE_DIR}/ge
  99. ${GE_CODE_DIR}/inc
  100. ${GE_CODE_DIR}/inc/external
  101. ${GE_CODE_DIR}/inc/framework
  102. ${METADEF_DIR}/inc
  103. ${METADEF_DIR}/inc/external
  104. ${METADEF_DIR}/inc/external/graph
  105. ${CMAKE_BINARY_DIR}
  106. ${CMAKE_BINARY_DIR}/proto/ge
  107. #### yellow zone ####
  108. ${GE_CODE_DIR}/../inc
  109. #### blue zone ####
  110. ${GE_CODE_DIR}/third_party/fwkacllib/inc
  111. )
  112. target_link_libraries(host_cpu_opskernel_builder PRIVATE
  113. $<BUILD_INTERFACE:intf_pub>
  114. -Wl,--no-as-needed
  115. ascend_protobuf
  116. c_sec
  117. slog
  118. graph
  119. register
  120. -Wl,--as-needed
  121. )
  122. ############ atclib/libhost_cpu_opskernel_builder.so ############
  123. add_library(atc_host_cpu_opskernel_builder SHARED ${CPU_OPS_KERNEL_LIST})
  124. target_compile_options(atc_host_cpu_opskernel_builder PRIVATE
  125. -Werror
  126. -fno-common
  127. )
  128. target_compile_definitions(atc_host_cpu_opskernel_builder PRIVATE
  129. google=ascend_private
  130. )
  131. target_include_directories(atc_host_cpu_opskernel_builder PRIVATE
  132. ${CMAKE_CURRENT_LIST_DIR}
  133. ${GE_CODE_DIR}/ge
  134. ${GE_CODE_DIR}/inc
  135. ${GE_CODE_DIR}/inc/external
  136. ${GE_CODE_DIR}/inc/framework
  137. ${METADEF_DIR}/inc
  138. ${METADEF_DIR}/inc/external
  139. ${METADEF_DIR}/inc/external/graph
  140. ${CMAKE_BINARY_DIR}
  141. ${CMAKE_BINARY_DIR}/proto/ge
  142. #### yellow zone ####
  143. ${GE_CODE_DIR}/../inc
  144. #### blue zone ####
  145. ${GE_CODE_DIR}/third_party/fwkacllib/inc
  146. )
  147. target_link_libraries(atc_host_cpu_opskernel_builder PRIVATE
  148. $<BUILD_INTERFACE:intf_pub>
  149. -Wl,--no-as-needed
  150. ascend_protobuf
  151. c_sec
  152. slog
  153. graph
  154. register
  155. -Wl,--as-needed
  156. )
  157. set_target_properties(atc_host_cpu_opskernel_builder PROPERTIES
  158. OUTPUT_NAME host_cpu_opskernel_builder
  159. LIBRARY_OUTPUT_DIRECTORY atclib
  160. )
  161. ############ libhost_cpu_opskernel_builder.a ############
  162. add_library(host_cpu_opskernel_builder_static STATIC ${CPU_OPS_KERNEL_LIST})
  163. target_compile_options(host_cpu_opskernel_builder_static PRIVATE
  164. -Werror
  165. -fno-common
  166. )
  167. target_compile_definitions(host_cpu_opskernel_builder_static PRIVATE
  168. google=ascend_private
  169. LOG_CPP
  170. )
  171. target_include_directories(host_cpu_opskernel_builder_static PRIVATE
  172. ${CMAKE_CURRENT_LIST_DIR}
  173. ${GE_CODE_DIR}/ge
  174. ${GE_CODE_DIR}/inc
  175. ${GE_CODE_DIR}/inc/external
  176. ${GE_CODE_DIR}/inc/framework
  177. ${METADEF_DIR}/inc
  178. ${METADEF_DIR}/inc/external
  179. ${METADEF_DIR}/inc/external/graph
  180. ${CMAKE_BINARY_DIR}
  181. ${CMAKE_BINARY_DIR}/proto/ge
  182. #### yellow zone ####
  183. ${GE_CODE_DIR}/../inc
  184. #### blue zone ####
  185. ${GE_CODE_DIR}/third_party/fwkacllib/inc
  186. )
  187. target_link_libraries(host_cpu_opskernel_builder_static PRIVATE
  188. $<BUILD_INTERFACE:intf_pub>
  189. ascend_protobuf
  190. c_sec
  191. )
  192. ############ install ############
  193. set(INSTALL_BASE_DIR "")
  194. set(INSTALL_LIBRARY_DIR lib)
  195. install(TARGETS host_cpu_engine host_cpu_opskernel_builder OPTIONAL
  196. LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
  197. )
  198. install(TARGETS atc_host_cpu_engine atc_host_cpu_opskernel_builder OPTIONAL
  199. LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/atclib
  200. )

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