From 3baf37bf1342a26e1c353c4df2c5c02dfb7b4a61 Mon Sep 17 00:00:00 2001 From: zhoufeng Date: Thu, 3 Dec 2020 09:29:32 +0800 Subject: [PATCH] fix type of exception Signed-off-by: zhoufeng --- cmake/package.cmake | 2 +- mindspore/ccsrc/CMakeLists.txt | 19 ++++++------------- mindspore/ccsrc/cxx_api/CMakeLists.txt | 1 - .../ccsrc/runtime/hccl_adapter/CMakeLists.txt | 9 ++++----- 4 files changed, 11 insertions(+), 20 deletions(-) diff --git a/cmake/package.cmake b/cmake/package.cmake index d818f01a573..0d309b3aafe 100644 --- a/cmake/package.cmake +++ b/cmake/package.cmake @@ -217,7 +217,7 @@ if (NOT ENABLE_GE) if (ENABLE_D) install( - TARGETS ms_profile hccl_adapter + TARGETS ms_profile DESTINATION ${INSTALL_LIB_DIR} COMPONENT mindspore ) diff --git a/mindspore/ccsrc/CMakeLists.txt b/mindspore/ccsrc/CMakeLists.txt index 9045581c660..847e68923f3 100644 --- a/mindspore/ccsrc/CMakeLists.txt +++ b/mindspore/ccsrc/CMakeLists.txt @@ -162,6 +162,7 @@ set(SUB_COMP backend/kernel_compiler backend/session runtime/device + runtime/hccl_adapter frontend/optimizer frontend/parallel frontend/operator @@ -239,17 +240,16 @@ if (ENABLE_D) find_library(PROFILING_SHARED msprof ${ASCEND_DRIVER_PATH}) find_library(REGISTER register ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH}) find_library(OPTILING optiling ${ASCEND_OPP_PATH}) + # hccl_adpter + find_library(HCCL_ADPTER hcom_graph_adaptor ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH}) + find_library(HCCL_BUILDER hcom_opskernel_builder ${ASCEND_RUNTIME_PATH}/plugin/opskernel ${ASCEND_TOOLKIT_RUNTIME_PATH}/plugin/opskernel) + add_library(ms_profile SHARED ${PROFILING}) set_target_properties(ms_profile PROPERTIES LINKER_LANGUAGE CXX) target_link_libraries(ms_profile -Wl,--start-group ${PROFILING_SHARED} ${PROFILING} mindspore::protobuf -Wl,--end-group) target_link_libraries(mindspore ms_profile ge_runtime ${CCE_LIB} ${RUNTIME_LIB} ${TSDCLIENT} ${HCCL} ${DATATRANSFER} - ${REGISTER} -Wl,--no-as-needed ${OPTILING}) + ${HCCL_ADPTER} ${REGISTER} -Wl,--no-as-needed ${OPTILING} ${HCCL_BUILDER}) target_link_libraries(mindspore -Wl,--start-group proto_input mindspore::protobuf -Wl,--end-group) - # hccl_adpter - find_library(HCCL_ADPTER hcom_graph_adaptor ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH}) - find_library(HCCL_BUILDER hcom_opskernel_builder ${ASCEND_RUNTIME_PATH}/plugin/opskernel ${ASCEND_TOOLKIT_RUNTIME_PATH}/plugin/opskernel) - add_subdirectory(runtime/hccl_adapter) - target_link_libraries(hccl_adapter PRIVATE mindspore ${HCCL_ADPTER} ${REGISTER} -Wl,--no-as-needed ${HCCL_BUILDER}) elseif (CMAKE_SYSTEM_NAME MATCHES "Windows") target_link_libraries(mindspore -Wl,--start-group proto_input mindspore::protobuf mindspore::sentencepiece -Wl,--end-group) else () @@ -288,16 +288,10 @@ if (ENABLE_D) elseif (ENABLE_GPU) set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/cuda/lib64) endif () -set(HCCL_ADPT_RPATH ${ORIGIN_PATH}:${MINDSPORE_RPATH}) set(MINDSPORE_RPATH ${ORIGIN_PATH}/lib:${MINDSPORE_RPATH}) set_target_properties(_c_expression PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH}) -if (ENABLE_D) - set_target_properties(hccl_adapter PROPERTIES INSTALL_RPATH ${HCCL_ADPT_RPATH}) - target_link_libraries(_c_expression PRIVATE hccl_adapter) -endif () - if (CMAKE_SYSTEM_NAME MATCHES "Windows") target_link_libraries(mindspore mindspore::pybind11_module) target_link_libraries(mindspore mindspore_gvar) @@ -362,7 +356,6 @@ if (ENABLE_D) find_library(adump_server libadump_server.a ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH}) target_link_libraries(_c_expression PRIVATE ${adump_server}) target_link_libraries(inference PRIVATE ${adump_server}) - target_link_libraries(inference PRIVATE mindspore_core hccl_adapter) endif() if (ENABLE_CPU) diff --git a/mindspore/ccsrc/cxx_api/CMakeLists.txt b/mindspore/ccsrc/cxx_api/CMakeLists.txt index 0945f70e3b8..1eb169a689d 100644 --- a/mindspore/ccsrc/cxx_api/CMakeLists.txt +++ b/mindspore/ccsrc/cxx_api/CMakeLists.txt @@ -82,6 +82,5 @@ endif () if (ENABLE_D) find_library(adump_server libadump_server.a ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH}) target_link_libraries(mindspore_shared_lib PRIVATE ${adump_server}) - target_link_libraries(mindspore_shared_lib PRIVATE mindspore_core hccl_adapter) endif () diff --git a/mindspore/ccsrc/runtime/hccl_adapter/CMakeLists.txt b/mindspore/ccsrc/runtime/hccl_adapter/CMakeLists.txt index 5b313f52a33..523d18d68ec 100644 --- a/mindspore/ccsrc/runtime/hccl_adapter/CMakeLists.txt +++ b/mindspore/ccsrc/runtime/hccl_adapter/CMakeLists.txt @@ -1,8 +1,7 @@ file(GLOB_RECURSE HCCL_ADAPTER_SRC_LIST ./*.cc) set_property(SOURCE ${HCCL_ADAPTER_SRC_LIST} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_HCCL_ADPT) -add_library(hccl_adapter SHARED ${HCCL_ADAPTER_SRC_LIST}) -target_include_directories(hccl_adapter PRIVATE ${CMAKE_BINARY_DIR}/proto/ge) -add_dependencies(hccl_adapter graph) -if (CMAKE_SYSTEM_NAME MATCHES "Linux") - target_link_options(hccl_adapter PRIVATE -Wl,-init,mindspore_log_init) +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/ge) + add_dependencies(_mindspore_runtime_hccl_adapter_obj graph) endif () \ No newline at end of file