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

Merge pull request !24354 from yelihua/r15
This commit is contained in:
i-robot 2021-11-02 13:18:25 +00:00 committed by Gitee
commit c8f4692228
3 changed files with 6 additions and 66 deletions

View File

@ -387,55 +387,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

View File

@ -57,10 +57,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);

View File

@ -32,7 +32,7 @@ from mindspore.nn import SoftmaxCrossEntropyWithLogits
from mindspore.nn import Momentum
from mindspore.nn import TrainOneStepCell
from mindspore.nn import WithLossCell
from dump_test_utils import generate_dump_json
from tests.st.dump.dump_test_utils import generate_dump_json
from tests.security_utils import security_off_wrap
@ -56,8 +56,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')
@ -74,8 +73,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')
@ -186,8 +184,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')
@ -234,8 +231,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
@ -253,8 +249,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')