Skip to content

Commit 9698e00

Browse files
committed
Runner changes (OMP env only for XGBoost and json decode error handling)
1 parent a17644e commit 9698e00

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

runner.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,11 @@ def is_ht_enabled():
167167

168168
cpu_count = multiprocessing.cpu_count()
169169
if is_ht_enabled():
170-
env['OMP_NUM_THREADS'] = str(cpu_count//2)
170+
omp_num_threads = str(cpu_count // 2)
171+
omp_places = f'0:{cpu_count}:1'
171172
else:
172-
env['OMP_NUM_THREADS'] = str(cpu_count)
173+
omp_num_threads = str(cpu_count)
174+
omp_places = ''
173175

174176
# get parameters that are common for all cases
175177
common_params = config['common']
@@ -262,6 +264,13 @@ class GenerationArgs:
262264
'Unknown dataset. Only synthetics datasets '
263265
'and csv/npy files are supported now')
264266
for lib in libs:
267+
if lib == 'xgboost':
268+
env['OMP_NUM_THREADS'] = omp_num_threads
269+
env['OMP_PLACES'] = omp_places
270+
else:
271+
env['OMP_NUM_THREADS'] = ''
272+
env['OMP_PLACES'] = ''
273+
265274
for i, case in enumerate(cases):
266275
command = f'python {lib}/{algorithm}.py --batch {batch} ' \
267276
+ f'--arch {hostname} --header --output-format ' \
@@ -274,7 +283,10 @@ class GenerationArgs:
274283
stdout, stderr = read_output_from_command(command)
275284
stderr = filter_stderr(stderr)
276285
if args.output_format == 'json':
277-
json_result['results'].extend(json.loads(stdout))
286+
try:
287+
json_result['results'].extend(json.loads(stdout))
288+
except json.JSONDecodeError:
289+
pass
278290
elif args.output_format == 'csv':
279291
csv_result += stdout + '\n'
280292
if stderr != '':

0 commit comments

Comments
 (0)