代码拉取完成,页面将自动刷新
同步操作将从 Ascend/torchair 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
cmake_minimum_required(VERSION 3.14)
project(AscendAdapter2)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "-D_FORTIFY_SOURCE=2 -Wno-class-memaccess -Wno-float-equal -Wextra -Wno-unused-parameter -Wno-ignored-qualifiers -Wno-comment -Wno-deprecated-declarations -Wall -fPIC -fPIE -pie -s -fstack-protector-all -Wl,--no-as-needed -Wl,-z,relro,-z,now,-z,noexecstack -fno-common -pipe -fno-strict-aliasing -Wdate-time -Wformat=2 -Wno-shadow -Wno-undef -Wunused -Wdelete-non-virtual-dtor -Wnon-virtual-dtor -Wno-overloaded-virtual ${CMAKE_CXX_FLAGS}")
set(CMAKE_SKIP_RPATH TRUE)
set(ALLOWED_BUILD_TYPES "DEBUG" "GCOV" "RELEASE" CACHE STRING "Allowed build types")
set_property(CACHE ALLOWED_BUILD_TYPES PROPERTY STRINGS "DEBUG" "GCOV" "RELEASE")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RELEASE)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "DEBUG")
message("Configuring for DEBUG build")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0")
elseif(CMAKE_BUILD_TYPE STREQUAL "GCOV")
message("Configuring for GCOV build")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage -fprofile-arcs -ftest-coverage")
elseif(CMAKE_BUILD_TYPE STREQUAL "RELEASE")
message("Configuring for RELEASE build")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -DNDEBUG")
endif()
set(TORCHAIR_SRC_DIR ${CMAKE_CURRENT_LIST_DIR})
IF (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
add_definitions(-Wno-builtin-macro-redefined)
ENDIF ()
if (NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/tools/COMPILE_FLAGS OR NOT EXISTS
${CMAKE_CURRENT_LIST_DIR}/tools/TORCH_INSTALLED_PATH OR NOT EXISTS
${CMAKE_CURRENT_LIST_DIR}/tools/PYTHON_BIN_PATH)
message(FATAL_ERROR "No validate configuration found. Did you forget to configure first?")
endif ()
file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/tools/TORCH_INSTALLED_PATH" TORCH_INSTALLED_PATH)
file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/tools/PYTHON_BIN_PATH" PYTHON_BIN_PATH)
file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/tools/COMPILE_FLAGS" CUSTOM_COMPILE_FLAGS)
if (NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/tools/ASCEND_SDK_PATH)
set(ASCEND_SDK_HEADERS_PATH ${CMAKE_CURRENT_LIST_DIR}/third_party/ascend)
else()
file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/tools/ASCEND_SDK_PATH" ASCEND_SDK_HEADERS_PATH)
endif ()
include(${CMAKE_CURRENT_LIST_DIR}/cmake/secure_c.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/metadef/module.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/graph_engine/module.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/acl/module.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/aoe/module.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/hccl/module.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/pytorch/module.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/torch_npu/module.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/ascend_protobuf.cmake)
add_subdirectory(codegen)
add_custom_command(OUTPUT AUTO_GENERATED_GE_RAW_OPS
COMMAND code_generator ${CMAKE_CURRENT_LIST_DIR}/python/torchair/ge_concrete_graph/auto_generated_ge_raw_ops.py
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
COMMENT "Generating ge apis"
DEPENDS code_generator
VERBATIM)
add_custom_target(generate_ge_raw_ops ALL
DEPENDS AUTO_GENERATED_GE_RAW_OPS
VERBATIM)
add_custom_target(copy_pyfiles ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_LIST_DIR}/python ${CMAKE_BINARY_DIR}/dist
COMMENT "Copy pthon files"
VERBATIM)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/stubs)
add_subdirectory(torchair)
add_custom_target(torchair ALL
COMMAND cd ${CMAKE_BINARY_DIR}/dist/ && ${PYTHON_BIN_PATH} setup.py bdist_wheel
DEPENDS _torchair _npu_graph_executor copy_pyfiles
VERBATIM)
if (DEFINED TORCHAIR_INSTALL_DST)
add_custom_target(install_torchair ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/dist/torchair ${TORCHAIR_INSTALL_DST}
DEPENDS _torchair _npu_graph_executor copy_pyfiles
VERBATIM)
else()
add_custom_target(install_torchair ALL
COMMAND ${PYTHON_BIN_PATH} -m pip install ${CMAKE_BINARY_DIR}/dist/dist/torchair-0.1-py3-none-any.whl --force-reinstall
DEPENDS torchair
VERBATIM)
endif()
install(CODE "execute_process(COMMAND ${PYTHON_BIN_PATH} -m pip install ${CMAKE_BINARY_DIR}/dist/dist/torchair-0.1-py3-none-any.whl --upgrade)")
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。