support all cuda version in a whl package

Signed-off-by: zhoufeng <zhoufeng54@huawei.com>
This commit is contained in:
zhoufeng 2022-11-16 14:51:04 +08:00
parent 8af9d7c038
commit b25cc0256f
21 changed files with 153 additions and 161 deletions

View File

@ -19,45 +19,18 @@ set(CPACK_PYTHON_VERSION ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR})
if(ENABLE_GPU)
set(CPACK_MS_BACKEND "ms")
set(CPACK_MS_TARGET "gpu or cpu")
if(BUILD_DEV_MODE)
# providing cuda11 version of dev package only
set(CPACK_MS_PACKAGE_NAME "mindspore-cuda11-dev")
else()
set(CPACK_MS_PACKAGE_NAME "mindspore-gpu")
endif()
elseif(ENABLE_D)
set(CPACK_MS_BACKEND "ms")
set(CPACK_MS_TARGET "ascend or cpu")
if(BUILD_DEV_MODE)
set(CPACK_MS_PACKAGE_NAME "mindspore-ascend-dev")
else()
set(CPACK_MS_PACKAGE_NAME "mindspore-ascend")
endif()
elseif(ENABLE_CPU)
set(CPACK_MS_BACKEND "ms")
set(CPACK_MS_TARGET "cpu")
if(BUILD_DEV_MODE)
set(CPACK_MS_PACKAGE_NAME "mindspore-dev")
else()
set(CPACK_MS_PACKAGE_NAME "mindspore")
endif()
elseif(ENABLE_ACL)
set(CPACK_MS_BACKEND "debug")
set(CPACK_MS_TARGET "ascend or gpu or cpu")
if(BUILD_DEV_MODE)
set(CPACK_MS_PACKAGE_NAME "mindspore-ascend-dev")
else()
set(CPACK_MS_PACKAGE_NAME "mindspore-ascend")
endif()
else()
set(CPACK_MS_BACKEND "debug")
set(CPACK_MS_TARGET "ascend or gpu or cpu")
if(BUILD_DEV_MODE)
set(CPACK_MS_PACKAGE_NAME "mindspore-dev")
else()
set(CPACK_MS_PACKAGE_NAME "mindspore")
endif()
endif()
if(BUILD_DEV_MODE)
# providing cuda11 version of dev package only
set(CPACK_MS_PACKAGE_NAME "mindspore-dev")
else()
set(CPACK_MS_PACKAGE_NAME "mindspore")
endif()
include(CPack)
@ -114,9 +87,10 @@ endif()
if(ENABLE_GPU)
install(
TARGETS mindspore_gpu
TARGETS mindspore_gpu LIBRARY
DESTINATION ${INSTALL_PLUGIN_DIR}
COMPONENT mindspore
NAMELINK_SKIP
)
endif()
@ -201,17 +175,17 @@ if(ENABLE_GPU)
if(ENABLE_MPI)
install(
TARGETS nvidia_collective
DESTINATION ${INSTALL_LIB_DIR}
DESTINATION ${INSTALL_PLUGIN_DIR}/gpu${CUDA_VERSION}
COMPONENT mindspore
)
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND GPU_BACKEND_CUDA)
install(FILES ${nccl_LIBPATH}/libnccl.so.2.7.6 DESTINATION ${INSTALL_LIB_DIR}
install(FILES ${nccl_LIBPATH}/libnccl.so.2.7.6 DESTINATION ${INSTALL_PLUGIN_DIR}/gpu${CUDA_VERSION}
RENAME libnccl.so.2 COMPONENT mindspore)
endif()
endif()
install(
TARGETS cuda_ops
DESTINATION ${INSTALL_LIB_DIR}
DESTINATION ${INSTALL_PLUGIN_DIR}/gpu${CUDA_VERSION}
COMPONENT mindspore
)
endif()
@ -220,7 +194,7 @@ if(ENABLE_D)
if(ENABLE_MPI)
install(
TARGETS ascend_collective
DESTINATION ${INSTALL_LIB_DIR}
DESTINATION ${INSTALL_PLUGIN_DIR}/ascend
COMPONENT mindspore
)
endif()
@ -245,14 +219,14 @@ if(ENABLE_D OR ENABLE_ACL)
if(ENABLE_D)
install(
TARGETS hccl_plugin
DESTINATION ${INSTALL_LIB_DIR}
DESTINATION ${INSTALL_PLUGIN_DIR}/ascend
COMPONENT mindspore
)
endif()
if(ENABLE_ACL)
install(
TARGETS dvpp_utils
DESTINATION ${INSTALL_LIB_DIR}
DESTINATION ${INSTALL_PLUGIN_DIR}/ascend
COMPONENT mindspore
)
endif()
@ -329,6 +303,29 @@ if(ENABLE_AKG AND CMAKE_SYSTEM_NAME MATCHES "Linux")
DESTINATION ${INSTALL_PY_DIR}/
COMPONENT mindspore
)
if(ENABLE_CPU AND NOT ENABLE_GPU AND NOT ENABLE_D)
install(
TARGETS akg
DESTINATION ${INSTALL_PLUGIN_DIR}/cpu
COMPONENT mindspore
)
endif()
if(ENABLE_GPU)
install(
TARGETS akg
DESTINATION ${INSTALL_PLUGIN_DIR}/gpu${CUDA_VERSION}
COMPONENT mindspore
)
endif()
if(ENABLE_D)
install(
TARGETS akg
DESTINATION ${INSTALL_PLUGIN_DIR}/ascend
COMPONENT mindspore
)
endif()
endif()
if(EXISTS ${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/dataset)

View File

@ -18,23 +18,15 @@ set(CPACK_PYTHON_EXE ${Python3_EXECUTABLE})
set(CPACK_PYTHON_VERSION ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR})
set(CPACK_OSX_DEPLOYMENT_TARGET ${CMAKE_OSX_DEPLOYMENT_TARGET})
if(ENABLE_CPU)
set(CPACK_MS_BACKEND "ms")
set(CPACK_MS_TARGET "cpu")
if(BUILD_DEV_MODE)
set(CPACK_MS_PACKAGE_NAME "mindspore-dev")
else()
set(CPACK_MS_PACKAGE_NAME "mindspore")
endif()
else()
set(CPACK_MS_BACKEND "debug")
set(CPACK_MS_TARGET "ascend or gpu or cpu")
if(BUILD_DEV_MODE)
set(CPACK_MS_PACKAGE_NAME "mindspore-dev")
else()
set(CPACK_MS_PACKAGE_NAME "mindspore")
endif()
endif()
if(BUILD_DEV_MODE)
set(CPACK_MS_PACKAGE_NAME "mindspore-dev")
else()
set(CPACK_MS_PACKAGE_NAME "mindspore")
endif()
include(CPack)

