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

Commit 4bb950c

Browse files
committed
Correct batch size pattern used on lmdb dataset benchmarking and make the error log more clear
1 parent 114e2ec commit 4bb950c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scripts/run_benchmark.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def obtain_model_file(self, model):
9797
src_model_file = "/".join([self.model_path, model, prototxt_file])
9898
if not os.path.isfile(src_model_file):
9999
logging.exception("template model file {} doesn't exist.".format(src_model_file))
100-
batch_size_pattern = re.compile(".*shape:.*") if self.dummy_data_use else re.compile(".*batch size:.*")
100+
batch_size_pattern = re.compile(".*shape:.*") if self.dummy_data_use else re.compile("^\s+batch_size:.*")
101101
# we only care about train phase batch size for benchmarking
102102
batch_size_cnt = 2 if self.dummy_data_use else 1
103103
if model not in self.bkm_batch_size or self.cpu_model not in self.bkm_batch_size[model]:
@@ -200,7 +200,7 @@ def obtain_average_fwd_bwd_time(self):
200200
if re.match(average_fwd_bwd_time_pattern, line):
201201
average_time = line.split()[-2]
202202
if average_time == "":
203-
logging.exception("Error: running intelcaffe failed, please check logs under: {}".format(result_file))
203+
logging.exception("Error: can't find average forward-backward time within logs, please check logs under: {}".format(result_file))
204204
average_time = float(average_time)
205205
else:
206206
start_iteration = 100
@@ -228,7 +228,7 @@ def obtain_batch_size(self):
228228
with open(log_file, 'r') as f:
229229
batch_size_pattern_time = re.compile(".*SetMinibatchSize.*")
230230
batch_size_pattern_dummy = re.compile(".*dim:.*")
231-
batch_size_pattern_real = re.compile(".*batch_size:.*")
231+
batch_size_pattern_real = re.compile("^\s+batch_size:.*")
232232
batch_size = ''
233233
for line in f.readlines():
234234
if re.match(batch_size_pattern_time, line) or re.match(batch_size_pattern_real, line) or re.match(batch_size_pattern_dummy, line):

0 commit comments

Comments
 (0)