Skip to content

Commit

Permalink
Fix for benchmark runner to handle parameter sweeps of multiple data …
Browse files Browse the repository at this point in the history
…types (#5938)

PR fixes parameter sweeps of benchmarks when they have a different type, so for example: 

```
--cuml-param-sweep init=random,scalable-k-means++
```

Authors:
  - Dante Gama Dessavre (https://github.com/dantegd)

Approvers:
  - Divye Gala (https://github.com/divyegala)

URL: #5938
  • Loading branch information
dantegd authored Jun 24, 2024
1 parent 205748c commit 751ba82
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions python/cuml/benchmark/run_benchmarks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019-2023, NVIDIA CORPORATION.
# Copyright (c) 2019-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -49,9 +49,18 @@ def extract_param_overrides(params_to_sweep):
single_param_lists = []
for p in params_to_sweep:
key, val_string = p.split("=")
vals = json.loads(val_string)
vals = val_string.split(",")

if not isinstance(vals, list):
vals = [vals] # Handle single-element sweep cleanly

# use json loads to convert to correct data type
for idx, val in enumerate(vals):
try:
vals[idx] = json.loads(val)
except ValueError:
pass

single_param_lists.append([(key, val) for val in vals])

# Create dicts with the cartesian product of all arg-based lists
Expand Down

0 comments on commit 751ba82

Please sign in to comment.