View File

@ -70,7 +70,6 @@ execute_process(
string(REPLACE " " "" GIT_COMMIT_ID ${GIT_COMMIT_ID})
set(ENV{BACKEND_POLICY} ${CPACK_MS_BACKEND})
set(ENV{BACKEND_TARGET} ${CPACK_MS_TARGET})
set(ENV{MS_PACKAGE_NAME} ${CPACK_MS_PACKAGE_NAME})
set(ENV{COMMIT_ID} ${GIT_COMMIT_ID})

View File

@ -100,7 +100,7 @@ if(ENABLE_MINDDATA)
if(ENABLE_ACL)
install(
TARGETS dvpp_utils
DESTINATION ${INSTALL_LIB_DIR}
DESTINATION ${INSTALL_PLUGIN_DIR}
COMPONENT mindspore
)
endif()

View File

@ -17,29 +17,15 @@ set(CPACK_PYTHON_VERSION ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR})
if(ENABLE_GPU)
set(CPACK_MS_BACKEND "ms")
set(CPACK_MS_TARGET "gpu or cpu")
if(BUILD_DEV_MODE)
# providing cuda11 version of dev package only
set(CPACK_MS_PACKAGE_NAME "mindspore_cuda11_dev")
else()
set(CPACK_MS_PACKAGE_NAME "mindspore_gpu")
endif()
elseif(ENABLE_CPU)
set(CPACK_MS_BACKEND "ms")
set(CPACK_MS_TARGET "cpu")
if(BUILD_DEV_MODE)
set(CPACK_MS_PACKAGE_NAME "mindspore_dev")
else()
set(CPACK_MS_PACKAGE_NAME "mindspore")
endif()
else()
set(CPACK_MS_BACKEND "debug")
set(CPACK_MS_TARGET "ascend or gpu or cpu")
if(BUILD_DEV_MODE)
set(CPACK_MS_PACKAGE_NAME "mindspore_dev")
else()
set(CPACK_MS_PACKAGE_NAME "mindspore")
endif()
endif()
if(BUILD_DEV_MODE)
set(CPACK_MS_PACKAGE_NAME "mindspore_dev")
else()
set(CPACK_MS_PACKAGE_NAME "mindspore")
endif()
include(CPack)
@ -213,9 +199,10 @@ if(ENABLE_GPU)
COMPONENT mindspore
)
install(
TARGETS mindspore_gpu
TARGETS mindspore_gpu LIBRARY
DESTINATION ${INSTALL_PLUGIN_DIR}
COMPONENT mindspore
NAMELINK_SKIP
)
endif()

