forked from mindspore-Ecosystem/mindspore
!15992 [Debugger] Add a dir check to offline debugger in async mode
From: @tina_mengting_zhang Reviewed-by: @john_tzanakakis,@mikef Signed-off-by: @john_tzanakakis
This commit is contained in:
commit
c88bc17d94
|
@ -14,9 +14,12 @@
|
|||
# ============================================================================
|
||||
"""Module to provide conversion capabalities from .timestamp async dump files to .npy."""
|
||||
import site
|
||||
site.addsitedir("/usr/local/Ascend/toolkit/tools/operator_cmp/compare/")
|
||||
#pylint: disable=wrong-import-position
|
||||
import os
|
||||
DIR_PATH = "/usr/local/Ascend/toolkit/tools/operator_cmp/compare/"
|
||||
if not os.path.exists(DIR_PATH):
|
||||
raise ValueError("Directory " + DIR_PATH + " does not exist. Please install Ascend toolkit.")
|
||||
site.addsitedir(DIR_PATH)
|
||||
#pylint: disable=wrong-import-position
|
||||
import argparse
|
||||
import csv
|
||||
from dump_data_parser import DumpDataParser
|
||||
|
|
|
@ -666,16 +666,23 @@ void DebugServices::ReadDumpedTensor(std::vector<std::string> backend_name, std:
|
|||
}
|
||||
closedir(d);
|
||||
} else {
|
||||
bool found = false;
|
||||
// if async mode
|
||||
for (const std::string &file_path : async_file_pool) {
|
||||
if (file_path.find(prefix_dump_file_name) != std::string::npos &&
|
||||
file_path.find(".output." + std::to_string(slot[i])) != std::string::npos) {
|
||||
found = true;
|
||||
shape.clear();
|
||||
ReadTensorFromNpy(file_path, &type_name, &data_size, &shape, &buffer);
|
||||
AddToTensorData(backend_name[i], slot[i], iteration[i], device_id[i], root_graph_id[i], data_size, type_name,
|
||||
shape, buffer, result_list);
|
||||
}
|
||||
}
|
||||
// If no npy file is found, add empty tensor data.
|
||||
if (!found) {
|
||||
AddToTensorData(backend_name[i], slot[i], iteration[i], device_id[i], root_graph_id[i], 0, type_name, shape,
|
||||
buffer, result_list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue