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

5 years ago
4 years ago
5 years ago
4 years ago
4 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. cmake_minimum_required(VERSION 3.14)
  2. project (GraphEngine[CXX])
  3. set(GE_CODE_DIR ${CMAKE_CURRENT_LIST_DIR})
  4. set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE)
  5. if (NOT BUILD_PATH)
  6. set(BUILD_PATH "${CMAKE_SOURCE_DIR}/build")
  7. endif()
  8. option(ENABLE_OPEN_SRC "Enable graphengine compile in opensource." FALSE)
  9. if (ENABLE_OPEN_SRC)
  10. set(HI_PYTHON python3.7)
  11. include(cmake/external_libs/protobuf_shared.cmake)
  12. include(cmake/external_libs/protobuf_static.cmake)
  13. include(cmake/external_libs/protoc.cmake)
  14. include(cmake/external_libs/gflags.cmake)
  15. include(cmake/external_libs/securec.cmake)
  16. include(cmake/external_libs/json.cmake)
  17. include(cmake/FindModule.cmake)
  18. include(cmake/intf_pub_linux.cmake)
  19. # for CPU/GPU mode, find c_sec and slog from local prebuild
  20. #if(NOT ENABLE_D AND NOT GE_ONLY)
  21. # set(GE_PREBUILD_PATH ${GE_CODE_DIR}/third_party/prebuild/${CMAKE_HOST_SYSTEM_PROCESSOR})
  22. # find_module(slog libslog.so ${GE_PREBUILD_PATH})
  23. # if D_LINK_PATH is set in environment variables, search libraries in given path
  24. if(DEFINED ENV{D_LINK_PATH})
  25. # D_LINK_PATH is set
  26. set(GE_LIB_PATH $ENV{D_LINK_PATH})
  27. set(GE_SYS_ARCH "")
  28. if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64")
  29. # x86 ubuntu
  30. set(GE_SYS_ARCH "x86_64")
  31. elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "aarch64")
  32. # arm euleros
  33. set(GE_SYS_ARCH "aarch64")
  34. else()
  35. message(FATAL_ERROR "Running on a unsupported architecture: ${SYSTEM_TYPE}, build terminated")
  36. endif()
  37. set(GE_LIB_PATH ${GE_LIB_PATH}/${GE_SYS_ARCH})
  38. find_module(slog libslog.so ${GE_LIB_PATH})
  39. find_module(mmpa libmmpa.so ${GE_LIB_PATH})
  40. find_module(msprof libmsprof.so ${GE_LIB_PATH})
  41. find_module(hccl libhccl.so ${GE_LIB_PATH})
  42. find_module(adump_server libadump_server.a ${GE_LIB_PATH})
  43. find_module(runtime libruntime.so ${GE_LIB_PATH})
  44. find_module(runtime_compile libruntime_compile.so ${GE_LIB_PATH})
  45. find_module(resource libresource.so ${GE_LIB_PATH})
  46. find_module(error_manager liberror_manager.so ${GE_LIB_PATH})
  47. find_module(ascend_hal_stub libascend_hal.so ${GE_LIB_PATH})
  48. find_module(error_manager_static liberror_manager.a ${GE_LIB_PATH})
  49. find_module(msprofiler libmsprofiler.a ${GE_LIB_PATH})
  50. find_module(ascendcl_static libascendcl.a ${GE_LIB_PATH})
  51. else()
  52. if(DEFINED ENV{ASCEND_CUSTOM_PATH})
  53. set(ASCEND_DIR $ENV{ASCEND_CUSTOM_PATH})
  54. else()
  55. set(ASCEND_DIR /usr/local/Ascend)
  56. endif()
  57. set(ASCEND_DRIVER_DIR ${ASCEND_DIR}/driver/lib64)
  58. set(ASCEND_DRIVER_COMMON_DIR ${ASCEND_DIR}/driver/lib64/common)
  59. set(ASCEND_RUNTIME_DIR ${ASCEND_DIR}/fwkacllib/lib64)
  60. set(ASCEND_ATC_DIR ${ASCEND_DIR}/atc/lib64)
  61. set(ASCEND_ACL_DIR ${ASCEND_DIR}/acllib/lib64)
  62. if(PLATFORM STREQUAL "train")
  63. find_module(slog libslog.so ${ASCEND_ATC_DIR})
  64. find_module(mmpa libmmpa.so ${ASCEND_ATC_DIR})
  65. find_module(msprof libmsprof.so ${ASCEND_DRIVER_COMMON_DIR})
  66. find_module(hccl libhccl.so ${ASCEND_RUNTIME_DIR})
  67. find_module(adump_server libadump_server.a ${ASCEND_RUNTIME_DIR})
  68. find_module(runtime libruntime.so ${ASCEND_RUNTIME_DIR})
  69. find_module(resource libresource.so ${ASCEND_RUNTIME_DIR})
  70. find_module(error_manager liberror_manager.so ${ASCEND_RUNTIME_DIR})
  71. find_module(msprofiler libmsprofiler.a ${ASCEND_RUNTIME_DIR})
  72. find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR}/driver)
  73. if(PRODUCT STREQUAL "flr3")
  74. message(FATAL_ERROR "This platform is not supported in train mode, build terminated")
  75. endif()
  76. elseif(PLATFORM STREQUAL "inference")
  77. find_module(slog libslog.so ${ASCEND_ATC_DIR})
  78. find_module(mmpa libmmpa.so ${ASCEND_ATC_DIR})
  79. find_module(adump_server libadump_server.a ${ASCEND_ACL_DIR})
  80. find_module(runtime libruntime.so ${ASCEND_ACL_DIR})
  81. find_module(runtime_compile libruntime_compile.so ${ASCEND_ATC_DIR})
  82. find_module(resource libresource.so ${ASCEND_ATC_DIR})
  83. find_module(error_manager liberror_manager.so ${ASCEND_ATC_DIR})
  84. find_module(error_manager_static liberror_manager.a ${ASCEND_ACL_DIR})
  85. find_module(msprofiler libmsprofiler.a ${ASCEND_ACL_DIR})
  86. find_module(ascendcl_static libascendcl.a ${ASCEND_ACL_DIR})
  87. if(NOT PRODUCT STREQUAL "flr3")
  88. find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR})
  89. find_module(msprof libmsprof.so ${ASCEND_DRIVER_DIR})
  90. else()
  91. find_module(msprof libmsprof.so ${ASCEND_ATC_DIR})
  92. endif()
  93. elseif(PLATFORM STREQUAL "all")
  94. find_module(slog libslog.so ${ASCEND_DRIVER_DIR})
  95. find_module(mmpa libmmpa.so ${ASCEND_DRIVER_DIR})
  96. find_module(msprof libmsprof.so ${ASCEND_DRIVER_DIR})
  97. find_module(hccl libhccl.so ${ASCEND_RUNTIME_DIR})
  98. find_module(adump_server libadump_server.a ${ASCEND_RUNTIME_DIR})
  99. find_module(runtime libruntime.so ${ASCEND_RUNTIME_DIR})
  100. find_module(runtime_compile libruntime_compile.so ${ASCEND_ATC_DIR})
  101. find_module(resource libresource.so ${ASCEND_RUNTIME_DIR})
  102. find_module(error_manager liberror_manager.so ${ASCEND_RUNTIME_DIR})
  103. find_module(error_manager_static liberror_manager.a ${ASCEND_ACL_DIR})
  104. find_module(msprofiler libmsprofiler.a ${ASCEND_RUNTIME_DIR})
  105. find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR})
  106. find_module(ascendcl_static libascendcl.a ${ASCEND_ACL_DIR})
  107. else()
  108. message(FATAL_ERROR "PLATFORM param is invalid, should be train or inference, build terminated")
  109. endif()
  110. endif()
  111. set(METADEF_DIR ${CMAKE_CURRENT_LIST_DIR}/metadef)
  112. set(PARSER_DIR ${CMAKE_CURRENT_LIST_DIR}/parser)
  113. set(GE_DEPEND_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
  114. add_subdirectory(metadef)
  115. add_subdirectory(parser)
  116. #add_subdirectory(metadef/graph)
  117. #add_subdirectory(metadef/register)
  118. else()
  119. set(METADEF_DIR ${CMAKE_CURRENT_LIST_DIR}/../metadef)
  120. set(PARSER_DIR ${CMAKE_CURRENT_LIST_DIR}/../parser)
  121. set(GE_DEPEND_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
  122. endif()
  123. add_subdirectory(ge)

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