forked from mindspore-Ecosystem/mindspore
c++ library adapt to latest ascend software
Signed-off-by: zhoufeng <zhoufeng54@huawei.com>
This commit is contained in:
parent
dafd26196e
commit
775795253e
|
@ -1 +1 @@
|
|||
Subproject commit 9a7b271674f343157c316b1455aee628c43cffdc
|
||||
Subproject commit c762dd5dcc207987d5b5d4ee520da3939222ec88
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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() {}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue