Skip to content

Commit

Permalink
added support for replace
Browse files Browse the repository at this point in the history
  • Loading branch information
magdalendobson committed Aug 9, 2024
1 parent 5f81ad0 commit c90fcc6
Show file tree
Hide file tree
Showing 8 changed files with 1,090 additions and 15 deletions.
15 changes: 4 additions & 11 deletions benchmark/streaming/compute_gt.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def get_next_set(tag_to_id: np.ndarray, entry):
return tag_to_id
case 'replace':
# replace key with value
for i in range(entry['to_replace_end'] - entry['to_replace_start']):
tag_to_id[i + entry['to_replace_start']] = entry['replace_ids_start'] + i
for i in range(entry['tags_end'] - entry['tags_start']):
tag_to_id[i + entry['tags_start']] = entry['ids_start'] + i
return tag_to_id
case 'search':
return tag_to_id
Expand All @@ -47,11 +47,7 @@ def output_gt(ds, tag_to_id, step, gt_cmdline, runbook_path):

ids = np.array(ids_list, dtype = np.uint32)
tags = np.array(tags_list, dtype = np.uint32)
print(len(tag_to_id))
print(len(ids))
print(len(tags))
print(ids)
print(tags)


data = ds.get_data_in_range(0, ds.nb)
data_slice = data[np.array(ids)]
Expand All @@ -64,13 +60,11 @@ def output_gt(ds, tag_to_id, step, gt_cmdline, runbook_path):
data_file = prefix + '.data'
gt_file = prefix + '.gt100'



with open(tags_file, 'wb') as tf:
one = 1
tf.write(tags.size.to_bytes(4, byteorder='little'))
tf.write(one.to_bytes(4, byteorder='little'))
tags.tofile(tf)
tags.tofile(tf)
with open(data_file, 'wb') as f:
f.write(ids.size.to_bytes(4, byteorder='little')) #npts
f.write(ds.d.to_bytes(4, byteorder='little'))
Expand Down Expand Up @@ -148,7 +142,6 @@ def main():
else:
tag_to_id = get_next_set(tag_to_id, entry)
if (entry['operation'] == 'search'):
print(tag_to_id)
output_gt(ds, tag_to_id, step, common_cmd, args.runbook_file)
step += 1

Expand Down
1 change: 0 additions & 1 deletion benchmark/streaming/load_runbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ def load_runbook(dataset_name, max_pts, runbook_file):
run_list = []
while i in runbook:
entry = runbook.get(i)
print(entry)
if entry['operation'] not in {'insert', 'delete', 'search', 'replace'}:
raise Exception('Undefined runbook operation')
if entry['operation'] in {'insert', 'delete'}:
Expand Down
4 changes: 4 additions & 0 deletions data_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ def cleaned_run_metric(run_metrics):
runbook_paths = [None]
if track == 'streaming':
runbook_paths = ['neurips23/streaming/simple_runbook.yaml',
'neurips23/streaming/simple_replace_runbook.yaml',
'neurips23/streaming/random_replace_runbook.yaml',
'neurips23/streaming/clustered_replace_runbook.yaml',
'neurips23/streaming/clustered_runbook.yaml',
'neurips23/streaming/clustered_runbook.yaml',
'neurips23/streaming/delete_runbook.yaml',
'neurips23/streaming/final_runbook.yaml',
Expand Down
Loading

0 comments on commit c90fcc6

Please sign in to comment.