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

4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. set(PROTO_LIST
  2. "${METADEF_DIR}/proto/om.proto"
  3. "${METADEF_DIR}/proto/ge_ir.proto"
  4. "${METADEF_DIR}/proto/insert_op.proto"
  5. "${METADEF_DIR}/proto/task.proto"
  6. "${METADEF_DIR}/proto/tensorflow/attr_value.proto"
  7. "${METADEF_DIR}/proto/tensorflow/function.proto"
  8. "${METADEF_DIR}/proto/tensorflow/graph.proto"
  9. "${METADEF_DIR}/proto/tensorflow/node_def.proto"
  10. "${METADEF_DIR}/proto/tensorflow/op_def.proto"
  11. "${METADEF_DIR}/proto/tensorflow/resource_handle.proto"
  12. "${METADEF_DIR}/proto/tensorflow/tensor.proto"
  13. "${METADEF_DIR}/proto/tensorflow/tensor_shape.proto"
  14. "${METADEF_DIR}/proto/tensorflow/types.proto"
  15. "${METADEF_DIR}/proto/tensorflow/versions.proto"
  16. )
  17. protobuf_generate(ge PROTO_SRCS PROTO_HDRS ${PROTO_LIST})
  18. set(SRC_LIST
  19. "context/ctx.cc"
  20. "model_saver.cc"
  21. "ge/datatype_util.cc"
  22. "helper/om_file_helper.cc"
  23. "helper/model_helper.cc"
  24. "../model/ge_model.cc"
  25. "auth/file_saver.cc"
  26. "fp16_t.cc"
  27. "math/fp16_math.cc"
  28. "debug/memory_dumper.cc"
  29. "formats/utils/formats_trans_utils.cc"
  30. "dump/dump_properties.cc"
  31. "formats/format_transfers/datatype_transfer.cc"
  32. "formats/format_transfers/format_transfer_transpose.cc"
  33. "formats/format_transfers/format_transfer_nchw_nc1hwc0.cc"
  34. "formats/format_transfers/format_transfer_fractal_z.cc"
  35. "formats/format_transfers/format_transfer_fractal_nz.cc"
  36. "formats/format_transfers/format_transfer_fractal_zz.cc"
  37. "formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc"
  38. "formats/format_transfers/format_transfer_nc1hwc0_nchw.cc"
  39. "formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc"
  40. "formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc"
  41. "formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc"
  42. "formats/format_transfers/format_transfer_fracz_nchw.cc"
  43. "formats/format_transfers/format_transfer_fracz_nhwc.cc"
  44. "formats/format_transfers/format_transfer_fracz_hwcn.cc"
  45. "formats/format_transfers/format_transfer_dhwcn_fracz3D.cc"
  46. "formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.cc"
  47. "formats/format_transfers/format_transfer_nchw_fz_c04.cc"
  48. "formats/formats.cc"
  49. "ge_format_util.cc"
  50. "fmk_error_codes.cc"
  51. "util.cc"
  52. "properties_manager.cc"
  53. "types.cc"
  54. "model_parser/base.cc"
  55. "kernel_store.cc"
  56. "tbe_kernel_store.cc"
  57. "cust_aicpu_kernel_store.cc"
  58. "op/attr_value_util.cc"
  59. "op/ge_op_utils.cc"
  60. "thread_pool.cc"
  61. "ge/tbe_plugin_manager.cc"
  62. )
  63. ############ libge_common.so ############
  64. add_library(ge_common SHARED ${SRC_LIST} ${PROTO_HDRS})
  65. target_compile_definitions(ge_common PRIVATE
  66. PROTOBUF_INLINE_NOT_IN_HEADERS=0
  67. HOST_VISIBILITY
  68. FMK_SUPPORT_DUMP
  69. OS_CENTOS
  70. )
  71. target_compile_options(ge_common PRIVATE
  72. -fvisibility=hidden
  73. -O2
  74. -Werror
  75. )
  76. target_include_directories(ge_common PRIVATE
  77. ${GE_CODE_DIR}/ge
  78. ${GE_CODE_DIR}/ge/common
  79. ${GE_CODE_DIR}/ge/common/op
  80. ${GE_CODE_DIR}/inc/external
  81. ${GE_CODE_DIR}/inc
  82. ${GE_CODE_DIR}/inc/framework
  83. ${METADEF_DIR}/inc
  84. ${METADEF_DIR}/inc/external
  85. ${METADEF_DIR}/inc/external/graph
  86. ${METADEF_DIR}/inc/graph
  87. ${CMAKE_BINARY_DIR}
  88. ${CMAKE_BINARY_DIR}/proto/ge
  89. #### yellow zone ####
  90. ${GE_DEPEND_DIR}/inc
  91. ${GE_DEPEND_DIR}/inc/cce
  92. #### blue zone ####
  93. #${GE_DEPEND_DIR}/include
  94. )
  95. target_link_libraries(ge_common PRIVATE
  96. $<BUILD_INTERFACE:intf_pub>
  97. -Wl,--no-as-needed
  98. graph
  99. protobuf
  100. register
  101. c_sec
  102. error_manager
  103. slog
  104. mmpa
  105. -Wl,--as-needed
  106. json
  107. -lrt
  108. -ldl
  109. )
  110. ############ libge_common.a ############
  111. add_library(ge_common_static STATIC ${SRC_LIST} ${PROTO_HDRS})
  112. target_compile_definitions(ge_common_static PRIVATE
  113. PROTOBUF_INLINE_NOT_IN_HEADERS=0
  114. HOST_VISIBILITY
  115. FMK_SUPPORT_DUMP
  116. OS_CENTOS
  117. )
  118. target_compile_options(ge_common_static PRIVATE
  119. -fvisibility=hidden
  120. -O2
  121. -Werror
  122. )
  123. target_include_directories(ge_common_static PRIVATE
  124. ${GE_CODE_DIR}/ge
  125. ${GE_CODE_DIR}/ge/common
  126. ${GE_CODE_DIR}/ge/common/op
  127. ${GE_CODE_DIR}/inc
  128. ${GE_CODE_DIR}/inc/external
  129. ${GE_CODE_DIR}/inc/framework
  130. ${METADEF_DIR}/inc
  131. ${METADEF_DIR}/inc/external
  132. ${METADEF_DIR}/inc/external/graph
  133. ${METADEF_DIR}/inc/graph
  134. ${CMAKE_BINARY_DIR}
  135. ${CMAKE_BINARY_DIR}/proto/ge
  136. #### yellow zone ####
  137. ${GE_DEPEND_DIR}/inc
  138. ${GE_DEPEND_DIR}/inc/cce
  139. #### blue zone ####
  140. #${GE_DEPEND_DIR}/include
  141. )
  142. target_link_libraries(ge_common_static PRIVATE
  143. $<BUILD_INTERFACE:intf_pub>
  144. protobuf
  145. json
  146. c_sec
  147. -lrt
  148. -ldl
  149. )
  150. ############ install ############
  151. set(INSTALL_BASE_DIR "")
  152. set(INSTALL_LIBRARY_DIR lib)
  153. install(TARGETS ge_common OPTIONAL
  154. LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
  155. )

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