forked from huawei/mindspore2022
change dump path to avoid invalid symbol in path
This commit is contained in:
parent
0f6e245dd4
commit
f9f2058055
|
|
@ -387,55 +387,4 @@ bool E2eDump::DumpDirExists(const std::string &dump_path) {
|
||||||
}
|
}
|
||||||
return false;
|
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
|
} // namespace mindspore
|
||||||
|
|
|
||||||
|
|
@ -57,10 +57,6 @@ class E2eDump {
|
||||||
|
|
||||||
static bool DumpDirExists(const std::string &dump_path);
|
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:
|
private:
|
||||||
static void DumpOutput(const session::KernelGraph *graph, const std::string &dump_path, const Debugger *debugger);
|
static void DumpOutput(const session::KernelGraph *graph, const std::string &dump_path, const Debugger *debugger);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,7 @@ y = np.array([[7, 8, 9], [10, 11, 12]]).astype(np.float32)
|
||||||
@security_off_wrap
|
@security_off_wrap
|
||||||
def test_async_dump():
|
def test_async_dump():
|
||||||
context.set_context(mode=context.GRAPH_MODE, device_target="Ascend")
|
context.set_context(mode=context.GRAPH_MODE, device_target="Ascend")
|
||||||
pwd = os.getcwd()
|
with tempfile.TemporaryDirectory(dir='/tmp') as tmp_dir:
|
||||||
with tempfile.TemporaryDirectory(dir=pwd) as tmp_dir:
|
|
||||||
dump_path = os.path.join(tmp_dir, 'async_dump')
|
dump_path = os.path.join(tmp_dir, 'async_dump')
|
||||||
dump_config_path = os.path.join(tmp_dir, 'async_dump.json')
|
dump_config_path = os.path.join(tmp_dir, 'async_dump.json')
|
||||||
generate_dump_json(dump_path, dump_config_path, 'test_async_dump')
|
generate_dump_json(dump_path, dump_config_path, 'test_async_dump')
|
||||||
|
|
@ -79,8 +78,7 @@ def test_async_dump():
|
||||||
def run_e2e_dump():
|
def run_e2e_dump():
|
||||||
if sys.platform != 'linux':
|
if sys.platform != 'linux':
|
||||||
return
|
return
|
||||||
pwd = os.getcwd()
|
with tempfile.TemporaryDirectory(dir='/tmp') as tmp_dir:
|
||||||
with tempfile.TemporaryDirectory(dir=pwd) as tmp_dir:
|
|
||||||
dump_path = os.path.join(tmp_dir, 'e2e_dump')
|
dump_path = os.path.join(tmp_dir, 'e2e_dump')
|
||||||
dump_config_path = os.path.join(tmp_dir, 'e2e_dump.json')
|
dump_config_path = os.path.join(tmp_dir, 'e2e_dump.json')
|
||||||
generate_dump_json(dump_path, dump_config_path, 'test_e2e_dump')
|
generate_dump_json(dump_path, dump_config_path, 'test_e2e_dump')
|
||||||
|
|
@ -202,8 +200,7 @@ class ReluReduceMeanDenseRelu(Cell):
|
||||||
@security_off_wrap
|
@security_off_wrap
|
||||||
def test_async_dump_net_multi_layer_mode1():
|
def test_async_dump_net_multi_layer_mode1():
|
||||||
context.set_context(mode=context.GRAPH_MODE, device_target="Ascend")
|
context.set_context(mode=context.GRAPH_MODE, device_target="Ascend")
|
||||||
pwd = os.getcwd()
|
with tempfile.TemporaryDirectory(dir='/tmp') as tmp_dir:
|
||||||
with tempfile.TemporaryDirectory(dir=pwd) as tmp_dir:
|
|
||||||
dump_path = os.path.join(tmp_dir, 'async_dump_net_multi_layer_mode1')
|
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")
|
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')
|
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.
|
Data is expected to be dumped into MS_DIAGNOSTIC_DATA_PATH/debug_dump.
|
||||||
"""
|
"""
|
||||||
context.set_context(mode=context.GRAPH_MODE, device_target="Ascend")
|
context.set_context(mode=context.GRAPH_MODE, device_target="Ascend")
|
||||||
pwd = os.getcwd()
|
with tempfile.TemporaryDirectory(dir='/tmp') as tmp_dir:
|
||||||
with tempfile.TemporaryDirectory(dir=pwd) as tmp_dir:
|
|
||||||
dump_config_path = os.path.join(tmp_dir, 'e2e_dump.json')
|
dump_config_path = os.path.join(tmp_dir, 'e2e_dump.json')
|
||||||
generate_dump_json('', dump_config_path, 'test_e2e_dump')
|
generate_dump_json('', dump_config_path, 'test_e2e_dump')
|
||||||
os.environ['MINDSPORE_DUMP_CONFIG'] = dump_config_path
|
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."""
|
"""Run e2e dump and check execution order."""
|
||||||
if sys.platform != 'linux':
|
if sys.platform != 'linux':
|
||||||
return
|
return
|
||||||
pwd = os.getcwd()
|
with tempfile.TemporaryDirectory(dir='/tmp') as tmp_dir:
|
||||||
with tempfile.TemporaryDirectory(dir=pwd) as tmp_dir:
|
|
||||||
dump_path = os.path.join(tmp_dir, 'e2e_dump_exe_graph')
|
dump_path = os.path.join(tmp_dir, 'e2e_dump_exe_graph')
|
||||||
dump_config_path = os.path.join(tmp_dir, 'e2e_dump.json')
|
dump_config_path = os.path.join(tmp_dir, 'e2e_dump.json')
|
||||||
generate_dump_json(dump_path, dump_config_path, 'test_e2e_dump')
|
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"""
|
"""Run async dump and generate overflow"""
|
||||||
if sys.platform != 'linux':
|
if sys.platform != 'linux':
|
||||||
return
|
return
|
||||||
pwd = os.getcwd()
|
|
||||||
overflow_x = np.array([60000, 60000]).astype(np.float16)
|
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_path = os.path.join(tmp_dir, 'overflow_dump')
|
||||||
dump_config_path = os.path.join(tmp_dir, 'overflow_dump.json')
|
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)
|
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"""
|
"""Run async dump and not generate overflow"""
|
||||||
if sys.platform != 'linux':
|
if sys.platform != 'linux':
|
||||||
return
|
return
|
||||||
pwd = os.getcwd()
|
|
||||||
overflow_x = np.array([60000, 60000]).astype(np.float16)
|
overflow_x = np.array([60000, 60000]).astype(np.float16)
|
||||||
overflow_y = np.array([2, 2]).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_path = os.path.join(tmp_dir, 'overflow_dump')
|
||||||
dump_config_path = os.path.join(tmp_dir, 'overflow_dump.json')
|
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)
|
generate_dump_json_with_overflow(dump_path, dump_config_path, 'test_async_dump', 3)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue