This commit is contained in:
lby 2022-08-16 13:06:27 +08:00
parent 2fcc176ae9
commit 787e66b422
4 changed files with 16 additions and 34 deletions

View File

@ -13,14 +13,6 @@ set(FBS_FILES
) )
ms_build_flatbuffers(FBS_FILES ${CMAKE_CURRENT_SOURCE_DIR}../../schema generated_fbs_files ${SERVER_FLATBUFFER_OUTPUT}) ms_build_flatbuffers(FBS_FILES ${CMAKE_CURRENT_SOURCE_DIR}../../schema generated_fbs_files ${SERVER_FLATBUFFER_OUTPUT})
if(ENABLE_D OR ENABLE_ACL)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/opp/op_impl/built-in/ai_core/tbe/op_tiling)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/nnae/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling)
set(MINDSPORE_RPATH
${MINDSPORE_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling)
endif()
## Function for setting NVCC flag ## Function for setting NVCC flag
function(set_nvcc_flag CUDA_NVCC_FLAGS) function(set_nvcc_flag CUDA_NVCC_FLAGS)
# Detect gpu archs by cudaGetDeviceProperties. # Detect gpu archs by cudaGetDeviceProperties.
@ -483,8 +475,6 @@ if(ENABLE_GPU)
target_link_libraries(mindspore_backend PRIVATE mindspore_gpu) target_link_libraries(mindspore_backend PRIVATE mindspore_gpu)
endif() endif()
set_target_properties(_c_expression PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH})
if(CMAKE_SYSTEM_NAME MATCHES "Windows") if(CMAKE_SYSTEM_NAME MATCHES "Windows")
target_link_libraries(mindspore PUBLIC mindspore::pybind11_module) target_link_libraries(mindspore PUBLIC mindspore::pybind11_module)
target_link_libraries(_c_expression PRIVATE -Wl,--whole-archive mindspore -Wl,--no-whole-archive mindspore_core target_link_libraries(_c_expression PRIVATE -Wl,--whole-archive mindspore -Wl,--no-whole-archive mindspore_core
@ -506,6 +496,7 @@ else()
target_link_libraries(_c_expression PRIVATE mindspore::pybind11_module) target_link_libraries(_c_expression PRIVATE mindspore::pybind11_module)
endif() endif()
set_target_properties(_c_expression PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH})
if(USE_GLOG) if(USE_GLOG)
target_link_libraries(_c_expression PRIVATE mindspore::glog) target_link_libraries(_c_expression PRIVATE mindspore::glog)
endif() endif()
@ -514,11 +505,6 @@ if(ENABLE_GPU)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries(_c_expression PRIVATE mindspore::ssl mindspore::crypto) target_link_libraries(_c_expression PRIVATE mindspore::ssl mindspore::crypto)
endif() endif()
if(ENABLE_MPI)
set_target_properties(_ms_mpi PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH})
set_target_properties(nvidia_collective PROPERTIES INSTALL_RPATH ${ORIGIN_PATH})
set_target_properties(gpu_collective PROPERTIES INSTALL_RPATH ${ORIGIN_PATH})
endif()
endif() endif()
if(CMAKE_SYSTEM_NAME MATCHES "Darwin") if(CMAKE_SYSTEM_NAME MATCHES "Darwin")

View File

@ -52,8 +52,7 @@ void ConstInputToAttrRegister::RegConstToAttr(const std::string &name, const std
auto key = GenerateKey(name, backend, is_dynamic_shape); auto key = GenerateKey(name, backend, is_dynamic_shape);
auto find = input_to_attr_.find(key); auto find = input_to_attr_.find(key);
if (find != input_to_attr_.end()) { if (find != input_to_attr_.end()) {
MS_LOG(WARNING) << "This node(" << key << ")" return;
<< " has been registered.";
} }
input_to_attr_[key] = input_to_attr; input_to_attr_[key] = input_to_attr;
} }

View File

@ -27,16 +27,16 @@
namespace mindspore { namespace mindspore {
namespace kernel { namespace kernel {
class BACKEND_EXPORT OpLib { class OpLib {
public: public:
OpLib() = default; OpLib() = default;
virtual ~OpLib() = default; virtual ~OpLib() = default;
static bool RegOp(const std::string &json_string, const std::string &impl_path); BACKEND_EXPORT static bool RegOp(const std::string &json_string, const std::string &impl_path);
static std::shared_ptr<OpInfo> FindOp(const std::string &op_name, OpImplyType imply_type, static std::shared_ptr<OpInfo> FindOp(const std::string &op_name, OpImplyType imply_type,
bool is_dynamic_shape = false); bool is_dynamic_shape = false);
protected: protected:
inline static std::multimap<std::string, std::shared_ptr<OpInfo>> op_info_ = {}; BACKEND_EXPORT inline static std::multimap<std::string, std::shared_ptr<OpInfo>> op_info_;
private: private:
static bool RegOpFromLocalInfo(); static bool RegOpFromLocalInfo();

View File

@ -1,16 +1,14 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_BINARY_DIR}) include_directories(${CMAKE_BINARY_DIR})
if(ENABLE_D OR ENABLE_ACL) set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/nnae/latest/lib64)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/nnae/latest/lib64) set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/lib64)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/lib64) set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/latest/lib64)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/latest/lib64) set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/opp/op_impl/built-in/ai_core/tbe/op_tiling)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/opp/op_impl/built-in/ai_core/tbe/op_tiling) set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/nnae/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/nnae/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling) set(MINDSPORE_RPATH
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling)
${MINDSPORE_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling) set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling)
endif()
########### mindspore_ascend.so ##### ########### mindspore_ascend.so #####
set(ASCEND_SUB_COMP set(ASCEND_SUB_COMP
@ -35,10 +33,9 @@ add_library(mindspore_ascend SHARED ${ASCEND_SUB_OBJECTS_SRC})
target_link_libraries(mindspore_ascend PUBLIC mindspore_backend_common) target_link_libraries(mindspore_ascend PUBLIC mindspore_backend_common)
target_link_libraries(mindspore_ascend PRIVATE mindspore_core mindspore_common proto_input mindspore::protobuf) target_link_libraries(mindspore_ascend PRIVATE mindspore_core mindspore_common proto_input mindspore::protobuf)
target_link_libraries(mindspore_ascend PRIVATE securec) target_link_libraries(mindspore_ascend PRIVATE securec)
set_target_properties(mindspore_ascend PROPERTIES INSTALL_RPATH $ORIGIN)
target_link_libraries(mindspore_ascend PRIVATE mindspore::dnnl mindspore::mkldnn mindspore::ssl target_link_libraries(mindspore_ascend PRIVATE mindspore::dnnl mindspore::mkldnn mindspore::ssl
mindspore::crypto nnacl) mindspore::crypto nnacl)
set_target_properties(mindspore_ascend PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH})
if(ENABLE_DEBUGGER) if(ENABLE_DEBUGGER)
# debugger: link grpc # debugger: link grpc
@ -51,7 +48,7 @@ if(ENABLE_D)
find_library(GE_RUNNER ge_runner ${ASCEND_CANN_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH}) find_library(GE_RUNNER ge_runner ${ASCEND_CANN_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
find_library(GRAPH graph ${ASCEND_CANN_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH}) find_library(GRAPH graph ${ASCEND_CANN_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
find_library(HCCL hccl ${ASCEND_CANN_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH}) find_library(HCCL hccl ${ASCEND_CANN_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
target_link_libraries(mindspore_ascend PUBLIC ${GE_RUNNER} ${GRAPH} ${HCCL}) target_link_libraries(mindspore_ascend PRIVATE ${GE_RUNNER} ${GRAPH} ${HCCL})
target_link_libraries(mindspore_ascend PRIVATE mindspore::event mindspore::event_pthreads target_link_libraries(mindspore_ascend PRIVATE mindspore::event mindspore::event_pthreads
mindspore::event_openssl -Wl,--no-as-needed mindspore::event_core ps_cache) mindspore::event_openssl -Wl,--no-as-needed mindspore::event_core ps_cache)
endif() endif()
@ -70,7 +67,7 @@ if(MODE_ASCEND_ALL)
find_library(adump_server libadump_server.a ${ASCEND_CANN_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH}) find_library(adump_server libadump_server.a ${ASCEND_CANN_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
find_library(OPTILING optiling ${ASCEND_CANN_OPP_PATH} ${ASCEND_TOOLKIT_OPP_PATH}) find_library(OPTILING optiling ${ASCEND_CANN_OPP_PATH} ${ASCEND_TOOLKIT_OPP_PATH})
target_link_libraries(mindspore_ascend PUBLIC ${RUNTIME_LIB} ${TSDCLIENT} ${DATATRANSFER} ${ERROR_MANAGER} target_link_libraries(mindspore_ascend PRIVATE ${RUNTIME_LIB} ${TSDCLIENT} ${DATATRANSFER} ${ERROR_MANAGER}
-Wl,--no-as-needed ${OPTILING} ${PLATFORM} ${ACL} ${ACL_TDT_CHANNEL} ${OPT_FEATURE} ${PROFILING}) -Wl,--no-as-needed ${OPTILING} ${PLATFORM} ${ACL} ${ACL_TDT_CHANNEL} ${OPT_FEATURE} ${PROFILING})
target_link_libraries(mindspore_ascend PRIVATE ${adump_server}) target_link_libraries(mindspore_ascend PRIVATE ${adump_server})
endif() endif()