!27209 Fix issue ReadTensor returns empty on cloud when file exists
Merge pull request !27209 from parastooashtari/offline_dbg_bug
This commit is contained in:
commit
2ae6aec58e
|
@ -763,7 +763,10 @@ void DebugServices::ProcessConvertToHostFormat(const std::vector<std::string> &f
|
|||
}
|
||||
struct dirent *dir = nullptr;
|
||||
while ((dir = readdir(d_handle)) != nullptr) {
|
||||
if (dir->d_type == DT_REG) {
|
||||
struct stat st;
|
||||
std::string name = real_dump_iter_dir + std::string("/") + std::string(dir->d_name);
|
||||
int ret = stat(name.c_str(), &st);
|
||||
if (ret == 0 && S_ISREG(st.st_mode)) {
|
||||
std::string candidate = dir->d_name;
|
||||
for (const std::string &file_to_find : files_after_convert_in_dir) {
|
||||
std::string file_n = file_to_find;
|
||||
|
@ -874,7 +877,10 @@ void DebugServices::ProcessConvertList(const std::string &prefix_dump_file_name,
|
|||
DIR *d = opendir(specific_dump_dir.c_str());
|
||||
struct dirent *dir = nullptr;
|
||||
while ((dir = readdir(d)) != nullptr) {
|
||||
if (dir->d_type != DT_REG) {
|
||||
struct stat st;
|
||||
std::string name = specific_dump_dir + std::string("/") + std::string(dir->d_name);
|
||||
int ret = stat(name.c_str(), &st);
|
||||
if (!(ret == 0 && S_ISREG(st.st_mode))) {
|
||||
continue;
|
||||
}
|
||||
std::string file_name = dir->d_name;
|
||||
|
@ -970,7 +976,10 @@ std::vector<uint32_t> DebugServices::GetDumpRankIdList() {
|
|||
}
|
||||
struct dirent *dir = nullptr;
|
||||
while ((dir = readdir(d_handle)) != nullptr) {
|
||||
if (dir->d_type == DT_DIR) {
|
||||
struct stat st;
|
||||
std::string name = dump_dir + std::string("/") + std::string(dir->d_name);
|
||||
int ret = stat(name.c_str(), &st);
|
||||
if (ret == 0 && S_ISDIR(st.st_mode)) {
|
||||
std::string rank_dir_name = dir->d_name;
|
||||
if (GetRankOrGraphId("rank", rank_dir_name) != UINT32_MAX) {
|
||||
rank_id_list.push_back(GetRankOrGraphId("rank", rank_dir_name));
|
||||
|
@ -994,7 +1003,10 @@ void DebugServices::CheckDumpGraphIdList(std::vector<uint32_t> rank_id_list) {
|
|||
}
|
||||
struct dirent *direc = nullptr;
|
||||
while ((direc = readdir(d_handle_rank)) != nullptr) {
|
||||
if (direc->d_type == DT_DIR) {
|
||||
struct stat st;
|
||||
std::string name = abspath + std::string("/") + std::string(direc->d_name);
|
||||
int ret = stat(name.c_str(), &st);
|
||||
if (ret == 0 && S_ISDIR(st.st_mode)) {
|
||||
std::string graph_dir = direc->d_name;
|
||||
if (graph_dir == "." || graph_dir == "..") {
|
||||
continue;
|
||||
|
@ -1231,7 +1243,10 @@ void DebugServices::ReadDumpedTensorSync(const std::string &prefix_dump_file_nam
|
|||
} else {
|
||||
struct dirent *dir = nullptr;
|
||||
while ((dir = readdir(d)) != nullptr) {
|
||||
if (dir->d_type == DT_REG) {
|
||||
struct stat st;
|
||||
std::string name = abspath + std::string("/") + std::string(dir->d_name);
|
||||
int ret = stat(name.c_str(), &st);
|
||||
if (ret == 0 && S_ISREG(st.st_mode)) {
|
||||
std::string file_name = dir->d_name;
|
||||
std::string stripped_file_name = GetStrippedFilename(file_name);
|
||||
if (stripped_file_name.empty()) {
|
||||
|
@ -1363,7 +1378,10 @@ void DebugServices::ProcessTensorDataSync(const std::vector<std::tuple<std::stri
|
|||
} else {
|
||||
struct dirent *dir = nullptr;
|
||||
while ((dir = readdir(d)) != nullptr) {
|
||||
if (dir->d_type == DT_REG) {
|
||||
struct stat st;
|
||||
std::string name = abspath + std::string("/") + std::string(dir->d_name);
|
||||
int ret = stat(name.c_str(), &st);
|
||||
if (ret == 0 && S_ISREG(st.st_mode)) {
|
||||
std::string file_name = dir->d_name;
|
||||
for (auto &node : proto_to_dump) {
|
||||
std::string dump_name = std::get<1>(node);
|
||||
|
@ -1607,7 +1625,10 @@ bool DebugServices::CheckOpOverflow(std::string node_name_to_find, unsigned int
|
|||
} else {
|
||||
struct dirent *dir = nullptr;
|
||||
while ((dir = readdir(d)) != nullptr) {
|
||||
if (dir->d_type == DT_REG) {
|
||||
struct stat st;
|
||||
std::string name = abspath + std::string("/") + std::string(dir->d_name);
|
||||
int ret = stat(name.c_str(), &st);
|
||||
if (ret == 0 && S_ISREG(st.st_mode)) {
|
||||
// form fully qualified filename
|
||||
std::string file_path = overflow_bin_path;
|
||||
std::string file_name = dir->d_name;
|
||||
|
|
|
@ -80,11 +80,13 @@ void DebugActor::DebugOnStepBegin(std::vector<KernelGraphPtr> graphs, std::vecto
|
|||
MS_EXCEPTION_IF_NULL(op_context);
|
||||
MS_EXCEPTION_IF_NULL(from_aid);
|
||||
#ifdef ENABLE_DEBUGGER
|
||||
// First graph is the dataset graph when dataset_sink_mode = True
|
||||
auto graph = graphs[0];
|
||||
std::string error_info = CheckDatasetSinkMode(graph);
|
||||
if (!error_info.empty()) {
|
||||
SET_OPCONTEXT_FAIL_RET_WITH_ERROR((*op_context), error_info);
|
||||
if (!graphs.empty()) {
|
||||
// First graph is the dataset graph when dataset_sink_mode = True
|
||||
auto graph = graphs[0];
|
||||
std::string error_info = CheckDatasetSinkMode(graph);
|
||||
if (!error_info.empty()) {
|
||||
SET_OPCONTEXT_FAIL_RET_WITH_ERROR((*op_context), error_info);
|
||||
}
|
||||
}
|
||||
auto debugger = Debugger::GetInstance();
|
||||
if (debugger != nullptr && debugger->DebuggerBackendEnabled()) {
|
||||
|
|
Loading…
Reference in New Issue