Browse Source

!25785 change dump path to avoid invalid symbol in ci path

Merge pull request !25785 from yelihua/dev
tags/v1.6.0
i-robot Gitee 4 years ago
parent
commit
257bb3500d
3 changed files with 7 additions and 69 deletions
  1. +0
    -51
      mindspore/ccsrc/debug/data_dump/e2e_dump.cc
  2. +0
    -4
      mindspore/ccsrc/debug/data_dump/e2e_dump.h
  3. +7
    -14
      tests/st/dump/test_data_dump.py

+ 0
- 51
mindspore/ccsrc/debug/data_dump/e2e_dump.cc View File

@@ -404,55 +404,4 @@ bool E2eDump::DumpDirExists(const std::string &dump_path) {
}
return false;
}

bool E2eDump::MoveDumpFiles(const std::string &first_dir, const std::string &second_dir) {
DIR *d_handle = opendir(first_dir.c_str());
struct dirent *next_file;

while ((next_file = readdir(d_handle)) != nullptr) {
if (next_file->d_type != DT_REG) {
continue;
}
// build the path for each file in the folder
std::string file_name = next_file->d_name;
std::string old_file_path = first_dir + "/" + file_name;
std::string new_file_path = second_dir + "/" + file_name;
if (rename(old_file_path.c_str(), new_file_path.c_str()) != 0) {
if (closedir(d_handle) == -1) {
MS_LOG(WARNING) << "Dump dir " << first_dir << " close failed!";
}
return false;
}
}
if (closedir(d_handle) == -1) {
MS_LOG(WARNING) << "Dump dir " << first_dir << " close failed!";
}
return true;
}

bool E2eDump::DeleteDirContents(const std::string &dir_path) {
DIR *d_handle = opendir(dir_path.c_str());
struct dirent *next_file;

while ((next_file = readdir(d_handle)) != nullptr) {
if (next_file->d_type != DT_REG) {
continue;
}
// build the path for each file in the folder
std::string file_name = next_file->d_name;
std::string file_path = dir_path + "/" + file_name;
int res = remove(file_path.c_str());
if (res != 0) {
// Could not remove the file
if (closedir(d_handle) == -1) {
MS_LOG(WARNING) << "Dump dir " << dir_path << " close failed!";
}
return false;
}
}
if (closedir(d_handle) == -1) {
MS_LOG(WARNING) << "Dump dir " << dir_path << " close failed!";
}
return true;
}
} // namespace mindspore

+ 0
- 4
mindspore/ccsrc/debug/data_dump/e2e_dump.h View File

@@ -59,10 +59,6 @@ class E2eDump {

static bool DumpDirExists(const std::string &dump_path);

static bool MoveDumpFiles(const std::string &first_dir, const std::string &second_dir);

static bool DeleteDirContents(const std::string &dir_path);

private:
static void DumpOutput(const session::KernelGraph *graph, const std::string &dump_path, const Debugger *debugger);



+ 7
- 14
tests/st/dump/test_data_dump.py View File

@@ -57,8 +57,7 @@ y = np.array([[7, 8, 9], [10, 11, 12]]).astype(np.float32)
@security_off_wrap
def test_async_dump():
context.set_context(mode=context.GRAPH_MODE, device_target="Ascend")
pwd = os.getcwd()
with tempfile.TemporaryDirectory(dir=pwd) as tmp_dir:
with tempfile.TemporaryDirectory(dir='/tmp') as tmp_dir:
dump_path = os.path.join(tmp_dir, 'async_dump')
dump_config_path = os.path.join(tmp_dir, 'async_dump.json')
generate_dump_json(dump_path, dump_config_path, 'test_async_dump')
@@ -79,8 +78,7 @@ def test_async_dump():
def run_e2e_dump():
if sys.platform != 'linux':
return
pwd = os.getcwd()
with tempfile.TemporaryDirectory(dir=pwd) as tmp_dir:
with tempfile.TemporaryDirectory(dir='/tmp') as tmp_dir:
dump_path = os.path.join(tmp_dir, 'e2e_dump')
dump_config_path = os.path.join(tmp_dir, 'e2e_dump.json')
generate_dump_json(dump_path, dump_config_path, 'test_e2e_dump')
@@ -202,8 +200,7 @@ class ReluReduceMeanDenseRelu(Cell):
@security_off_wrap
def test_async_dump_net_multi_layer_mode1():
context.set_context(mode=context.GRAPH_MODE, device_target="Ascend")
pwd = os.getcwd()
with tempfile.TemporaryDirectory(dir=pwd) as tmp_dir:
with tempfile.TemporaryDirectory(dir='/tmp') as tmp_dir:
dump_path = os.path.join(tmp_dir, 'async_dump_net_multi_layer_mode1')
json_file_path = os.path.join(tmp_dir, "test_async_dump_net_multi_layer_mode1.json")
generate_dump_json(dump_path, json_file_path, 'test_async_dump_net_multi_layer_mode1')
@@ -251,8 +248,7 @@ def test_dump_with_diagnostic_path():
Data is expected to be dumped into MS_DIAGNOSTIC_DATA_PATH/debug_dump.
"""
context.set_context(mode=context.GRAPH_MODE, device_target="Ascend")
pwd = os.getcwd()
with tempfile.TemporaryDirectory(dir=pwd) as tmp_dir:
with tempfile.TemporaryDirectory(dir='/tmp') as tmp_dir:
dump_config_path = os.path.join(tmp_dir, 'e2e_dump.json')
generate_dump_json('', dump_config_path, 'test_e2e_dump')
os.environ['MINDSPORE_DUMP_CONFIG'] = dump_config_path
@@ -272,8 +268,7 @@ def run_e2e_dump_execution_graph():
"""Run e2e dump and check execution order."""
if sys.platform != 'linux':
return
pwd = os.getcwd()
with tempfile.TemporaryDirectory(dir=pwd) as tmp_dir:
with tempfile.TemporaryDirectory(dir='/tmp') as tmp_dir:
dump_path = os.path.join(tmp_dir, 'e2e_dump_exe_graph')
dump_config_path = os.path.join(tmp_dir, 'e2e_dump.json')
generate_dump_json(dump_path, dump_config_path, 'test_e2e_dump')
@@ -301,9 +296,8 @@ def run_overflow_dump():
"""Run async dump and generate overflow"""
if sys.platform != 'linux':
return
pwd = os.getcwd()
overflow_x = np.array([60000, 60000]).astype(np.float16)
with tempfile.TemporaryDirectory(dir=pwd) as tmp_dir:
with tempfile.TemporaryDirectory(dir='/tmp') as tmp_dir:
dump_path = os.path.join(tmp_dir, 'overflow_dump')
dump_config_path = os.path.join(tmp_dir, 'overflow_dump.json')
generate_dump_json_with_overflow(dump_path, dump_config_path, 'test_async_dump', 3)
@@ -354,10 +348,9 @@ def run_not_overflow_dump():
"""Run async dump and not generate overflow"""
if sys.platform != 'linux':
return
pwd = os.getcwd()
overflow_x = np.array([60000, 60000]).astype(np.float16)
overflow_y = np.array([2, 2]).astype(np.float16)
with tempfile.TemporaryDirectory(dir=pwd) as tmp_dir:
with tempfile.TemporaryDirectory(dir='/tmp') as tmp_dir:
dump_path = os.path.join(tmp_dir, 'overflow_dump')
dump_config_path = os.path.join(tmp_dir, 'overflow_dump.json')
generate_dump_json_with_overflow(dump_path, dump_config_path, 'test_async_dump', 3)


Loading…
Cancel
Save