Skip to content

Commit

Permalink
rebase from 7d3c5fc
Browse files Browse the repository at this point in the history
  • Loading branch information
bpkroth committed Jan 10, 2025
1 parent 91725b7 commit 48251a7
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mlos_bench/mlos_bench/tests/optimizers/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,28 @@ def mock_configs() -> list[dict]:
"""Mock configurations of earlier experiments."""
return [
{
"123": 2,
"vmSize": "Standard_B4ms",
"idle": "halt",
"kernel_sched_migration_cost_ns": 50000,
"kernel_sched_latency_ns": 1000000,
},
{
"123": 1,
"vmSize": "Standard_B4ms",
"idle": "halt",
"kernel_sched_migration_cost_ns": 40000,
"kernel_sched_latency_ns": 2000000,
},
{
"123": 3,
"vmSize": "Standard_B4ms",
"idle": "mwait",
"kernel_sched_migration_cost_ns": -1, # Special value
"kernel_sched_latency_ns": 3000000,
},
{
"123": 2,
"vmSize": "Standard_B2s",
"idle": "mwait",
"kernel_sched_migration_cost_ns": 200000,
Expand Down
4 changes: 4 additions & 0 deletions mlos_bench/mlos_bench/tests/optimizers/mock_opt_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def mock_configurations_no_defaults() -> list:
return [
(
{
"123": 2,
"vmSize": "Standard_B4ms",
"idle": "halt",
"kernel_sched_migration_cost_ns": 13112,
Expand All @@ -27,6 +28,7 @@ def mock_configurations_no_defaults() -> list:
),
(
{
"123": 3,
"vmSize": "Standard_B2ms",
"idle": "halt",
"kernel_sched_migration_cost_ns": 117026,
Expand All @@ -36,6 +38,7 @@ def mock_configurations_no_defaults() -> list:
),
(
{
"123": 1,
"vmSize": "Standard_B4ms",
"idle": "halt",
"kernel_sched_migration_cost_ns": 354785,
Expand All @@ -52,6 +55,7 @@ def mock_configurations(mock_configurations_no_defaults: list) -> list:
return [
(
{
"123": 2,
"vmSize": "Standard_B4ms",
"idle": "halt",
"kernel_sched_migration_cost_ns": -1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def _test_opt_update_max(
assert score["score"] == pytest.approx(99.99, 0.01)
assert tunables is not None
assert tunables.get_param_values() == {
"123": 2,
"vmSize": "Standard_B2s",
"idle": "mwait",
"kernel_sched_migration_cost_ns": 200000,
Expand Down
1 change: 1 addition & 0 deletions mlos_bench/mlos_bench/tests/storage/exp_load_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def test_exp_trial_update_categ(
"kernel_sched_latency_ns": "2000000",
"kernel_sched_migration_cost_ns": "-1",
"vmSize": "Standard_B4ms",
"123": 2,
}
],
[{"score": "99.9", "benchmark": "test"}],
Expand Down
11 changes: 11 additions & 0 deletions mlos_bench/mlos_bench/tests/tunable_groups_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@
"log": false
}
}
},
"integer_keyed": {
"cost": 0,
"params": {
"123": {
"description": "A parameter with an integer key",
"type": "int",
"default": 2,
"range": [1, 3]
}
}
}
}
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ def configuration_space() -> ConfigurationSpace:
weights=[0.5, 0.5],
default_value=TunableValueKind.SPECIAL,
),
UniformIntegerHyperparameter(
name="123",
lower=1,
upper=3,
default_value=2,
),
]
)
spaces.add(
Expand Down
11 changes: 11 additions & 0 deletions mlos_bench/mlos_bench/tests/tunables/tunables_str_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ def test_tunable_groups_str(tunable_groups: TunableGroups) -> None:
# Same as `tunable_groups` (defined in the `conftest.py` file), but in different order:
tunables_other = TunableGroups(
{
"integer_keyed": {
"cost": 0,
"params": {
"123": {
"description": "A parameter with an integer key",
"type": "int",
"default": 2,
"range": [1, 3],
}
},
},
"kernel": {
"cost": 1,
"params": {
Expand Down

0 comments on commit 48251a7

Please sign in to comment.