ascend 310/910 joint compile, and ascend 310 pacakge lose weight

This commit is contained in:
yanghaoran 2021-05-26 11:31:02 +08:00 committed by yanghaoran
parent b9a12ce3bf
commit 8b4ff8708f
14 changed files with 289 additions and 70 deletions

View File

@ -90,4 +90,8 @@ if(ENABLE_TESTCASES OR ENABLE_CPP_ST)
add_subdirectory(tests)
endif()
include(cmake/package.cmake)
if(MODE_ASCEND_ACL)
include(cmake/package_acl.cmake)
else()
include(cmake/package.cmake)
endif()

1
VERSION Normal file
View File

@ -0,0 +1 @@
1.2.0

View File

@ -107,6 +107,7 @@ checkopts()
USE_GLOG="on"
ENABLE_AKG="on"
ENABLE_ACL="off"
ENABLE_D="off"
ENABLE_DEBUGGER="on"
ENABLE_IBVERBS="off"
ENABLE_PYTHON="on"
@ -380,10 +381,13 @@ checkopts()
if [[ "X$DEVICE_VERSION" == "X" ]]; then
DEVICE_VERSION=910
fi
# building 310 package by giving specific -V 310 instruction
if [[ "X$DEVICE_VERSION" == "X310" ]]; then
ENABLE_ACL="on"
# universal ascend package
elif [[ "X$DEVICE_VERSION" == "X910" ]]; then
ENABLE_D="on"
ENABLE_ACL="on"
ENABLE_CPU="on"
else
echo "Invalid value ${DEVICE_VERSION} for option -V"
@ -970,8 +974,12 @@ if [[ "X$ENABLE_MAKE_CLEAN" = "Xon" ]]; then
make_clean
fi
cp -rf ${BUILD_PATH}/package/mindspore/lib ${BUILD_PATH}/../mindspore
cp -rf ${BUILD_PATH}/package/mindspore/*.so ${BUILD_PATH}/../mindspore
if [[ "X$ENABLE_ACL" == "Xon" ]] && [[ "X$ENABLE_D" == "Xoff" ]]; then
echo "acl mode, skipping deploy phase"
rm -rf ${BASEPATH}/output/_CPack_Packages/
else
cp -rf ${BUILD_PATH}/package/mindspore/lib ${BUILD_PATH}/../mindspore
cp -rf ${BUILD_PATH}/package/mindspore/*.so ${BUILD_PATH}/../mindspore
fi
echo "---------------- mindspore: build end ----------------"

View File

@ -16,7 +16,7 @@ function(find_submodule_lib module name path)
)
endfunction()
if(ENABLE_D OR ENABLE_ACL OR ENABLE_TESTCASES)
if(MODE_ASCEND_ALL OR MODE_ASCEND_ACL OR 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})

View File

@ -22,6 +22,8 @@ option(ENABLE_IBVERBS "enable IBVERBS for parameter server" OFF)
option(ENABLE_PYTHON "Enable python" ON)
option(ENABLE_ACL "enable acl" OFF)
option(ENABLE_GLIBCXX "enable_glibcxx" OFF)
option(MODE_ASCEND_ALL "supports all ascend platform" OFF)
option(MODE_ASCEND_ACL "supports ascend acl mode only" OFF)
if(NOT ENABLE_D AND NOT ENABLE_TESTCASES AND NOT ENABLE_ACL AND NOT ENABLE_GE)
set(ENABLE_GLIBCXX ON)
@ -130,3 +132,12 @@ endif()
if(ENABLE_MINDDATA AND NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
set(MS_BUILD_GRPC ON)
endif()
if(ENABLE_D AND ENABLE_ACL)
set(MODE_ASCEND_ALL ON)
endif()
if(ENABLE_ACL AND NOT ENABLE_D)
set(MODE_ASCEND_ACL ON)
endif()

179
cmake/package_acl.cmake Normal file
View File

@ -0,0 +1,179 @@
# include dependency
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
# prepare output directory
file(REMOVE_RECURSE ${CMAKE_SOURCE_DIR}/output)
file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/output)
# cpack variables
file(READ ${CMAKE_SOURCE_DIR}/VERSION VERSION_NUMBER)
string(TOLOWER linux_${CMAKE_HOST_SYSTEM_PROCESSOR} PLATFORM_NAME)
set(CPACK_PACKAGE_FILE_NAME mindspore_ascend-${VERSION_NUMBER}-${PLATFORM_NAME})
set(CPACK_GENERATOR "TGZ")
set(CPACK_PACKAGE_CHECKSUM SHA256)
set(CPACK_PACKAGE_DIRECTORY ${CMAKE_SOURCE_DIR}/output)
set(INSTALL_LIB_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "Installation directory for libraries")
set(INSTALL_BASE_DIR ".")
set(INSTALL_BIN_DIR "bin")
set(INSTALL_CFG_DIR "config")
set(INSTALL_LIB_DIR "lib")
# set package files
install(
TARGETS mindspore_shared_lib
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
install(
TARGETS mindspore_gvar
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
if(USE_GLOG)
file(GLOB_RECURSE GLOG_LIB_LIST ${glog_LIBPATH}/libmindspore_glog*)
install(
FILES ${GLOG_LIB_LIST}
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
endif()
file(GLOB_RECURSE LIBEVENT_LIB_LIST
${libevent_LIBPATH}/libevent*${CMAKE_SHARED_LIBRARY_SUFFIX}*
${libevent_LIBPATH}/libevent_pthreads*${CMAKE_SHARED_LIBRARY_SUFFIX}*
)
install(
FILES ${LIBEVENT_LIB_LIST}
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
if(ENABLE_MINDDATA)
install(
TARGETS _c_dataengine _c_mindrecord
DESTINATION ${INSTALL_BASE_DIR}
COMPONENT mindspore
)
install(
TARGETS cache_admin cache_server
OPTIONAL
DESTINATION ${INSTALL_BIN_DIR}
COMPONENT mindspore
)
file(GLOB_RECURSE OPENCV_LIB_LIST
${opencv_LIBPATH}/libopencv_core*
${opencv_LIBPATH}/libopencv_imgcodecs*
${opencv_LIBPATH}/libopencv_imgproc*
)
install(
FILES ${OPENCV_LIB_LIST}
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
file(GLOB_RECURSE TINYXML2_LIB_LIST ${tinyxml2_LIBPATH}/libtinyxml2*)
install(
FILES ${TINYXML2_LIB_LIST}
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
file(GLOB_RECURSE ICU4C_LIB_LIST
${icu4c_LIBPATH}/libicuuc*
${icu4c_LIBPATH}/libicudata*
${icu4c_LIBPATH}/libicui18n*
)
install(
FILES ${ICU4C_LIB_LIST}
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
endif()
# CPU mode
if(ENABLE_CPU AND NOT WIN32)
install(
TARGETS ps_cache
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
endif()
if(ENABLE_CPU)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
file(GLOB_RECURSE DNNL_LIB_LIST ${onednn_LIBPATH}/libdnnl${CMAKE_SHARED_LIBRARY_SUFFIX}*)
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
file(GLOB_RECURSE DNNL_LIB_LIST ${onednn_LIBPATH}/libdnnl*${CMAKE_SHARED_LIBRARY_SUFFIX}*)
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
file(GLOB_RECURSE DNNL_LIB_LIST ${onednn_LIBPATH}/dnnl.dll)
endif()
install(
FILES ${DNNL_LIB_LIST}
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
install(
TARGETS nnacl
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
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)
install(FILES ${grpc_LIBPATH}/libmindspore_grpc.so.9.0.0
DESTINATION ${INSTALL_LIB_DIR} RENAME libmindspore_grpc.so.9 COMPONENT mindspore)
install(FILES ${grpc_LIBPATH}/libmindspore_gpr.so.9.0.0
DESTINATION ${INSTALL_LIB_DIR} RENAME libmindspore_gpr.so.9 COMPONENT mindspore)
install(FILES ${grpc_LIBPATH}/libmindspore_upb.so.9.0.0
DESTINATION ${INSTALL_LIB_DIR} RENAME libmindspore_upb.so.9 COMPONENT mindspore)
install(FILES ${grpc_LIBPATH}/libmindspore_address_sorting.so.9.0.0
DESTINATION ${INSTALL_LIB_DIR} RENAME libmindspore_address_sorting.so.9 COMPONENT mindspore)
endif()
## Public header files
install(
DIRECTORY ${CMAKE_SOURCE_DIR}/include
DESTINATION ${INSTALL_BASE_DIR}
COMPONENT mindspore
)
## Public header files for minddata
install(
FILES ${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/config.h
${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/constants.h
${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/execute.h
${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/text.h
${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/transforms.h
${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/vision.h
${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/vision_lite.h
${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/vision_ascend.h
DESTINATION ${INSTALL_BASE_DIR}/include/dataset
COMPONENT mindspore
)
## config files
install(
FILES ${CMAKE_SOURCE_DIR}/config/op_info.config
DESTINATION ${INSTALL_CFG_DIR}
COMPONENT mindspore
)
include(CPack)

View File

@ -21,13 +21,6 @@ if(ENABLE_CPU)
add_subdirectory(backend/kernel_compiler/cpu/nnacl)
endif()
if(ENABLE_ACL)
set(ASCEND_PATH /usr/local/Ascend)
include_directories(${ASCEND_PATH}/acllib/include)
link_directories(${ASCEND_PATH}/acllib/lib64/)
find_library(ascendcl acl_dvpp ${ASCEND_PATH}/acllib/lib64)
endif()
if(NOT(CMAKE_SYSTEM_NAME MATCHES "Darwin"))
link_directories(${CMAKE_SOURCE_DIR}/build/mindspore/graphengine)
else()
@ -193,7 +186,7 @@ if(ENABLE_DUMP_PROTO)
list(APPEND MINDSPORE_PROTO_LIST ${PY_SRCS})
endif()
if(ENABLE_D)
if(MODE_ASCEND_ALL)
include_directories("${CMAKE_BINARY_DIR}/backend/kernel_compiler/aicpu")
file(GLOB_RECURSE PROTO_IN RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "backend/kernel_compiler/aicpu/proto/*.proto")
ms_protobuf_generate(PROTOSRCS PROTOHDRS ${PROTO_IN})
@ -267,7 +260,8 @@ if(ENABLE_GE)
target_link_libraries(mindspore graph tsdclient datatransfer ascendcl runtime)
endif()
if(ENABLE_D)
if(MODE_ASCEND_ALL OR MODE_ASCEND_ACL)
# common env paths
if(DEFINED ENV{D_LINK_PATH})
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "aarch64")
MESSAGE("system processor matches aarch64")
@ -292,7 +286,9 @@ if(ENABLE_D)
set(ASCEND_TOOLKIT_RUNTIME_PATH ${ASCEND_PATH}/ascend-toolkit/latest/fwkacllib/lib64)
set(ASCEND_TOOLKIT_OPP_PATH ${ASCEND_PATH}/ascend-toolkit/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling)
endif()
endif()
if(MODE_ASCEND_ALL)
MESSAGE("USE DAV LIB PATH: ${ASCEND_PATH}")
find_library(RUNTIME_LIB runtime ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
find_library(TSDCLIENT tsdclient HINTS ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH}
@ -341,7 +337,7 @@ else()
MESSAGE(FATAL_ERROR "other platform: ${CMAKE_SYSTEM_NAME}")
endif()
if(ENABLE_D)
if(MODE_ASCEND_ALL)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/nnae/latest/fwkacllib/lib64)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/fwkacllib/lib64)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/fwkacllib/lib64)
@ -376,12 +372,9 @@ else()
proto_input -Wl,--no-whole-archive)
target_link_libraries(_c_expression PRIVATE mindspore::pybind11_module)
target_link_libraries(_c_expression PRIVATE mindspore_gvar)
if(ENABLE_D)
if(MODE_ASCEND_ALL)
target_link_libraries(_c_expression PRIVATE -Wl,--no-as-needed ms_profile)
endif()
if(ENABLE_ACL)
target_link_libraries(_c_expression PRIVATE -Wl,--no-as-needed graph)
endif()
endif()
if(USE_GLOG)
@ -417,7 +410,7 @@ if(ENABLE_MINDDATA)
add_subdirectory(minddata/dataset)
endif()
if(ENABLE_D)
if(MODE_ASCEND_ALL)
find_library(adump_server libadump_server.a ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
target_link_libraries(_c_expression PRIVATE ${adump_server})
endif()

View File

@ -5,7 +5,8 @@ set(LOAD_MINDIR_SRC
)
file(GLOB_RECURSE API_OPS_SRC ${CMAKE_CURRENT_SOURCE_DIR} "ops/*.cc")
if(ENABLE_ACL)
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)
include_directories(${CMAKE_BINARY_DIR}/proto/ge)
@ -15,12 +16,15 @@ if(ENABLE_ACL)
"model/model_converter_utils/*.cc"
"graph/acl/*.cc"
)
list(APPEND API_ACL_SRC $<TARGET_OBJECTS:_mindspore_transform_graph_ir_obj>)
if(NOT ENABLE_D)
list(APPEND API_ACL_SRC $<TARGET_OBJECTS:_mindspore_transform_graph_ir_obj>)
endif()
endif()
if(ENABLE_D)
# for 910 mode
file(GLOB_RECURSE API_MS_INFER_SRC ${CMAKE_CURRENT_SOURCE_DIR}
"akg_kernel_register.cc" "model/ms/*.cc" "graph/ascend/*.cc")
"model/ms/*.cc" "graph/ascend/*.cc")
endif()
if(ENABLE_GPU)
@ -69,34 +73,20 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
target_link_options(mindspore_shared_lib PRIVATE -Wl,-init,common_log_init)
endif()
if(ENABLE_ACL)
if(DEFINED ENV{ASCEND_CUSTOM_PATH})
set(ASCEND_PATH $ENV{ASCEND_CUSTOM_PATH})
else()
set(ASCEND_PATH /usr/local/Ascend)
endif()
set(ACL_LIB_DIR ${ASCEND_PATH}/acllib/)
set(ATLAS_ACL_LIB_DIR ${ASCEND_PATH}/ascend-toolkit/latest/acllib)
set(ATC_DIR ${ASCEND_PATH}/atc/)
set(ATLAS_ATC_DIR ${ASCEND_PATH}/ascend-toolkit/latest/atc)
MESSAGE("acl lib dir " ${ACL_LIB_DIR} ", atc dir " ${ATC_DIR})
MESSAGE("atlas acl lib dir " ${ATLAS_ACL_LIB_DIR} ", atc dir " ${ATLAS_ATC_DIR})
include_directories(${ACL_LIB_DIR}/include/)
include_directories(${ATLAS_ACL_LIB_DIR}/include/)
if(ENABLE_D OR ENABLE_ACL)
# 310 mode
add_compile_definitions(ENABLE_DVPP_INTERFACE)
find_library(acl libascendcl.so ${ACL_LIB_DIR}/lib64 ${ATLAS_ACL_LIB_DIR}/lib64)
find_library(acl_retr libacl_retr.so ${ACL_LIB_DIR}/lib64 ${ATLAS_ACL_LIB_DIR}/lib64)
find_library(acl_cblas libacl_cblas.so ${ACL_LIB_DIR}/lib64 ${ATLAS_ACL_LIB_DIR}/lib64)
find_library(acl_dvpp libacl_dvpp.so ${ACL_LIB_DIR}/lib64 ${ATLAS_ACL_LIB_DIR}/lib64)
find_library(acl_runtime libruntime.so ${ACL_LIB_DIR}/lib64 ${ATLAS_ACL_LIB_DIR}/lib64)
find_library(ge_compiler libge_compiler.so ${ATC_DIR}/lib64 ${ATLAS_ATC_DIR}/lib64)
find_library(libplatform libplatform.so ${ATC_DIR}/lib64 ${ATLAS_ATC_DIR}/lib64)
find_library(libcompress libcompress.so ${ATC_DIR}/lib64 ${ATLAS_ATC_DIR}/lib64)
find_library(libopskernel libopskernel.so ${ATC_DIR}/lib64 ${ATLAS_ATC_DIR}/lib64)
find_library(libaicore_utils libaicore_utils.so ${ATC_DIR}/lib64 ${ATLAS_ATC_DIR}/lib64)
find_library(libaicpu_engine_common libaicpu_engine_common.so ${ATC_DIR}/lib64 ${ATLAS_ATC_DIR}/lib64)
find_library(atc_protobuf libascend_protobuf.so.3.8.0.0 ${ATC_DIR}/lib64 ${ATLAS_ATC_DIR}/lib64)
find_library(acl libascendcl.so ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
find_library(acl_cblas libacl_cblas.so ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
find_library(acl_dvpp libacl_dvpp.so ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
find_library(acl_runtime libruntime.so ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
find_library(ge_runner libge_runner.so ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
find_library(libplatform libplatform.so ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
find_library(libcompress libcompress.so ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
find_library(libopskernel libopskernel.so ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
find_library(libaicore_utils libaicore_utils.so ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
find_library(libaicpu_engine_common libaicpu_engine_common.so ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
find_library(atc_protobuf libascend_protobuf.so.3.8.0.0 ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
target_link_libraries(mindspore_shared_lib PRIVATE -Wl,--no-as-needed graph ${ge_compiler} ${atc_protobuf}
${acl_retr} ${acl_cblas} ${acl_dvpp} ${acl_runtime} ${libplatform} ${libcompress} ${libopskernel}
@ -123,7 +113,7 @@ endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(MINDSPORE_RPATH $ORIGIN)
if(ENABLE_D)
if(ENABLE_D OR ENABLE_ACL)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/nnae/latest/fwkacllib/lib64)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/fwkacllib/lib64)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/fwkacllib/lib64)
@ -131,17 +121,13 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
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)
elseif(ENABLE_ACL)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/nnae/latest/atc/lib64)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/atc/lib64)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/atc/lib64)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/nnae/latest/acllib/lib64)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/acllib/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)
endif()
set_target_properties(mindspore_shared_lib PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH})

View File

@ -132,6 +132,8 @@ bool KernelAdjust::ExistIndependent(const std::shared_ptr<session::KernelGraph>
void KernelAdjust::InsertIndepentParallel(const std::shared_ptr<session::KernelGraph> &kernel_graph_ptr,
const std::map<std::string, mindspore::ParameterPtr> &switch_loop_input,
std::vector<CNodePtr> *exec_order) {
MS_EXCEPTION_IF_NULL(kernel_graph_ptr);
MS_EXCEPTION_IF_NULL(exec_order);
device::ascend::AscendResourceMng &resource_manager = device::ascend::AscendResourceMng::GetInstance();
CNodePtr independent_switch_app = CreateStreamSwitchOp(kernel_graph_ptr, switch_loop_input, kIndependentStreamSwitch);
MS_EXCEPTION_IF_NULL(independent_switch_app);

View File

@ -265,12 +265,19 @@ bool HcclAdapter::InitKernelInfoStore(uint32_t device_id, std::string_view rank_
// get ops_kernel_builder
std::map<std::string, std::shared_ptr<ge::OpsKernelBuilder>> all_builders;
get_all_kernel_builder_(&all_builders);
if (all_builders.size() != 1) {
MS_LOG(EXCEPTION) << "Builders size should be 1 (hccl builder), but is " << all_builders.size();
auto iter = all_builders.find(kHcclOpsKernelInfoStore);
if (iter == all_builders.end()) {
std::string all_builders_name = "[";
for (const auto &it : all_builders) {
all_builders_name += it.first + " ";
}
all_builders_name += "]";
MS_LOG(EXCEPTION) << "Builders size " << all_builders.size() << ", cannot find " << kHcclOpsKernelInfoStore
<< ", full list of builders: " << all_builders_name;
}
MS_LOG(INFO) << "Get builder " << all_builders.begin()->first;
ops_kernel_builder_ = all_builders.begin()->second;
MS_LOG(INFO) << "Get builder " << iter->first;
ops_kernel_builder_ = iter->second;
MS_EXCEPTION_IF_NULL(ops_kernel_builder_);
// init ops_kernel_builder
auto options = GenHcclOptions(device_id, rank_id, rank_file);

View File

@ -20,8 +20,6 @@
#undef google
#include "hccl/hcom.h"
static constexpr const char *kHcclOpsKernelInfoStore = "ops_kernel_info_hccl";
extern "C" {
ge::Status Initialize(const std::map<std::string, std::string> &);
ge::Status Finalize();

View File

@ -23,6 +23,8 @@
#include "external/ge/ge_api_types.h"
#include "hccl/hccl.h"
constexpr const char *kHcclOpsKernelInfoStore = "ops_kernel_info_hccl";
namespace ge {
class OpsKernelBuilder;
class OpsKernelInfoStore;

View File

@ -23,8 +23,6 @@ from setuptools import setup, find_packages
from setuptools.command.egg_info import egg_info
from setuptools.command.build_py import build_py
version = '1.2.0'
backend_policy = os.getenv('BACKEND_POLICY')
device_target = os.getenv('BACKEND_TARGET')
commit_id = os.getenv('COMMIT_ID').replace("\n", "")
@ -39,6 +37,7 @@ def _read_file(filename):
return f.read()
version = _read_file('VERSION').replace("\n", "")
readme = _read_file('README.md')

View File

@ -22,13 +22,15 @@ PROJECT_PATH=${BASEPATH}/../../..
usage()
{
echo "Usage:"
echo "sh runtests.sh [-e ascend310|ascend910] [-n testcase_name] [-d n]"
echo "sh runtests.sh [-e ascend310|ascend910] [-n testcase_name] [-d n] [-t cpp|python] [-r path]"
echo ""
echo "Options:"
echo " -h Print usage"
echo " -e Device target, default is ascend310"
echo " -d Device ID, default is 0"
echo " -n Run single tesecase, default off"
echo " -t Type of MindSpore package to be tested, default is cpp"
echo " -r Path of mindspore package to be tested, default is {PROJECT_PATH}/output"
echo "to be continued ..."
}
@ -37,9 +39,12 @@ checkopts()
DEVICE_TARGET_OPT="ascend310"
DEVICE_ID_OPT=0
TASECASE_NAME_OPT=""
TEST_PATH=${PROJECT_PATH}/tests/st/cpp
PACKAGE_PATH=${PROJECT_PATH}/output
PACKAGE_TYPE="cpp"
# Process the options
while getopts 'he:d:n:' opt
while getopts 'he:d:n:t:r:' opt
do
case "${opt}" in
h)
@ -55,6 +60,19 @@ checkopts()
n)
TASECASE_NAME_OPT=$OPTARG
;;
t)
if [[ "X$OPTARG" == "Xcpp" || "X$OPTARG" == "Xpython" ]]; then
PACKAGE_TYPE="$OPTARG"
else
echo "Invalid value ${OPTARG} for option -t"
usage
exit 1
fi
;;
r)
PACKAGE_PATH=$OPTARG
echo "package path set to: ${OPTARG}"
;;
*)
echo "Undefined option: ${opt}"
usage
@ -64,11 +82,22 @@ checkopts()
}
checkopts "$@"
cd ${PROJECT_PATH}/tests/st/cpp
cd ${TEST_PATH}
MINDSPORE_PKG_PATH=`python -m pip show mindspore-ascend | grep Location | awk '{print $2"/mindspore"}' | xargs realpath`
if [[ "X${MINDSPORE_PKG_PATH}" == "X" ]]; then
MINDSPORE_PKG_PATH=${PROJECT_PATH}/build/package/mindspore:
# using installed or compiled whl packages, set env path by pip
if [[ "${PACKAGE_TYPE}" == "python" ]]; then
MINDSPORE_PKG_PATH=`python -m pip show mindspore-ascend | grep Location | awk '{print $2"/mindspore"}' | xargs realpath`
if [[ "X${MINDSPORE_PKG_PATH}" == "X" ]]; then
MINDSPORE_PKG_PATH=${PROJECT_PATH}/build/package/mindspore:
fi
elif [[ "${PACKAGE_TYPE}" == "cpp" ]]; then
# using acl tar package, extract tar package here
rm -rf mindspore_ascend*
PACKAGE_NAME_FULL=$(find "${PACKAGE_PATH}" -name "mindspore_ascend*.tar.gz")
PACKAGE_NAME=${PACKAGE_NAME_FULL##*/}
tar -xzf ${PACKAGE_PATH}/${PACKAGE_NAME}
MINDSPORE_PKG_PATH=$(find "${TEST_PATH}" -maxdepth 1 -name "mindspore_ascend*")
fi
export LD_LIBRARY_PATH=${MINDSPORE_PKG_PATH}:${MINDSPORE_PKG_PATH}/lib:${PROJECT_PATH}/tests/st/cpp:$LD_LIBRARY_PATH