Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

Commit

Permalink
Correct batch size pattern used on lmdb dataset benchmarking and make…
Browse files Browse the repository at this point in the history
… the error log more clear
  • Loading branch information
manofmountain committed Jan 12, 2018
1 parent 114e2ec commit 4bb950c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/run_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def obtain_model_file(self, model):
src_model_file = "/".join([self.model_path, model, prototxt_file])
if not os.path.isfile(src_model_file):
logging.exception("template model file {} doesn't exist.".format(src_model_file))
batch_size_pattern = re.compile(".*shape:.*") if self.dummy_data_use else re.compile(".*batch size:.*")
batch_size_pattern = re.compile(".*shape:.*") if self.dummy_data_use else re.compile("^\s+batch_size:.*")
# we only care about train phase batch size for benchmarking
batch_size_cnt = 2 if self.dummy_data_use else 1
if model not in self.bkm_batch_size or self.cpu_model not in self.bkm_batch_size[model]:
Expand Down Expand Up @@ -200,7 +200,7 @@ def obtain_average_fwd_bwd_time(self):
if re.match(average_fwd_bwd_time_pattern, line):
average_time = line.split()[-2]
if average_time == "":
logging.exception("Error: running intelcaffe failed, please check logs under: {}".format(result_file))
logging.exception("Error: can't find average forward-backward time within logs, please check logs under: {}".format(result_file))
average_time = float(average_time)
else:
start_iteration = 100
Expand Down Expand Up @@ -228,7 +228,7 @@ def obtain_batch_size(self):
with open(log_file, 'r') as f:
batch_size_pattern_time = re.compile(".*SetMinibatchSize.*")
batch_size_pattern_dummy = re.compile(".*dim:.*")
batch_size_pattern_real = re.compile(".*batch_size:.*")
batch_size_pattern_real = re.compile("^\s+batch_size:.*")
batch_size = ''
for line in f.readlines():
if re.match(batch_size_pattern_time, line) or re.match(batch_size_pattern_real, line) or re.match(batch_size_pattern_dummy, line):
Expand Down

0 comments on commit 4bb950c

Please sign in to comment.