View File

@ -162,7 +162,6 @@ if(ENABLE_GPU AND GPU_BACKEND_CUDA)
if(NOT CUPTI_INCLUDE_DIRS OR CUPTI_INCLUDE_DIRS STREQUAL "")
set(CUPTI_INCLUDE_DIRS ${CUDA_PATH}/extras/CUPTI/include)
endif()
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:${CUDA_PATH}/lib64)
message("CUDA_PATH: ${CUDA_PATH}")
message("CUDA_INCLUDE_DIRS: ${CUDA_INCLUDE_DIRS}")
message("CUDNN_INCLUDE_PATH: ${CUDNN_INCLUDE_PATH}")
@ -512,7 +511,6 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
else()
MESSAGE(FATAL_ERROR "other platform: ${CMAKE_SYSTEM_NAME}")
endif()
set(MINDSPORE_RPATH ${ORIGIN_PATH}/lib:${ORIGIN_PATH}/lib/plugin:${ORIGIN_PATH}/..:${MINDSPORE_RPATH})
if(ENABLE_D)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/plugin/device/ascend)
@ -553,7 +551,7 @@ else()
target_link_libraries(_c_expression PRIVATE mindspore::pybind11_module)
endif()
set_target_properties(_c_expression PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH})
set_target_properties(_c_expression PROPERTIES INSTALL_RPATH ${ORIGIN_PATH}/lib:${ORIGIN_PATH}/lib/plugin)
if(USE_GLOG)
target_link_libraries(_c_expression PRIVATE mindspore::glog)
endif()

View File

