From e65aba50ada7b9ffb7e9db58b827ec5740412b2f Mon Sep 17 00:00:00 2001 From: Evgeny Date: Thu, 3 Dec 2020 05:30:27 -0500 Subject: [PATCH] SWDEV-241265 : fixing scripts Change-Id: Id7fcc309d0003bc72e972976e1944afd6488001d [ROCm/rocprofiler commit: 249b0c2b2693e6142e0c150103bf6539e893c821] --- projects/rocprofiler/bin/mem_manager.py | 23 ++++++++++++----------- projects/rocprofiler/bin/rpl_run.sh | 4 ++++ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/projects/rocprofiler/bin/mem_manager.py b/projects/rocprofiler/bin/mem_manager.py index 5c15c9702d..7263a73b88 100755 --- a/projects/rocprofiler/bin/mem_manager.py +++ b/projects/rocprofiler/bin/mem_manager.py @@ -55,17 +55,18 @@ class MemManager: # Parsing the mapping of HSA agent and memory pool handles def parse_hsa_handles(self, infile): - inp = open(infile, 'r') - cpu_agent_ptrn = re.compile(r'(0x[0-9a-fA-F]+) agent cpu') - gpu_agent_ptrn = re.compile(r'(0x[0-9a-fA-F]+) agent gpu') - for line in inp.readlines(): - m_cpu = cpu_agent_ptrn.match(line) - if m_cpu: - self.hsa_agent_types[str(int(m_cpu.group(1),16))] = 0# "cpu" - m_gpu = gpu_agent_ptrn.match(line) - if m_gpu: - self.hsa_agent_types[str(int(m_gpu.group(1),16))] = 1 #"gpu" - inp.close() + if os.path.exists(infile): + inp = open(infile, 'r') + cpu_agent_ptrn = re.compile(r'(0x[0-9a-fA-F]+) agent cpu') + gpu_agent_ptrn = re.compile(r'(0x[0-9a-fA-F]+) agent gpu') + for line in inp.readlines(): + m_cpu = cpu_agent_ptrn.match(line) + if m_cpu: + self.hsa_agent_types[str(int(m_cpu.group(1),16))] = 0 # "cpu" + m_gpu = gpu_agent_ptrn.match(line) + if m_gpu: + self.hsa_agent_types[str(int(m_gpu.group(1),16))] = 1 # "gpu" + inp.close() # register alloc and memcpy API calls # ['BeginNs', 'EndNs', 'pid', 'tid', 'Name', 'args', 'Index', 'Data'], diff --git a/projects/rocprofiler/bin/rpl_run.sh b/projects/rocprofiler/bin/rpl_run.sh index ce27258b6b..4f15b97c82 100755 --- a/projects/rocprofiler/bin/rpl_run.sh +++ b/projects/rocprofiler/bin/rpl_run.sh @@ -468,6 +468,10 @@ if [ "$ARG_CK" = "-" ] ; then fatal "Wrong option '$ARG_IN'" fi +if [ "$GEN_STATS" = "1" -a "$ROCP_TIMESTAMP_ON" = "0" ] ; then + fatal "Wrong options, stats enabled with disabled timestamps" +fi + if [ -z "$INPUT_FILE" ] ; then input_base="results" input_type="none"