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

updated LRE solutions with crude physical run time estimate #52

Merged
merged 1 commit into from
Dec 9, 2024
Merged
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
138 changes: 138 additions & 0 deletions scripts/fixes/update_LRE_solns_to_have_overall_run_time.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
#!/usr/bin/env python3


# Copyright 2024 L3Harris Technologies, Inc.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.



import argparse
import requests

import logging
logging.basicConfig(level=logging.INFO)

import json
import sys
sys.path.append("../")
import os
import datetime

import time

# additional package(s)
import jsonschema



import json
import requests
import pprint

import sys
sys.path.append("../")


# additional package(s):
# import jsonschema






def main(args):
input_directory = args.input_dir
output_directory = args.output_dir

logging.info(f"started at: {datetime.datetime.now().isoformat()}")
logging.info(f"input directory: {input_directory}")
logging.info(f"output directory: {output_directory}")


json_files = os.listdir(input_directory)
for json_file in json_files:
json_file_path = input_directory + json_file
logging.info(f"parsing {json_file_path}")
with open(json_file_path, "r") as jf:

# load data from file as a Python dictionary object:
try:
solution_file = json.load(jf)
except Exception as e:
logging.error(f'Error: {e}', exc_info=True)
continue # to next json file.

########################################################
#### update the fields of the solution_file dict.


logging.info(f"number of tasks reported: {len(solution_file['solution_data'])}")
for task in solution_file["solution_data"]:
num_T_gates_per_shot = task["quantum_resources"]["logical"]["num_T_gates_per_shot"]
num_shots = task["quantum_resources"]["logical"]["num_shots"]


conversion_fraction = 0.000020 # 20 microseconds per t_gate
overall_time_seconds = conversion_fraction*num_T_gates_per_shot*num_shots
task["run_time"]["overall_time"] = {}
task["run_time"]["overall_time"]["seconds"] = overall_time_seconds
task["run_time"]["overall_time"]["comments"] = {
"comment_1": "seconds = (0.00002 seconds/t_gate)(num_T_gates_per_shot)(num_shots)",
"comment_2": "20usec/t_gate based on the assumptions in the paper, including: 4 factories, 0.1percent physical error rate and AutoCCZ factories can support twice as many T-gates as Toffolis.",
"reference": "https://journals.aps.org/prxquantum/abstract/10.1103/PRXQuantum.2.030305"
}


########################################################
#### write out the updated .json file

output_json_file_path = output_directory + json_file
with open(output_json_file_path, "w") as output_json_file:
json.dump(solution_file, output_json_file)




logging.info("done")





if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="a script to update LRE solution files with run time per 20usec/tgate estimate."
)

parser.add_argument(
"-i",
"--input_dir",
type=str,
help="Specify directory for solution_files (.json files)"
)
parser.add_argument(
"-o",
"--output_dir",
type=str,
help="The directory where updated .json files are moved to."
)

args = parser.parse_args()

if len(sys.argv) == 1:
parser.print_help()
else:
main(args)

1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ install_requires =
pandas
scikit-learn
shap
jsonschema



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
"wall_clock_start_time": "2024-12-05T17:41:16.906707Z",
"wall_clock_stop_time": "2024-12-05T17:43:31.617298Z",
"seconds": 134.710591
},
"overall_time": {
"seconds": 8845499.1312,
"comments": {
"comment_1": "seconds = (0.00002 seconds/t_gate)(num_T_gates_per_shot)(num_shots)",
"comment_2": "20usec/t_gate based on the assumptions in the paper, including: 4 factories, 0.1percent physical error rate and AutoCCZ factories can support twice as many T-gates as Toffolis.",
"reference": "https://journals.aps.org/prxquantum/abstract/10.1103/PRXQuantum.2.030305"
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
"wall_clock_start_time": "2024-12-05T18:57:00.150467Z",
"wall_clock_stop_time": "2024-12-05T18:57:25.663183Z",
"seconds": 25.512716
},
"overall_time": {
"seconds": 240546.04224000004,
"comments": {
"comment_1": "seconds = (0.00002 seconds/t_gate)(num_T_gates_per_shot)(num_shots)",
"comment_2": "20usec/t_gate based on the assumptions in the paper, including: 4 factories, 0.1percent physical error rate and AutoCCZ factories can support twice as many T-gates as Toffolis.",
"reference": "https://journals.aps.org/prxquantum/abstract/10.1103/PRXQuantum.2.030305"
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
"wall_clock_start_time": "2024-12-05T17:47:44.053402Z",
"wall_clock_stop_time": "2024-12-05T17:49:23.360125Z",
"seconds": 99.306723
},
"overall_time": {
"seconds": 888577.8201600001,
"comments": {
"comment_1": "seconds = (0.00002 seconds/t_gate)(num_T_gates_per_shot)(num_shots)",
"comment_2": "20usec/t_gate based on the assumptions in the paper, including: 4 factories, 0.1percent physical error rate and AutoCCZ factories can support twice as many T-gates as Toffolis.",
"reference": "https://journals.aps.org/prxquantum/abstract/10.1103/PRXQuantum.2.030305"
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
"wall_clock_start_time": "2024-12-05T18:41:32.031031Z",
"wall_clock_stop_time": "2024-12-05T18:42:51.414239Z",
"seconds": 79.383208
},
"overall_time": {
"seconds": 39530000.62240001,
"comments": {
"comment_1": "seconds = (0.00002 seconds/t_gate)(num_T_gates_per_shot)(num_shots)",
"comment_2": "20usec/t_gate based on the assumptions in the paper, including: 4 factories, 0.1percent physical error rate and AutoCCZ factories can support twice as many T-gates as Toffolis.",
"reference": "https://journals.aps.org/prxquantum/abstract/10.1103/PRXQuantum.2.030305"
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
"wall_clock_start_time": "2024-12-05T17:08:32.247739Z",
"wall_clock_stop_time": "2024-12-05T17:09:42.627315Z",
"seconds": 70.379576
},
"overall_time": {
"seconds": 2652674.75712,
"comments": {
"comment_1": "seconds = (0.00002 seconds/t_gate)(num_T_gates_per_shot)(num_shots)",
"comment_2": "20usec/t_gate based on the assumptions in the paper, including: 4 factories, 0.1percent physical error rate and AutoCCZ factories can support twice as many T-gates as Toffolis.",
"reference": "https://journals.aps.org/prxquantum/abstract/10.1103/PRXQuantum.2.030305"
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
"wall_clock_start_time": "2024-12-05T17:32:46.025490Z",
"wall_clock_stop_time": "2024-12-05T17:33:52.675512Z",
"seconds": 66.650022
},
"overall_time": {
"seconds": 854297.33664,
"comments": {
"comment_1": "seconds = (0.00002 seconds/t_gate)(num_T_gates_per_shot)(num_shots)",
"comment_2": "20usec/t_gate based on the assumptions in the paper, including: 4 factories, 0.1percent physical error rate and AutoCCZ factories can support twice as many T-gates as Toffolis.",
"reference": "https://journals.aps.org/prxquantum/abstract/10.1103/PRXQuantum.2.030305"
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
"wall_clock_start_time": "2024-12-05T18:27:21.208556Z",
"wall_clock_stop_time": "2024-12-05T18:29:56.190187Z",
"seconds": 154.981631
},
"overall_time": {
"seconds": 1534255.5584000002,
"comments": {
"comment_1": "seconds = (0.00002 seconds/t_gate)(num_T_gates_per_shot)(num_shots)",
"comment_2": "20usec/t_gate based on the assumptions in the paper, including: 4 factories, 0.1percent physical error rate and AutoCCZ factories can support twice as many T-gates as Toffolis.",
"reference": "https://journals.aps.org/prxquantum/abstract/10.1103/PRXQuantum.2.030305"
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
"wall_clock_start_time": "2024-12-05T18:25:23.952220Z",
"wall_clock_stop_time": "2024-12-05T18:25:31.251455Z",
"seconds": 7.299235
},
"overall_time": {
"seconds": 1805527.5708800002,
"comments": {
"comment_1": "seconds = (0.00002 seconds/t_gate)(num_T_gates_per_shot)(num_shots)",
"comment_2": "20usec/t_gate based on the assumptions in the paper, including: 4 factories, 0.1percent physical error rate and AutoCCZ factories can support twice as many T-gates as Toffolis.",
"reference": "https://journals.aps.org/prxquantum/abstract/10.1103/PRXQuantum.2.030305"
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
"wall_clock_start_time": "2024-12-05T17:44:26.469415Z",
"wall_clock_stop_time": "2024-12-05T17:44:33.638985Z",
"seconds": 7.16957
},
"overall_time": {
"seconds": 322154.10240000003,
"comments": {
"comment_1": "seconds = (0.00002 seconds/t_gate)(num_T_gates_per_shot)(num_shots)",
"comment_2": "20usec/t_gate based on the assumptions in the paper, including: 4 factories, 0.1percent physical error rate and AutoCCZ factories can support twice as many T-gates as Toffolis.",
"reference": "https://journals.aps.org/prxquantum/abstract/10.1103/PRXQuantum.2.030305"
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
"wall_clock_start_time": "2024-12-05T18:53:48.537281Z",
"wall_clock_stop_time": "2024-12-05T18:54:24.488732Z",
"seconds": 35.951451
},
"overall_time": {
"seconds": 915774.0032,
"comments": {
"comment_1": "seconds = (0.00002 seconds/t_gate)(num_T_gates_per_shot)(num_shots)",
"comment_2": "20usec/t_gate based on the assumptions in the paper, including: 4 factories, 0.1percent physical error rate and AutoCCZ factories can support twice as many T-gates as Toffolis.",
"reference": "https://journals.aps.org/prxquantum/abstract/10.1103/PRXQuantum.2.030305"
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
"wall_clock_start_time": "2024-12-05T17:31:57.181548Z",
"wall_clock_stop_time": "2024-12-05T17:32:14.922004Z",
"seconds": 17.740456
},
"overall_time": {
"seconds": 117532.36992000001,
"comments": {
"comment_1": "seconds = (0.00002 seconds/t_gate)(num_T_gates_per_shot)(num_shots)",
"comment_2": "20usec/t_gate based on the assumptions in the paper, including: 4 factories, 0.1percent physical error rate and AutoCCZ factories can support twice as many T-gates as Toffolis.",
"reference": "https://journals.aps.org/prxquantum/abstract/10.1103/PRXQuantum.2.030305"
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
"wall_clock_start_time": "2024-12-05T17:26:50.225521Z",
"wall_clock_stop_time": "2024-12-05T17:29:19.201515Z",
"seconds": 148.975994
},
"overall_time": {
"seconds": 763772.336,
"comments": {
"comment_1": "seconds = (0.00002 seconds/t_gate)(num_T_gates_per_shot)(num_shots)",
"comment_2": "20usec/t_gate based on the assumptions in the paper, including: 4 factories, 0.1percent physical error rate and AutoCCZ factories can support twice as many T-gates as Toffolis.",
"reference": "https://journals.aps.org/prxquantum/abstract/10.1103/PRXQuantum.2.030305"
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
"wall_clock_start_time": "2024-12-05T18:57:45.767567Z",
"wall_clock_stop_time": "2024-12-05T18:58:23.237247Z",
"seconds": 37.46968
},
"overall_time": {
"seconds": 1578896.1664,
"comments": {
"comment_1": "seconds = (0.00002 seconds/t_gate)(num_T_gates_per_shot)(num_shots)",
"comment_2": "20usec/t_gate based on the assumptions in the paper, including: 4 factories, 0.1percent physical error rate and AutoCCZ factories can support twice as many T-gates as Toffolis.",
"reference": "https://journals.aps.org/prxquantum/abstract/10.1103/PRXQuantum.2.030305"
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
"wall_clock_start_time": "2024-12-05T19:01:32.635348Z",
"wall_clock_stop_time": "2024-12-05T19:01:40.312608Z",
"seconds": 7.67726
},
"overall_time": {
"seconds": 169968.97568,
"comments": {
"comment_1": "seconds = (0.00002 seconds/t_gate)(num_T_gates_per_shot)(num_shots)",
"comment_2": "20usec/t_gate based on the assumptions in the paper, including: 4 factories, 0.1percent physical error rate and AutoCCZ factories can support twice as many T-gates as Toffolis.",
"reference": "https://journals.aps.org/prxquantum/abstract/10.1103/PRXQuantum.2.030305"
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
"wall_clock_start_time": "2024-12-05T17:35:02.167122Z",
"wall_clock_stop_time": "2024-12-05T17:35:20.166170Z",
"seconds": 17.999048
},
"overall_time": {
"seconds": 239560.4096,
"comments": {
"comment_1": "seconds = (0.00002 seconds/t_gate)(num_T_gates_per_shot)(num_shots)",
"comment_2": "20usec/t_gate based on the assumptions in the paper, including: 4 factories, 0.1percent physical error rate and AutoCCZ factories can support twice as many T-gates as Toffolis.",
"reference": "https://journals.aps.org/prxquantum/abstract/10.1103/PRXQuantum.2.030305"
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
"wall_clock_start_time": "2024-12-05T18:21:49.431140Z",
"wall_clock_stop_time": "2024-12-05T18:22:27.761068Z",
"seconds": 38.329928
},
"overall_time": {
"seconds": 1379323.28448,
"comments": {
"comment_1": "seconds = (0.00002 seconds/t_gate)(num_T_gates_per_shot)(num_shots)",
"comment_2": "20usec/t_gate based on the assumptions in the paper, including: 4 factories, 0.1percent physical error rate and AutoCCZ factories can support twice as many T-gates as Toffolis.",
"reference": "https://journals.aps.org/prxquantum/abstract/10.1103/PRXQuantum.2.030305"
}
}
}
}
Expand Down
Loading
Loading