!23509 Reading mindspore version from version.txt

Merge pull request !23509 from sabrinasun_59ee/version
This commit is contained in:
i-robot 2021-09-22 01:36:12 +00:00 committed by Gitee
commit 7cf815bcfa
8 changed files with 16 additions and 11 deletions

View File

@ -1529,17 +1529,17 @@ void AscendSession::Execute(const std::shared_ptr<KernelGraph> &kernel_graph, bo
}
auto runtime_instance = device::KernelRuntimeManager::Instance().GetKernelRuntime(kAscendDevice, device_id_);
MS_EXCEPTION_IF_NULL(runtime_instance);
if (is_task && is_task_sink) {
#ifndef ENABLE_SECURITY
if (is_task && is_task_sink) {
DumpSetup(kernel_graph);
#endif
}
#endif
bool ret_ok = runtime_instance->Run(*kernel_graph, is_task_sink);
if (is_task && is_task_sink) {
#ifndef ENABLE_SECURITY
if (is_task && is_task_sink) {
Dump(kernel_graph);
#endif
}
#endif
if (!ret_ok) {
#ifdef ENABLE_DUMP_IR
mindspore::RDR::TriggerAll();

View File

@ -1,5 +1,7 @@
include_directories(${CMAKE_SOURCE_DIR}/mindspore/ccsrc/debug/)
include_directories(${CMAKE_BINARY_DIR})
file(STRINGS "${CMAKE_SOURCE_DIR}/version.txt" MSVERSION)
add_definitions(-DMSVERSION=\"${MSVERSION}\")
set(_DEBUG_SRC_LIST
"${CMAKE_CURRENT_SOURCE_DIR}/anf_ir_dump.cc"

View File

@ -193,7 +193,7 @@ void DumpJsonParser::CopyMSCfgJsonToDir(uint32_t rank_id) {
auto context = MsContext::GetInstance();
MS_EXCEPTION_IF_NULL(context);
ms_info["device_target"] = context->get_param<std::string>(MS_CTX_DEVICE_TARGET);
ms_info["ms_version"] = "1.5.0";
ms_info["ms_version"] = MSVERSION;
const std::string file_path = realpath.value();
ChangeFileMode(file_path, S_IWUSR);
std::ofstream json_create(file_path);

View File

@ -117,7 +117,7 @@ void Debugger::Init(const uint32_t device_id, const std::string device_target) {
device_id_ = device_id;
MS_LOG(INFO) << "Debugger got device_target: " << device_target;
device_target_ = device_target;
version_ = "1.5.0";
version_ = MSVERSION;
}
bool IsTypeDebuggerSupported(TypeId type) {

View File

@ -48,7 +48,7 @@ DbgServices::~DbgServices() {
std::string DbgServices::GetVersion() {
MS_LOG(INFO) << "get version is called";
return "1.5.0";
return MSVERSION;
}
int32_t DbgServices::Initialize(std::string net_name, std::string dump_folder_path, bool is_sync_mode,

View File

@ -492,6 +492,7 @@ void AscendDeviceAddress::ClearDeviceMemory() {
AscendDeviceAddress::~AscendDeviceAddress() { ClearDeviceMemory(); }
#ifndef ENABLE_SECURITY
bool AscendDeviceAddress::DumpMemToFile(const std::string &filepath, const std::string &host_fmt,
const ShapeVector &host_shape, TypeId host_type, bool trans_flag) const {
bool ret = false;
@ -509,9 +510,7 @@ bool AscendDeviceAddress::DumpMemToFile(const std::string &filepath, const std::
MS_LOG(ERROR) << "Copy device mem to host failed";
return ret;
}
#ifndef ENABLE_SECURITY
ret = DumpJsonParser::DumpToFile(path, out_tensor->data_c(), host_size, host_shape, host_type);
#endif
} else {
auto host_tmp = std::vector<uint8_t>(size_);
auto ret_rt_memcpy = rtMemcpy(host_tmp.data(), size_, ptr_, size_, RT_MEMCPY_DEVICE_TO_HOST);
@ -520,13 +519,12 @@ bool AscendDeviceAddress::DumpMemToFile(const std::string &filepath, const std::
}
std::string path = filepath + '.' + format_;
MS_LOG(INFO) << "E2E Dump path is " << path;
#ifndef ENABLE_SECURITY
ret = DumpJsonParser::DumpToFile(path, host_tmp.data(), size_, host_shape, type_id_);
#endif
}
return ret;
}
#endif
#ifdef ENABLE_DEBUGGER
bool AscendDeviceAddress::LoadMemToHost(const std::string &tensor_name, int execution_order, const std::string &,

View File

@ -51,8 +51,10 @@ class AscendDeviceAddress : public DeviceAddress {
const std::string &format) const override;
void ClearDeviceMemory() override;
DeviceAddressType DeviceType() const override { return DeviceAddressType::kAscend; }
#ifndef ENABLE_SECURITY
bool DumpMemToFile(const std::string &filepath, const std::string &host_fmt, const ShapeVector &host_shape,
TypeId host_type, bool trans_flag) const override;
#endif
#ifdef ENABLE_DEBUGGER
bool LoadMemToHost(const std::string &tensor_name, int execution_order, const std::string &host_fmt,
const ShapeVector &host_shape, TypeId host_type, size_t slot, bool keep_prev) const override;

View File

@ -14,6 +14,9 @@ if(NOT ENABLE_GLIBCXX)
add_compile_definitions(_GLIBCXX_USE_CXX11_ABI=0)
endif()
file(STRINGS "${CMAKE_SOURCE_DIR}/version.txt" MSVERSION)
add_definitions(-DMSVERSION=\"${MSVERSION}\")
#add python lib and include for all ut executables;
message("PYTHON_INCLUDE_DIRS = ${PYTHON_INCLUDE_DIRS}")
message("PYTHON_LIBRARIES = ${PYTHON_LIBRARIES}")