Browse Source

modified the permisson of gpu profiler file and directory

tags/v1.1.0
gzhcv 5 years ago
parent
commit
35996eafcf
3 changed files with 6 additions and 4 deletions
  1. +1
    -1
      mindspore/ccsrc/profiler/device/gpu/data_saver.cc
  2. +3
    -3
      mindspore/profiler/parser/step_trace_parser.py
  3. +2
    -0
      mindspore/profiler/profiling.py

+ 1
- 1
mindspore/ccsrc/profiler/device/gpu/data_saver.cc View File

@@ -310,7 +310,7 @@ void DataSaver::WriteStepTrace(const std::string &saver_base_dir) {
void DataSaver::SetStepTraceOpName(ProfilingTraceInfo trace_op_name) { step_trace_op_name = trace_op_name; }

void DataSaver::ChangeFileMode(const std::string &file_path) {
if (chmod(common::SafeCStr(file_path), S_IRUSR | S_IWUSR) == -1) {
if (chmod(common::SafeCStr(file_path), S_IRUSR) == -1) {
MS_LOG(WARNING) << "Modify file:" << file_path << " to rw fail.";
return;
}


+ 3
- 3
mindspore/profiler/parser/step_trace_parser.py View File

@@ -329,7 +329,7 @@ class BaseStepTraceParser:
csv_writer.writerow(self._header)
for row_data in self._result:
csv_writer.writerow(row_data)
os.chmod(self._output_path, stat.S_IREAD)
os.chmod(self._output_path, stat.S_IRUSR)


class GpuStepTraceParser(BaseStepTraceParser):
@@ -363,7 +363,7 @@ class GpuStepTraceParser(BaseStepTraceParser):
try:
with open(output_path, 'w') as json_file:
json.dump(points, json_file)
os.chmod(output_path, stat.S_IREAD)
os.chmod(output_path, stat.S_IRUSR)
except (IOError, OSError) as err:
log.warning('Failed to save point info. %s', err)
raise ProfilerIOException
@@ -463,7 +463,7 @@ class AscendStepTraceParser(BaseStepTraceParser):
try:
with open(output_path, 'w') as json_file:
json.dump(points, json_file)
os.chmod(output_path, stat.S_IREAD)
os.chmod(output_path, stat.S_IRUSR)
except (IOError, OSError) as err:
log.warning('Failed to save point info. %s', err)
raise ProfilerIOException


+ 2
- 0
mindspore/profiler/profiling.py View File

@@ -14,6 +14,7 @@
# ============================================================================
"""Profiling api file."""
import os
import stat
import time
from enum import Enum

@@ -84,6 +85,7 @@ class Profiler:
self._output_path = os.path.join(self._output_path, "profiler")
if not os.path.exists(self._output_path):
os.makedirs(self._output_path, exist_ok=True)
os.chmod(self._output_path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
else:
logger.warning("The target dir already exists. "
"There may be some old profiling data, and they will be rewrote in the end.")


Loading…
Cancel
Save