-
Notifications
You must be signed in to change notification settings - Fork 126
loschmidt.tilted_square_lattice gen+run #259
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
loschmidt.tilted_square_lattice gen+run #259
Conversation
Change-Id: Ieb7aa8fd71bc3cfa1e5282eeca9ca30e2d7ff4cc
Change-Id: I309b28ec9804ce547ed8d73a44418c7c282d4ac5
Change-Id: I4101cdd4acfb8b0b707d9e65439598396929a641
Change-Id: Ibb8a404c61b1dc5527eae1b9f11dda17ff836fb2
43bda6d
to
fd92a06
Compare
Change-Id: Ia04c61885725bd0124f5530a1c1d3bf360e58a98
Change-Id: I0cc080a84512ceebe262c2d611013be3dc8b3b15
@@ -83,6 +83,12 @@ class BenchmarkConfig: | |||
spec_class=TiltedSquareLatticeLoschmidtSpec, | |||
executable_generator_func=get_all_tilted_square_lattice_executables, | |||
configs=[ | |||
BenchmarkConfig( | |||
short_name='small-v1', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a good place to put a synopsis about what each benchmark is/does? Either as a line comment or as a structured field? Once we have a bunch of these, it's going to be more difficult to keep track of what each of them does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea, added
i = 1 | ||
while True: | ||
run_id = fmt.format(i=i, date=datetime.date.today().isoformat()) | ||
if not os.path.exists(f'{base_data_dir}/{run_id}'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: Not sure it matters much, but do you think it would be faster to list the directory and just check the results for each run rather than make O(n) separate os calls? (Not sure how many runs we expect to do, but maybe could be a lot of them?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is good to keep in mind. I'm imagining users will be coming up with meaningful run_id or run_id templates (particularly using the {date}
option) so that we won't spend much time searching.
I'll punt on this since I think it would be straightforward to transparently update if and when it becomes a problem.
@@ -0,0 +1,3 @@ | |||
python gen-small-v1.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth a comment to explain this file? Also, does this file need license info?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added.
Worth noting that I have much more robust plans for doing end-to-end (ie integration testing) once more of the benchmarks are in place; but I figured it wouldn't hurt to have this baby bash script for the time being.
@@ -0,0 +1,22 @@ | |||
import numpy as np |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add license info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
@@ -0,0 +1,24 @@ | |||
import cirq |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add license info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
FN = 'loschmidt.tilted_square_lattice.small-v1.json.gz' | ||
|
||
|
||
def main(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should add module level docstring to explain what this is and what the valid args and/or example command are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added (using verbiage from the new description field in the algorithmic_benchmarking_library card catalog)
from recirq.otoc.loschmidt.tilted_square_lattice import \ | ||
get_all_tilted_square_lattice_executables | ||
|
||
FN = 'loschmidt.tilted_square_lattice.small-v1.json.gz' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this? Avoid abbreviations, especially when ambiguous (filename vs function).
Suggest OUTPUT_FILENAME or similar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed.
also I think at some point this filename should be fetched maybe from the algorithmic_benchmarking_library
"card catalog" module but I haven't completely thought through how that would work.
macrocycle_depths=np.arange(0, 4 + 1, 1)) | ||
print(len(exes), 'executables') | ||
|
||
cirq.to_json_gzip(exes, FN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the output filename be a flag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current design is to have a 1:1 correspondence between these generation scripts and the serialized QuantumExecutableGroup
. I consider this file to be a configuration file like a yaml
or textproto
file. I could just use a yaml file or something; but I find often times the schema of configuration files gets extensions bolted on to it to handle new ways of configuring things so here I'm just using a real scripting language from the start.
Remember: we need to carefully control the benchmarks we run for accurate comparison over time. If you want to run an ad-hoc benchmark with your own parameter choices, you should likely create a new script to do what you want.
|
||
assert TiltedSquareLatticeLoschmidtSpec, 'register deserializer' | ||
|
||
FN = 'loschmidt.tilted_square_lattice.small-v1.json.gz' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comments about FN and docstrings in this file as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Change-Id: I6751482d16609c1fa1aa6ba9f5f039d8351926d8
Change-Id: I29c347d6d84a616f4f2937f70ef742d35c5457e9
Change-Id: I25c45fbfdb4889d2a3a991e96cbfc8225ab6a206
thanks for the review @dstrain115, PTAL |
@@ -48,6 +48,7 @@ class AlgorithmicBenchmark: | |||
spec_class: Type['ExecutableSpec'] | |||
executable_generator_func: Callable[[Any], 'QuantumExecutableGroup'] | |||
configs: List['BenchmarkConfig'] | |||
description: Optional[str] = None | |||
|
|||
def as_strings(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related, but noticed it was missing return type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Change-Id: I343d00ccbef48fab2667746858c8a256772bb942
Change-Id: Ie1e68b97379eeb9080e05aa9c56ba96b1b42eee3
Change-Id: Iafdd325501ffe60a53828b369564a8512d245916
Following #236 , add scripts for generating a QuantumExecutableGroup and a script for running on a simulated EngineProcessor.
This PR includes a very simple placeholder bash script for doing an "end-to-end" test that will be replaced with a more comprehensive solution when we have all the end-to-end parts committed.
This PR does not include the data analysis steps, which will follow.
This requires quantumlib/Cirq#4842