diff --git a/cmake/dependency_graphengine.cmake b/cmake/dependency_graphengine.cmake index 7bc20c25329..0571a617c47 100644 --- a/cmake/dependency_graphengine.cmake +++ b/cmake/dependency_graphengine.cmake @@ -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() diff --git a/cmake/external_libs/protobuf.cmake b/cmake/external_libs/protobuf.cmake index c7d786bd3c2..1d280d6d0c0 100644 --- a/cmake/external_libs/protobuf.cmake +++ b/cmake/external_libs/protobuf.cmake @@ -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") diff --git a/cmake/package.cmake b/cmake/package.cmake index abcc079746f..1dea798cce4 100644 --- a/cmake/package.cmake +++ b/cmake/package.cmake @@ -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( diff --git a/cmake/package_acl.cmake b/cmake/package_acl.cmake index 892c221a994..fe53a468142 100644 --- a/cmake/package_acl.cmake +++ b/cmake/package_acl.cmake @@ -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) diff --git a/mindspore/ccsrc/cxx_api/CMakeLists.txt b/mindspore/ccsrc/cxx_api/CMakeLists.txt index 846c59ef25f..756f7161afe 100644 --- a/mindspore/ccsrc/cxx_api/CMakeLists.txt +++ b/mindspore/ccsrc/cxx_api/CMakeLists.txt @@ -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" diff --git a/mindspore/ccsrc/runtime/device/CMakeLists.txt b/mindspore/ccsrc/runtime/device/CMakeLists.txt index 447486b2661..68534970005 100644 --- a/mindspore/ccsrc/runtime/device/CMakeLists.txt +++ b/mindspore/ccsrc/runtime/device/CMakeLists.txt @@ -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() diff --git a/mindspore/ccsrc/runtime/hccl_adapter/CMakeLists.txt b/mindspore/ccsrc/runtime/hccl_adapter/CMakeLists.txt index 56ca615137a..e42585b745c 100644 --- a/mindspore/ccsrc/runtime/hccl_adapter/CMakeLists.txt +++ b/mindspore/ccsrc/runtime/hccl_adapter/CMakeLists.txt @@ -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() \ No newline at end of file diff --git a/mindspore/ccsrc/runtime/hccl_adapter/plugin/CMakeLists.txt b/mindspore/ccsrc/runtime/hccl_adapter/plugin/CMakeLists.txt index da3dc079f1f..bb4e203620d 100644 --- a/mindspore/ccsrc/runtime/hccl_adapter/plugin/CMakeLists.txt +++ b/mindspore/ccsrc/runtime/hccl_adapter/plugin/CMakeLists.txt @@ -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)