!18368 cpack without ge

Merge pull request !18368 from zhoufeng/cpack-without-ge
This commit is contained in:
i-robot 2021-06-16 16:40:59 +08:00 committed by Gitee
commit e7e1e421bc
8 changed files with 38 additions and 52 deletions

View File

@ -16,7 +16,13 @@ function(find_submodule_lib module name path)
)
endfunction()
if(MODE_ASCEND_ALL OR MODE_ASCEND_ACL OR ENABLE_TESTCASES)
function(ge_protobuf_generate c_var h_var)
common_protobuf_generate(${CMAKE_BINARY_DIR}/proto/ge/proto ${c_var} ${h_var} ${ARGN})
set(${c_var} ${${c_var}} PARENT_SCOPE)
set(${h_var} ${${h_var}} PARENT_SCOPE)
endfunction()
if(ENABLE_TESTCASES)
set(_ge_tmp_CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
set(_ge_tmp_ENABLE_GITEE ${ENABLE_GITEE})
set(_ge_tmp_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
@ -38,6 +44,19 @@ if(MODE_ASCEND_ALL OR MODE_ASCEND_ACL OR ENABLE_TESTCASES)
set(CMAKE_INSTALL_PREFIX ${_ge_tmp_CMAKE_INSTALL_PREFIX})
set(ENABLE_GITEE ${_ge_tmp_ENABLE_GITEE})
set(CMAKE_CXX_FLAGS ${_ge_tmp_CMAKE_CXX_FLAGS})
elseif(MODE_ASCEND_ALL OR MODE_ASCEND_ACL)
file(GLOB_RECURSE GE_PROTO_FILE RELATIVE ${CMAKE_SOURCE_DIR} "graphengine/metadef/proto/*.proto")
set(TMP_FILE_NAME_LIST)
foreach(file ${GE_PROTO_FILE})
get_filename_component(file_name ${file} NAME_WE)
list(FIND TMP_FILE_NAME_LIST ${file_name} OUT_VAR)
if(NOT ${OUT_VAR} EQUAL "-1")
list(REMOVE_ITEM GE_PROTO_FILE ${file})
endif()
list(APPEND TMP_FILE_NAME_LIST ${file_name})
endforeach()
ge_protobuf_generate(GE_PROTO_SRCS GE_PROTO_HDRS ${GE_PROTO_FILE})
add_library(graph SHARED ${GE_PROTO_SRCS})
else()
message(FATAL_ERROR "No compile option defined for GraphEngine, exiting")
endif()

View File

@ -45,7 +45,7 @@ include_directories(${protobuf_INC})
add_library(mindspore::protobuf ALIAS protobuf::protobuf)
set(CMAKE_CXX_FLAGS ${_ms_tmp_CMAKE_CXX_FLAGS})
function(ms_protobuf_generate c_var h_var)
function(common_protobuf_generate path c_var h_var)
if(NOT ARGN)
message(SEND_ERROR "Error: ms_protobuf_generate() called without any proto files")
return()
@ -60,15 +60,13 @@ function(ms_protobuf_generate c_var h_var)
get_filename_component(file_dir ${abs_file} PATH)
file(RELATIVE_PATH rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${file_dir})
list(APPEND ${c_var} "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.cc")
list(APPEND ${h_var} "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.h")
list(APPEND ${c_var} "${path}/${file_name}.pb.cc")
list(APPEND ${h_var} "${path}/${file_name}.pb.h")
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.cc"
"${CMAKE_BINARY_DIR}/proto/${file_name}.pb.h"
OUTPUT "${path}/${file_name}.pb.cc" "${path}/${file_name}.pb.h"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/proto"
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${CMAKE_BINARY_DIR}/proto ${abs_file}
COMMAND ${CMAKE_COMMAND} -E make_directory "${path}"
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${path} ${abs_file}
DEPENDS protobuf::protoc ${abs_file}
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM)
endforeach()
@ -78,6 +76,12 @@ function(ms_protobuf_generate c_var h_var)
set(${h_var} ${${h_var}} PARENT_SCOPE)
endfunction()
function(ms_protobuf_generate c_var h_var)
common_protobuf_generate(${CMAKE_BINARY_DIR}/proto ${c_var} ${h_var} ${ARGN})
set(${c_var} ${${c_var}} PARENT_SCOPE)
set(${h_var} ${${h_var}} PARENT_SCOPE)
endfunction()
function(ms_protobuf_generate_py c_var h_var py_var)
if(NOT ARGN)
message(SEND_ERROR "Error: ms_protobuf_generate() called without any proto files")

View File

@ -227,12 +227,6 @@ if(NOT ENABLE_GE)
endif()
set(ASCEND_DRIVER_PATH ${ASCEND_PATH}/driver/lib64/common)
install(
FILES ${CMAKE_SOURCE_DIR}/build/graphengine/c_sec/lib/libc_sec.so
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
if(ENABLE_D)
install(
TARGETS ms_profile
@ -245,14 +239,6 @@ if(NOT ENABLE_GE)
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
install(
FILES
${CMAKE_BINARY_DIR}/graphengine/metadef/graph/libgraph.so
${CMAKE_BINARY_DIR}/graphengine/ge/common/libge_common.so
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
endif()
elseif(ENABLE_TESTCASES)
install(

View File

@ -122,19 +122,6 @@ if(ENABLE_CPU)
)
endif()
# ENABLE_D remnants
if(DEFINED ENV{ASCEND_CUSTOM_PATH})
set(ASCEND_PATH $ENV{ASCEND_CUSTOM_PATH})
else()
set(ASCEND_PATH /usr/local/Ascend)
endif()
set(ASCEND_DRIVER_PATH ${ASCEND_PATH}/driver/lib64/common)
install(
FILES ${CMAKE_SOURCE_DIR}/build/graphengine/c_sec/lib/libc_sec.so
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
if(MS_BUILD_GRPC)
install(FILES ${grpc_LIBPATH}/libmindspore_grpc++.so.1.27.3
DESTINATION ${INSTALL_LIB_DIR} RENAME libmindspore_grpc++.so.1 COMPONENT mindspore)

View File

@ -8,10 +8,9 @@ file(GLOB_RECURSE API_OPS_SRC ${CMAKE_CURRENT_SOURCE_DIR} "ops/*.cc")
if(ENABLE_D OR ENABLE_ACL)
# build 910 and 310 code into one distro, files needed for 310 mode
add_compile_definitions(ENABLE_ACL)
include_directories(${CMAKE_SOURCE_DIR}/graphengine/ge
${CMAKE_BINARY_DIR}/proto/graphengine_protos
${CMAKE_BINARY_DIR}/proto/metadef_protos
)
include_directories(${CMAKE_SOURCE_DIR}/graphengine/ge)
include_directories(${CMAKE_BINARY_DIR}/proto/ge)
file(GLOB_RECURSE API_ACL_SRC ${CMAKE_CURRENT_SOURCE_DIR}
"akg_kernel_register.cc"
"model/acl/*.cc"

View File

@ -82,9 +82,6 @@ add_library(_mindspore_runtime_device_obj OBJECT ${DEVICE_SRC_LIST} ${D_SRC_LIST
if(ENABLE_D)
file(GLOB_RECURSE GE_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "ascend/ge_runtime/*.cc")
set_property(SOURCE ${GE_SRC_LIST} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_GE)
target_include_directories(_mindspore_runtime_device_obj PRIVATE
${CMAKE_BINARY_DIR}/proto/graphengine_protos
${CMAKE_BINARY_DIR}/proto/metadef_protos
)
target_include_directories(_mindspore_runtime_device_obj PRIVATE ${CMAKE_BINARY_DIR}/proto/ge)
add_dependencies(_mindspore_runtime_device_obj graph)
endif()

View File

@ -3,10 +3,7 @@ set_property(SOURCE ${HCCL_ADAPTER_SRC_LIST} PROPERTY COMPILE_DEFINITIONS
SUBMODULE_ID=mindspore::SubModuleId::SM_HCCL_ADPT)
if(ENABLE_D)
add_library(_mindspore_runtime_hccl_adapter_obj OBJECT ${HCCL_ADAPTER_SRC_LIST})
target_include_directories(_mindspore_runtime_hccl_adapter_obj PRIVATE
${CMAKE_BINARY_DIR}/proto/graphengine_protos
${CMAKE_BINARY_DIR}/proto/metadef_protos
)
target_include_directories(_mindspore_runtime_hccl_adapter_obj PRIVATE ${CMAKE_BINARY_DIR}/proto/ge)
add_dependencies(_mindspore_runtime_hccl_adapter_obj graph)
add_subdirectory(plugin)
endif()

View File

@ -1,8 +1,5 @@
add_library(hccl_plugin SHARED hccl_plugin.cc)
target_include_directories(hccl_plugin PRIVATE
${CMAKE_BINARY_DIR}/proto/graphengine_protos
${CMAKE_BINARY_DIR}/proto/metadef_protos
)
target_include_directories(hccl_plugin PRIVATE ${CMAKE_BINARY_DIR}/proto/ge)
add_dependencies(hccl_plugin graph)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/nnae/latest/fwkacllib/lib64)