@ -54,7 +54,7 @@ if(ENABLE_D OR ENABLE_GPU)
list(APPEND MSLIB_SRC ${CMAKE_CURRENT_SOURCE_DIR}/akg_kernel_register.cc)
endif()
if(ENABLE_ACL AND NOT BUILD_LITE)
if(NOT BUILD_LITE)
list(APPEND MSLIB_SRC_DEPEND
${CMAKE_SOURCE_DIR}/mindspore/ccsrc/frontend/parallel/strategy_checkpoint/parallel_strategy_checkpoint.cc)
list(APPEND MSLIB_SRC_DEPEND ${CMAKE_SOURCE_DIR}/mindspore/ccsrc/frontend/parallel/tensor_layout/array.cc)
@ -108,33 +108,34 @@ elseif(MODE_ASCEND_ACL)
if(MS_BUILD_GRPC)
target_link_libraries(mindspore_shared_lib PRIVATE mindspore::grpc++)
endif()
set_target_properties(mindspore_shared_lib PROPERTIES OUTPUT_NAME mindspore)
else()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
# wheel package and ut
add_library(api_lib SHARED ${CMAKE_CURRENT_SOURCE_DIR}/types.cc
${CMAKE_CURRENT_SOURCE_DIR}/context.cc
${CMAKE_CURRENT_SOURCE_DIR}/cell.cc
${CMAKE_CURRENT_SOURCE_DIR}/serialization.cc
${CMAKE_CURRENT_SOURCE_DIR}/graph/graph.cc
${CMAKE_CURRENT_SOURCE_DIR}/graph/graph_data.cc
${CMAKE_CURRENT_SOURCE_DIR}/model/model.cc
${CMAKE_SOURCE_DIR}/mindspore/core/utils/status.cc
)
target_link_libraries(api_lib PRIVATE mindspore_shared_lib -Wl,--no-as-needed ${PYTHON_LIBRARIES})
set_target_properties(api_lib PROPERTIES OUTPUT_NAME mindspore)
set_target_properties(api_lib PROPERTIES INSTALL_RPATH "$ORIGIN")
endif()
endif()
if(ENABLE_D OR ENABLE_GPU)
target_link_libraries(mindspore_shared_lib PRIVATE -Wl,--as-needed ${SECUREC_LIBRARY}
mindspore_backend mindspore_core mindspore_common proto_input mindspore::protobuf)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
add_library(api_lib SHARED ${CMAKE_CURRENT_SOURCE_DIR}/types.cc
${CMAKE_CURRENT_SOURCE_DIR}/context.cc
${CMAKE_CURRENT_SOURCE_DIR}/cell.cc
${CMAKE_CURRENT_SOURCE_DIR}/serialization.cc
${CMAKE_CURRENT_SOURCE_DIR}/graph/graph.cc
${CMAKE_CURRENT_SOURCE_DIR}/graph/graph_data.cc
${CMAKE_CURRENT_SOURCE_DIR}/model/model.cc
${CMAKE_SOURCE_DIR}/mindspore/core/utils/status.cc
)
target_link_libraries(api_lib PRIVATE mindspore_shared_lib -Wl,--no-as-needed ${PYTHON_LIBRARIES})
set_target_properties(api_lib PROPERTIES OUTPUT_NAME mindspore)
set_target_properties(api_lib PROPERTIES INSTALL_RPATH "$ORIGIN")
endif()
else()
if(BUILD_LITE)
target_link_libraries(mindspore_shared_lib PRIVATE mindspore_core ${SECUREC_LIBRARY})
else()
target_link_libraries(mindspore_shared_lib PRIVATE ${PY3_LIBG} ${SECUREC_LIBRARY}
mindspore_backend mindspore mindspore_core mindspore_common proto_input mindspore::protobuf)
set_target_properties(mindspore_shared_lib PROPERTIES OUTPUT_NAME mindspore)
endif()
endif()
@ -175,20 +176,23 @@ endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
# duplicate, should be remove after backend decoupling is done
set(MINDSPORE_RPATH $ORIGIN)
set(MINDSPORE_SHARED_LIB_RPATH $ORIGIN)
if(MODE_ASCEND_ACL)
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/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/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)
set(MINDSPORE_RPATH
${MINDSPORE_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe/op_tiling)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/latest/opp/built-in/op_impl/ai_core/tbe/op_tiling)
set(MINDSPORE_SHARED_LIB_RPATH ${MINDSPORE_SHARED_LIB_RPATH}:/usr/local/Ascend/nnae/latest/lib64)
set(MINDSPORE_SHARED_LIB_RPATH ${MINDSPORE_SHARED_LIB_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/lib64)
set(MINDSPORE_SHARED_LIB_RPATH ${MINDSPORE_SHARED_LIB_RPATH}:/usr/local/Ascend/latest/lib64)
set(MINDSPORE_SHARED_LIB_RPATH
${MINDSPORE_SHARED_LIB_RPATH}:/usr/local/Ascend/opp/op_impl/built-in/ai_core/tbe/op_tiling)
set(MINDSPORE_SHARED_LIB_RPATH
${MINDSPORE_SHARED_LIB_RPATH}:/usr/local/Ascend/nnae/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling)
set(MINDSPORE_SHARED_LIB_RPATH "${MINDSPORE_SHARED_LIB_RPATH}\
:/usr/local/Ascend/ascend-toolkit/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling")
set(MINDSPORE_SHARED_LIB_RPATH
${MINDSPORE_SHARED_LIB_RPATH}:/usr/local/Ascend/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling)
set(MINDSPORE_SHARED_LIB_RPATH "${MINDSPORE_SHARED_LIB_RPATH}\
:/usr/local/Ascend/ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe/op_tiling")
set(MINDSPORE_SHARED_LIB_RPATH
${MINDSPORE_SHARED_LIB_RPATH}:/usr/local/Ascend/latest/opp/built-in/op_impl/ai_core/tbe/op_tiling)
endif()
set_target_properties(mindspore_shared_lib PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH})
set_target_properties(mindspore_shared_lib PROPERTIES INSTALL_RPATH ${MINDSPORE_SHARED_LIB_RPATH})
endif()

View File

@ -70,10 +70,6 @@ endif()
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-delete-abstract-non-virtual-dtor")
else()
if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-rpath,$ORIGIN:$ORIGIN/lib")
endif()
endif()
set(MINDDATA_LOG_ADAPTER_SRC ${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/util/md_log_adapter.cc)
@ -295,7 +291,8 @@ if(MS_BUILD_GRPC)
endif()
if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin" AND NOT MSLITE_ENABLE_CLOUD_MIND_DATA)
set_target_properties(_c_dataengine PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH})
set_target_properties(_c_dataengine PROPERTIES INSTALL_RPATH
${ORIGIN_PATH}:${ORIGIN_PATH}/lib:${ORIGIN_PATH}/lib/plugin)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")

View File

@ -117,8 +117,8 @@ if(ENABLE_CACHE)
add_dependencies(engine-cache-server generated_engine_files)
set_target_properties(cache_admin PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH})
set_target_properties(cache_server PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH})
set_target_properties(cache_admin PROPERTIES INSTALL_RPATH ${ORIGIN_PATH}/..:${ORIGIN_PATH}/../lib)
set_target_properties(cache_server PROPERTIES INSTALL_RPATH ${ORIGIN_PATH}/..:${ORIGIN_PATH}/../lib)
else()
ms_protobuf_generate(CACHE_PROTO_SRCS CACHE_PROTO_HDRS cache_grpc.proto)
target_sources(engine-cache-client PUBLIC ${CACHE_PROTO_SRCS})

View File

@ -61,5 +61,5 @@ else()
endif()
if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin" AND NOT MSLITE_ENABLE_CLOUD_MIND_DATA)
set_target_properties(_c_mindrecord PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH})
set_target_properties(_c_mindrecord PROPERTIES INSTALL_RPATH ${ORIGIN_PATH}:${ORIGIN_PATH}/lib)
endif()

View File

