diff --git a/graphengine b/graphengine index 9a7b271674..c762dd5dcc 160000 --- a/graphengine +++ b/graphengine @@ -1 +1 @@ -Subproject commit 9a7b271674f343157c316b1455aee628c43cffdc +Subproject commit c762dd5dcc207987d5b5d4ee520da3939222ec88 diff --git a/mindspore/_check_deps_version.py b/mindspore/_check_deps_version.py index 2ee4c88c62..a6a26b5ac1 100644 --- a/mindspore/_check_deps_version.py +++ b/mindspore/_check_deps_version.py @@ -14,6 +14,7 @@ # ============================================================================ """dependency package version check""" from argparse import ArgumentParser +import sys def parse_args(): """ @@ -45,6 +46,11 @@ def check_deps_version(mindspore_version, supported_version): void """ try: + from hccl import sys_version as hccl_version + v = hccl_version.__sys_version__ + if v not in supported_version: + print(f"MindSpore version {mindspore_version} and \"hccl\" wheel package version {v} does not " + "match, reference to the match info on: https://www.mindspore.cn/install") import te v = te.__version__ if v not in supported_version: @@ -55,12 +61,9 @@ def check_deps_version(mindspore_version, supported_version): if v not in supported_version: print(f"MindSpore version {mindspore_version} and \"topi\" wheel package version {v} does not " "match, reference to the match info on: https://www.mindspore.cn/install") - from hccl import sys_version as hccl_version - v = hccl_version.__sys_version__ - if v not in supported_version: - print(f"MindSpore version {mindspore_version} and \"hccl\" wheel package version {v} does not " - "match, reference to the match info on: https://www.mindspore.cn/install") - except ImportError as e: + + # pylint: disable=broad-except + except Exception as e: print("CheckFailed: ", e.args) print("Minspore relies on the 3 whl packages of \"te\", \"topi\" and \"hccl\" in the \"fwkacllib\" " "folder of the Ascend 910 AI software package, please check whether they are installed " @@ -71,4 +74,5 @@ def main(): check_deps_version(args.mindspore_version, args.supported_version) if __name__ == "__main__": + sys.path = sys.path[1:] # avoid the impact of relative path env, only affect this process main() diff --git a/mindspore/ccsrc/CMakeLists.txt b/mindspore/ccsrc/CMakeLists.txt index 793a5df598..5a0ce3db70 100644 --- a/mindspore/ccsrc/CMakeLists.txt +++ b/mindspore/ccsrc/CMakeLists.txt @@ -253,6 +253,7 @@ if (ENABLE_D) 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_RA ra ${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 ${CMAKE_CURRENT_SOURCE_DIR}/runtime/device/ascend/profiling/profiling_callback_register.cc) @@ -260,7 +261,7 @@ if (ENABLE_D) target_link_options(ms_profile PRIVATE -Wl,-init,common_log_init) target_link_libraries(ms_profile -Wl,--start-group -Wl,--whole-archive ${PROFILING} -Wl,--no-whole-archive mindspore::protobuf -Wl,--end-group) target_link_libraries(mindspore ge_runtime ${CCE_LIB} ${RUNTIME_LIB} ${TSDCLIENT} ${HCCL} ${DATATRANSFER} - ${HCCL_ADPTER} ${REGISTER} -Wl,--no-as-needed ${OPTILING} ${HCCL_BUILDER}) + ${HCCL_ADPTER} ${REGISTER} -Wl,--no-as-needed ${OPTILING} ${HCCL_BUILDER} ${HCCL_RA}) target_link_libraries(mindspore -Wl,--start-group proto_input mindspore::protobuf -Wl,--end-group) elseif (CMAKE_SYSTEM_NAME MATCHES "Windows") target_link_libraries(mindspore -Wl,--start-group proto_input mindspore::protobuf mindspore::sentencepiece -Wl,--end-group) diff --git a/mindspore/ccsrc/cxx_api/graph/ms/ms_graph_impl.cc b/mindspore/ccsrc/cxx_api/graph/ms/ms_graph_impl.cc index 1c3116502c..60338f23aa 100644 --- a/mindspore/ccsrc/cxx_api/graph/ms/ms_graph_impl.cc +++ b/mindspore/ccsrc/cxx_api/graph/ms/ms_graph_impl.cc @@ -122,10 +122,13 @@ Status MsGraphImpl::FinalizeEnv() { MS_LOG(ERROR) << "Get Context failed!"; return FAILED; } + + InitPython(); // CloseTsd will release python git if (!context::CloseTsd(ms_context)) { MS_LOG(ERROR) << "CloseTsd failed!"; return FAILED; } + FinalizePython(); init_flag_ = false; MS_LOG(INFO) << "End finalize env"; diff --git a/mindspore/ccsrc/cxx_api/model/ms/ms_stub.cc b/mindspore/ccsrc/cxx_api/model/ms/ms_stub.cc index d4884dc726..50e2c46d73 100644 --- a/mindspore/ccsrc/cxx_api/model/ms/ms_stub.cc +++ b/mindspore/ccsrc/cxx_api/model/ms/ms_stub.cc @@ -13,15 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "toolchain/prof_mgr_core.h" -#include "utils/log_adapter.h" +#include "runtime/device/ascend/profiling/profiling_callback_register.h" -int ProfMgrStop(void *) { - MS_LOG(WARNING) << "Unsupported feature."; - return -1; +VMCallbackRegister &VMCallbackRegister::GetInstance() { + static VMCallbackRegister instance; + return instance; } -void *ProfMgrStartUp(const ProfMgrCfg *) { - MS_LOG(WARNING) << "Unsupported feature."; - return nullptr; +bool VMCallbackRegister::Registe(Status (*pRegProfCtrlCallback)(MsprofCtrlCallback), + Status (*pRegProfSetDeviceCallback)(MsprofSetDeviceCallback), + Status (*pRegProfReporterCallback)(MsprofReporterCallback), + Status (*pProfCommandHandle)(ProfCommandHandleType, void *, uint32_t)) { + return false; } + +void VMCallbackRegister::ForceMsprofilerInit() {} diff --git a/mindspore/ccsrc/cxx_api/python_utils.cc b/mindspore/ccsrc/cxx_api/python_utils.cc index b9d24d9547..86af6599ba 100644 --- a/mindspore/ccsrc/cxx_api/python_utils.cc +++ b/mindspore/ccsrc/cxx_api/python_utils.cc @@ -119,4 +119,16 @@ void RegAllOp() { } bool PythonIsInited() { return Py_IsInitialized() != 0; } + +void InitPython() { + if (!PythonIsInited()) { + Py_Initialize(); + } +} + +void FinalizePython() { + if (PythonIsInited()) { + Py_Finalize(); + } +} } // namespace mindspore::api diff --git a/mindspore/ccsrc/cxx_api/python_utils.h b/mindspore/ccsrc/cxx_api/python_utils.h index 4f0487b077..bbe40f78d4 100644 --- a/mindspore/ccsrc/cxx_api/python_utils.h +++ b/mindspore/ccsrc/cxx_api/python_utils.h @@ -20,6 +20,8 @@ namespace mindspore::api { void RegAllOp(); bool PythonIsInited(); +void InitPython(); +void FinalizePython(); } // namespace mindspore::api #endif // MINDSPORE_CCSRC_CXXAPI_PYTHON_UTILS_H