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.

protobuf_shared.cmake 2.8 kB

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
4 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. if (HAVE_PROTOBUF)
  2. return()
  3. endif()
  4. include(ExternalProject)
  5. include(GNUInstallDirs)
  6. if ((${CMAKE_INSTALL_PREFIX} STREQUAL /usr/local) OR
  7. (${CMAKE_INSTALL_PREFIX} STREQUAL "C:/Program Files (x86)/ascend"))
  8. set(CMAKE_INSTALL_PREFIX ${GE_CODE_DIR}/output CACHE STRING "path for install()" FORCE)
  9. message(STATUS "No install prefix selected, default to ${CMAKE_INSTALL_PREFIX}.")
  10. endif()
  11. if (ENABLE_GITEE)
  12. set(REQ_URL "https://gitee.com/mirrors/protobuf_source/repository/archive/v3.8.0.tar.gz")
  13. set(MD5 "eba86ae9f07ba5cfbaf8af3bc4e84236")
  14. else()
  15. set(REQ_URL "https://github.com/protocolbuffers/protobuf/archive/v3.8.0.tar.gz")
  16. set(MD5 "3d9e32700639618a4d2d342c99d4507a")
  17. endif ()
  18. set(protobuf_CXXFLAGS "-Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 -D_GLIBCXX_USE_CXX11_ABI=0 -O2 -Dgoogle=ascend_private")
  19. set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
  20. ExternalProject_Add(protobuf_build
  21. URL ${REQ_URL}
  22. CONFIGURE_COMMAND ${CMAKE_COMMAND}
  23. -Dprotobuf_WITH_ZLIB=OFF
  24. -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
  25. -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
  26. -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
  27. -DCMAKE_LINKER=${CMAKE_LINKER}
  28. -DCMAKE_AR=${CMAKE_AR}
  29. -DCMAKE_RANLIB=${CMAKE_RANLIB}
  30. -DLIB_PREFIX=ascend_
  31. -Dprotobuf_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_FLAGS=${protobuf_CXXFLAGS} -DCMAKE_CXX_LDFLAGS=${protobuf_LDFLAGS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/protobuf <SOURCE_DIR>/cmake
  32. BUILD_COMMAND $(MAKE)
  33. INSTALL_COMMAND $(MAKE) install
  34. EXCLUDE_FROM_ALL TRUE
  35. )
  36. include(GNUInstallDirs)
  37. set(PROTOBUF_SHARED_PKG_DIR ${CMAKE_INSTALL_PREFIX}/protobuf)
  38. add_library(ascend_protobuf SHARED IMPORTED)
  39. file(MAKE_DIRECTORY ${PROTOBUF_SHARED_PKG_DIR}/include)
  40. set_target_properties(ascend_protobuf PROPERTIES
  41. IMPORTED_LOCATION ${PROTOBUF_SHARED_PKG_DIR}/${CMAKE_INSTALL_LIBDIR}/libascend_protobuf.so
  42. )
  43. target_include_directories(ascend_protobuf INTERFACE ${PROTOBUF_SHARED_PKG_DIR}/include)
  44. set(INSTALL_BASE_DIR "")
  45. set(INSTALL_LIBRARY_DIR lib)
  46. install(FILES ${PROTOBUF_SHARED_PKG_DIR}/${CMAKE_INSTALL_LIBDIR}/ascend_protobuf.so.3.8.0.0 OPTIONAL
  47. DESTINATION ${INSTALL_LIBRARY_DIR})
  48. install(FILES ${PROTOBUF_SHARED_PKG_DIR}/${CMAKE_INSTALL_LIBDIR}/ascend_protobuf.so OPTIONAL
  49. DESTINATION ${INSTALL_LIBRARY_DIR})
  50. add_dependencies(ascend_protobuf protobuf_build)
  51. #set(HAVE_PROTOBUF TRUE CACHE BOOL "protobuf build add")
  52. set(HAVE_PROTOBUF TRUE)

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