@ -3,17 +3,17 @@ include_directories(${CMAKE_BINARY_DIR})
include_directories(${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset)
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/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/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)
set(MINDSPORE_RPATH
${MINDSPORE_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe/op_tiling)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/latest/opp/built-in/op_impl/ai_core/tbe/op_tiling)
set(ASCEND_RPATH ${ASCEND_RPATH}:/usr/local/Ascend/nnae/latest/lib64)
set(ASCEND_RPATH ${ASCEND_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/lib64)
set(ASCEND_RPATH ${ASCEND_RPATH}:/usr/local/Ascend/latest/lib64)
set(ASCEND_RPATH ${ASCEND_RPATH}:/usr/local/Ascend/opp/op_impl/built-in/ai_core/tbe/op_tiling)
set(ASCEND_RPATH ${ASCEND_RPATH}:/usr/local/Ascend/nnae/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling)
set(ASCEND_RPATH
${ASCEND_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling)
set(ASCEND_RPATH ${ASCEND_RPATH}:/usr/local/Ascend/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling)
set(ASCEND_RPATH
${ASCEND_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe/op_tiling)
set(ASCEND_RPATH ${ASCEND_RPATH}:/usr/local/Ascend/latest/opp/built-in/op_impl/ai_core/tbe/op_tiling)
### cxx api need file ###
if(ENABLE_ACL)
@ -58,7 +58,8 @@ target_link_libraries(mindspore_ascend PRIVATE proto_input mindspore::protobuf)
target_link_libraries(mindspore_ascend PRIVATE securec d_collective)
target_link_libraries(mindspore_ascend PRIVATE mindspore::dnnl mindspore::mkldnn mindspore::ssl
mindspore::crypto nnacl)
set_target_properties(mindspore_ascend PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH})
set_target_properties(mindspore_ascend PROPERTIES INSTALL_RPATH
${ORIGIN_PATH}:${ORIGIN_PATH}/ascend:${ORIGIN_PATH}/../:${ASCEND_RPATH})
if(ENABLE_DEBUGGER)
# debugger: link grpc
@ -100,7 +101,8 @@ endif()
if(ENABLE_D)
if(ENABLE_MPI)
set_target_properties(_ascend_mpi PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH})
set_target_properties(_ascend_mpi PROPERTIES INSTALL_RPATH
${ORIGIN_PATH}:${ORIGIN_PATH}/lib:${ORIGIN_PATH}/lib/plugin/:${ASCEND_RPATH})
endif()
endif()

View File

@ -2,11 +2,11 @@ add_library(hccl_plugin SHARED hccl_plugin.cc)
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/lib64/plugin/opskernel)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/lib64/plugin/opskernel)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/latest/lib64/plugin/opskernel)
set(HCCL_RPATH ${HCCL_RPATH}:/usr/local/Ascend/nnae/latest/lib64/plugin/opskernel)
set(HCCL_RPATH ${HCCL_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/lib64/plugin/opskernel)
set(HCCL_RPATH ${HCCL_RPATH}:/usr/local/Ascend/latest/lib64/plugin/opskernel)
set_target_properties(hccl_plugin PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH})
set_target_properties(hccl_plugin PROPERTIES INSTALL_RPATH ${HCCL_RPATH})
find_library(HCCL hccl ${ASCEND_CANN_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
find_library(REGISTER register ${ASCEND_CANN_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})

View File

@ -30,7 +30,6 @@
namespace mindspore {
namespace kernel {
constexpr size_t kPluginSuffix = 6;
bool AicpuOpKernelLoad::GetBinaryFileName(const std::string &so_name, const std::string &bin_folder_path,
std::string *bin_file_path) {
MS_EXCEPTION_IF_NULL(bin_file_path);
@ -106,7 +105,7 @@ bool AicpuOpKernelLoad::GetSoNeedLoadPath(std::string *file_path) const {
MS_LOG(ERROR) << "Current path [" << cust_kernel_so_path << "] is invalid.";
return false;
}
auto real_cust_kernel_so_path = cust_kernel_so_path.substr(0, pos - kPluginSuffix);
auto real_cust_kernel_so_path = cust_kernel_so_path.substr(0, pos);
if (real_cust_kernel_so_path.size() > PATH_MAX) {
MS_LOG(ERROR) << "Current path [" << real_cust_kernel_so_path << "] is too long.";
return false;
@ -126,7 +125,7 @@ bool AicpuOpKernelLoad::PackageBinaryFile(const std::string &so_name,
}
std::string bin_file_path;
ret = GetBinaryFileName(so_name, bin_folder_path, &bin_file_path);
ret = GetBinaryFileName(so_name, bin_folder_path + "/ascend", &bin_file_path);
if (!ret) {
MS_LOG(ERROR) << "GetBinaryFileName failed.";
return false;

View File

@ -73,10 +73,10 @@ if(EXISTS ${CMAKE_C_COMPILER} AND EXISTS ${CMAKE_CXX_COMPILER})
-pthread
)
set(INSTALL_LIBRARY_DIR lib)
set(INSTALL_LIBRARY_DIR lib/plugin)
install(TARGETS mindspore_aicpu_kernels OPTIONAL
EXPORT mindspore_aicpu_kernels-targets
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/ascend
)
endif()

View File

@ -37,6 +37,7 @@ add_library(mindspore_axx_api_gpu_obj OBJECT ${API_INFER_GPU})
list(APPEND GPU_SUB_OBJECTS_SRC $<TARGET_OBJECTS:mindspore_axx_api_gpu_obj>)
add_library(mindspore_gpu SHARED ${GPU_SUB_OBJECTS_SRC})
set_target_properties(mindspore_gpu PROPERTIES SOVERSION ${CUDA_VERSION})
if(MSVC)
target_link_options(mindspore_gpu PRIVATE /FORCE:UNRESOLVED)
endif()
@ -44,7 +45,8 @@ target_link_libraries(mindspore_gpu PRIVATE mindspore_backend mindspore_core min
target_link_libraries(mindspore_gpu PRIVATE mindspore_shared_lib)
target_link_libraries(mindspore_gpu PRIVATE proto_input mindspore::protobuf)
target_link_libraries(mindspore_gpu PRIVATE securec)
set_target_properties(mindspore_gpu PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH})
set_target_properties(mindspore_gpu PROPERTIES INSTALL_RPATH
${ORIGIN_PATH}:${ORIGIN_PATH}/gpu${CUDA_VERSION}:${ORIGIN_PATH}/../:/usr/local/cuda/lib64)
target_link_libraries(mindspore_gpu PRIVATE mindspore::dnnl mindspore::mkldnn nnacl)
if(NOT WIN32)
target_link_libraries(mindspore_gpu PRIVATE mindspore::ssl mindspore::crypto)
@ -63,7 +65,9 @@ if(ENABLE_GPU)
${CUDA_PATH}/lib/x64/cuda.lib
${CUDA_PATH}/lib/x64/cusolver.lib
${CUDA_PATH}/lib/x64/cufft.lib
${CUDA_PATH}/lib/x64/cusparse.lib)
${CUDA_PATH}/lib/x64/cusparse.lib
${CUDA_PATH}/lib/x64/libnvrtc.so
)
else()
target_link_libraries(mindspore_gpu PRIVATE cuda_ops
${CUBLAS_LIBRARY_PATH}
@ -73,7 +77,9 @@ if(ENABLE_GPU)
${CUDA_PATH}/lib64/stubs/libcuda.so
${CUDA_PATH}/lib64/libcusolver.so
${CUDA_PATH}/lib64/libcufft.so
${CUDA_PATH}/lib64/libcusparse.so)
${CUDA_PATH}/lib64/libcusparse.so
${CUDA_PATH}/lib64/libnvrtc.so
)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND ${CUDA_VERSION} VERSION_GREATER "11.0")

View File

@ -15,6 +15,7 @@
*/
#include "plugin/device/gpu/hal/device/cuda_driver.h"
#include <nvrtc.h>
#include "utils/log_adapter.h"
#include "include/common/utils/convert_utils.h"
@ -271,6 +272,12 @@ bool CudaDriver::SetDevice(int index) {
"number 4.";
return false;
}
int major = 0;
int minor = 0;
auto curtc_ret = nvrtcVersion(&major, &minor);
if (curtc_ret == nvrtcResult::NVRTC_SUCCESS) {
MS_LOG(DEBUG) << "NVRTC version is " << major << "." << minor;
}
return true;
}
} // namespace gpu

View File

@ -68,6 +68,21 @@
namespace mindspore {
namespace device {
namespace gpu {
namespace {
std::string GetCurrentDir() {
#ifndef _WIN32
Dl_info dl_info;
if (dladdr(reinterpret_cast<void *>(GetCurrentDir), &dl_info) == 0) {
MS_LOG(WARNING) << "Get dladdr error";
return "";
}
std::string cur_so_path = dl_info.dli_fname;
return dirname(cur_so_path.data());
#else
return "";
#endif
}
} // namespace
using KernelGraph = mindspore::session::KernelGraph;
static thread_local bool cur_thread_device_inited{false};
@ -759,7 +774,8 @@ uint32_t GPUKernelExecutor::GetRankID() const {
bool GPUDeviceResManager::LoadCollectiveCommLib() {
#ifdef ENABLE_MPI
std::string nvidia_comm_lib_name = "libnvidia_collective.so";
std::string nvidia_comm_lib_name = GetCurrentDir() + "/gpu" + std::to_string(CUDA_VERSION / 1000) + "." +
std::to_string(CUDA_VERSION / 10 % 10) + "/libnvidia_collective.so";
auto loader = std::make_shared<CollectiveCommLibLoader>(nvidia_comm_lib_name);
MS_EXCEPTION_IF_NULL(loader);
if (!loader->Initialize()) {

View File

@ -20,7 +20,7 @@ from mindspore import context
from mindspore.parallel._ps_context import _is_role_worker, _is_role_pserver, _is_role_sched, _is_ps_mode,\
_get_ps_context
from mindspore import log as logger
from mindspore._c_expression import CollectiveManager, set_cluster_exit_with_exception
from mindspore._c_expression import CollectiveManager, set_cluster_exit_with_exception, MSContext
HCCL_LIB = 'libhccl_plugin.so'
@ -29,7 +29,7 @@ def hccl_load_lib():
"""load hccl lib"""
try:
base_dir = os.path.dirname(os.path.realpath(__file__))
lib_path = os.path.join(base_dir, "../lib", HCCL_LIB)
lib_path = os.path.join(base_dir, "../lib/plugin", HCCL_LIB)
ctypes.CDLL(lib_path)
except Exception:
raise RuntimeError('Get hccl lib error.')
@ -37,7 +37,8 @@ def hccl_load_lib():
_HCCL_TEST_AVAILABLE = False
try:
hccl_load_lib()
if MSContext.get_instance().is_ascend_plugin_loaded():
hccl_load_lib()
except RuntimeError:
_HCCL_TEST_AVAILABLE = True

View File

@ -82,7 +82,7 @@ def load_lib():
"""load hccl lib"""
try:
base_dir = os.path.dirname(os.path.realpath(__file__))
lib_path = os.path.join(base_dir, "../lib", HCCL_LIB)
lib_path = os.path.join(base_dir, "../lib/plugin/ascend", HCCL_LIB)
hccl_lib = ctypes.CDLL(lib_path)
except Exception:
raise RuntimeError('Get hccl lib error.')

View File

@ -33,7 +33,6 @@ do
if [ -d "./$i/mindspore/lib/plugin" ]; then
\cp -rf ./$i/mindspore/lib/plugin/* $BSAE_PACKAGE_UNZIP_DIR/mindspore/lib/plugin
fi;
find ./$i/mindspore/_ms_mpi.*.so -print0 | xargs -0 -I {} \cp -f {} $BSAE_PACKAGE_UNZIP_DIR/mindspore/
if [ -f "./$i/mindspore/lib/libmpi_collective.so" ]; then
\cp -rf ./$i/mindspore/lib/libmpi_collective.so $BSAE_PACKAGE_UNZIP_DIR/mindspore/lib/
fi;

View File

@ -24,7 +24,6 @@ from setuptools.command.egg_info import egg_info
from setuptools.command.build_py import build_py
backend_policy = os.getenv('BACKEND_POLICY')
device_target = os.getenv('BACKEND_TARGET')
commit_id = os.getenv('COMMIT_ID').replace("\n", "")
package_name = os.getenv('MS_PACKAGE_NAME').replace("\n", "")
build_path = os.getenv('BUILD_PATH')
@ -58,10 +57,6 @@ def _write_package_name(file):
file.write("__package_name__ = '{}'\n".format(package_name))
def _write_device_target(file):
file.write("__device_target__ = '{}'\n".format(device_target))
def build_dependencies():
"""generate python file"""
version_file = os.path.join(pkg_dir, 'mindspore', 'version.py')
@ -80,14 +75,6 @@ def build_dependencies():
with open(config_file, 'w') as f:
_write_config(f)
target = os.path.join(pkg_dir, 'mindspore', 'default_config.py')
with open(target, 'a') as f:
_write_device_target(f)
target = os.path.join(pwd, 'mindspore/python/mindspore', 'default_config.py')
with open(target, 'a') as f:
_write_device_target(f)
package_info = os.path.join(pkg_dir, 'mindspore', 'default_config.py')
with open(package_info, 'a') as f:
_write_package_name(f)
@ -126,6 +113,7 @@ package_data = {
'*.pdb',
'bin/*',
'lib/plugin/*',
'lib/plugin/*/*',
'lib/*.so*',
'lib/*.a',
'lib/*.dylib*',