Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test non-alpha keyed params #600

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions mlos_bench/mlos_bench/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@
"range": [0, 1000000000]
}
}
},
"integer_keyed": {
"cost": 0,
"params": {
"123": {
"description": "A parameter with an integer key",
"type": "int",
"default": 2,
"range": [1, 3]
}
}
}
}
"""
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 @@ -21,18 +21,21 @@ def mock_configurations_no_defaults() -> list:
"""
return [
({
"123": 2,
"vmSize": "Standard_B4ms",
"idle": "halt",
"kernel_sched_migration_cost_ns": 13111,
"kernel_sched_latency_ns": 796233790,
}, 88.88),
({
"123": 3,
"vmSize": "Standard_B2ms",
"idle": "halt",
"kernel_sched_migration_cost_ns": 117025,
"kernel_sched_latency_ns": 149827706,
}, 66.66),
({
"123": 1,
"vmSize": "Standard_B4ms",
"idle": "halt",
"kernel_sched_migration_cost_ns": 354784,
Expand All @@ -48,6 +51,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 @@ -25,24 +25,28 @@ def mock_configs() -> List[dict]:
"""
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': 100000,
'kernel_sched_latency_ns': 3000000,
},
{
'123': 2,
'vmSize': 'Standard_B2s',
'idle': 'mwait',
'kernel_sched_migration_cost_ns': 200000,
Expand Down Expand Up @@ -109,7 +113,8 @@ def _test_opt_update_max(opt: Optimizer, configs: List[dict],
"vmSize": "Standard_B2s",
"idle": "mwait",
"kernel_sched_migration_cost_ns": 200000,
'kernel_sched_latency_ns': 4000000,
"kernel_sched_latency_ns": 4000000,
"123": 2,
}


Expand Down
3 changes: 2 additions & 1 deletion mlos_bench/mlos_bench/tests/storage/exp_load_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ def test_exp_trial_update_categ(exp_storage_memory_sql: Storage.Experiment,
'idle': 'halt',
'kernel_sched_latency_ns': '2000000',
'kernel_sched_migration_cost_ns': '-1',
'vmSize': 'Standard_B4ms'
'vmSize': 'Standard_B4ms',
'123': '2',
}],
[99.9],
[Status.SUCCEEDED]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ def configuration_space() -> ConfigurationSpace:
"idle": ["halt", "mwait", "noidle"],
"kernel_sched_migration_cost_ns": (-1, 500000),
"kernel_sched_latency_ns": (0, 1000000000),
"123": (1, 3),
})

spaces["vmSize"].default_value = "Standard_B4ms"
spaces["idle"].default_value = "halt"
spaces["kernel_sched_migration_cost_ns"].default_value = -1
spaces["kernel_sched_latency_ns"].default_value = 2000000
spaces["123"].default_value = 2

return spaces

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 @@ -18,6 +18,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
Loading