Skip to content

Commit

Permalink
Push Sysbench RW and experiment codes
Browse files Browse the repository at this point in the history
  • Loading branch information
seokjeongeum committed Nov 9, 2024
1 parent 5ea6889 commit 7b489c3
Show file tree
Hide file tree
Showing 21 changed files with 2,636 additions and 732 deletions.
797 changes: 606 additions & 191 deletions VAETune/plot.ipynb

Large diffs are not rendered by default.

101 changes: 60 additions & 41 deletions VAETune/space.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,46 +32,65 @@ def __repr__(self) -> str:
r"\s*(\w+), Type: (\w+), Range: \[(\d+), (\d+)\], Default: (\d+)"
)
if __name__ == "__main__":
s = "sbrw_smac"
with open(f"repo/history_{s}.json") as f:
j = json.load(f)["data"]
c = sorted(j, key=lambda x: x["external_metrics"].get("tps", 0))[-1]
pprint.pprint((c["configuration"], c["external_metrics"]))
with open(f"repo/history_{s}_ground_truth.json") as f:
j = json.load(f)["data"]
c = sorted(j, key=lambda x: x["external_metrics"].get("tps", 0))[-1]
pprint.pprint((c["configuration"], c["external_metrics"]))
with open(f"logs/DBTune-{s}.log") as f:
for s in [
# "oltpbench_tatp",
# "oltpbench_tpcc",
# "oltpbench_wikipedia",
# "oltpbench_ycsb",
# "sbread",
"sbrw",
# "sbwrite",
# "twitter",
]:
with open(f"repo/history_{s}_smac.json") as f:
j = json.load(f)["data"]
c = sorted(j, key=lambda x: x["external_metrics"].get("tps", 0))[-1]
pprint.pprint((c["configuration"], c["external_metrics"]))
with open(f"repo/history_{s}_smac_ground_truth.json") as f:
j = json.load(f)["data"]
c = sorted(j, key=lambda x: x["external_metrics"].get("tps", 0))[-1]
pprint.pprint((c["configuration"], c["external_metrics"]))
c = c["configuration"]
config_text = f.read()
config_blocks = CONFIG_BLOCK_PATTERN.findall(config_text)
d = defaultdict(list)
for block in config_blocks:
hyperparameters = []
for match in HYPERPARAMETER_PATTERN.findall(block):
name, param_type, range_start, range_end, default = match
if param_type != "UniformInteger":
pprint.pprint(param_type)
if int(range_start) <= c[name] <= int(range_end):
d[name].append(1)
else:
d[name].append(0)
hyperparameters.append(
Hyperparameter(
name=name,
param_type=param_type,
param_range=[int(range_start), int(range_end)],
default=int(default),
l = []
with open(f"scripts/experiment/gen_knobs/mysql_all_197_32G.json") as f:
j2 = json.load(f)
for k in j2:
if j2[k]["type"] == "enum":
if c[k] == j2[k]["default"]:
l.append(1)
else:
l.append(0)
print(sum(l)/len(l))
with open(f"logs/DBTune-{s}_smac.log") as f:
config_text = f.read()
config_blocks = CONFIG_BLOCK_PATTERN.findall(config_text)
d = defaultdict(list)
for block in config_blocks:
hyperparameters = []
for match in HYPERPARAMETER_PATTERN.findall(block):
name, param_type, range_start, range_end, default = match
if param_type != "UniformInteger":
pprint.pprint(param_type)
if int(range_start) <= c[name] <= int(range_end):
d[name].append(1)
else:
d[name].append(0)
hyperparameters.append(
Hyperparameter(
name=name,
param_type=param_type,
param_range=[int(range_start), int(range_end)],
default=int(default),
)
)
)
# pprint.pprint(hyperparameters)
pd.DataFrame(
map(lambda x: (x[0], len(x[1]), sum(x[1]) / len(x[1])), d.items()),
columns=["key", "times", "proportion"],
).to_csv(f"{s}.csv", index=False)
print(d)
# pprint.pprint(
# list(
# map(lambda x: (x[0], x[1]["external_metrics"].get("tps", 0)), enumerate(j))
# )
# )
# pprint.pprint(hyperparameters)
pd.DataFrame(
map(lambda x: (x[0], len(x[1]), sum(x[1]) / len(x[1])), d.items()),
columns=["key", "times", "proportion"],
).to_csv(f"{s}.csv", index=False)
# print(d)
pprint.pprint(
list(
map(lambda x: (x[0], x[1]["external_metrics"].get("tps", 0)), enumerate(j))
)
)
Loading

0 comments on commit 7b489c3

Please sign in to comment.