-
Notifications
You must be signed in to change notification settings - Fork 126
loschmidt.tilted_square_lattice Benchmark #236
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
Conversation
Change-Id: Id74c4e1c56cd7702862f6972d49d035eb83dd166
70b509d
to
659e107
Compare
Change-Id: Ie637306bd284cd20b09f464ee8551d48d1a1d684
Change-Id: Iadcaac412d43ccaa32140e7a0418011620ee8d8f
Change-Id: Ia229563ad399f1ae5e5c9916e70586623babb2c1
|
||
|
||
@lru_cache() | ||
def _resolve_json(cirq_type: str) -> Optional[ObjectFactory]: |
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.
I feel like I missed a change somewhere, since this is likely not the first time this snippet has appeared.
However, what is this? I am confused why we need this. Maybe a code comment would be good to explain what this is for.
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.
this is how we register modules for json deserialization; done after the separation of cirq_google
and friends. You can see we add it to cirq's DEFAULT_RESOLVERS
global variable
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 a docstring
recirq/otoc/loschmidt/tilted_square_lattice/tilted_square_lattice_test.py
Show resolved
Hide resolved
return cirq.Circuit() | ||
|
||
monkeypatch.setattr(recirq.otoc.loschmidt.tilted_square_lattice.tilted_square_lattice, | ||
"create_tilted_square_lattice_loschmidt_echo_circuit", mock_get_circuit) |
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.
Why do we need this monkeypatch? Is it just for test performance?
If so, how slow is the test without this?
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.
It's for speed and so I can assert something, namely that it was called the correct number of times.
Creating random circuits is expensive -- or at least speeding that up is outside the scope for this work. I think I wanted a test that relied on the default arguments for this function. I can add another test that dials back the number of executables and makes other assertions.
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.
Maybe add a comment to that effect above and explain what the test is actually testing.
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
@dstrain115 I think I addressed your comments. PTAL if you have time |
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.
Minor comments then I approve.
recirq/otoc/loschmidt/__init__.py
Outdated
@@ -0,0 +1,39 @@ | |||
# Copyright 2021 Google |
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.
Ha, it's 2022 now! Gotcha!
(optional since you started it in 2021)
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.
oh no! now people can skirt our onerous apache2 license because the copyright is invalid!
return cirq.Circuit() | ||
|
||
monkeypatch.setattr(recirq.otoc.loschmidt.tilted_square_lattice.tilted_square_lattice, | ||
"create_tilted_square_lattice_loschmidt_echo_circuit", mock_get_circuit) |
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.
Maybe add a comment to that effect above and explain what the test is actually testing.
Change-Id: I48a9d4cd5e507d344b0f8f32f88c7485d627e0e2
Change-Id: Ib42d67bfc938e5d1fbcdef4a5aaf1cdb9d4d098c
…021-12-loschmidt-tilted Change-Id: I35083c77b8a1b3372e935ccb68888dda8037351d
Change-Id: Ic9d4c7b3e2948a6d1121d7d915e525c38baad27a
made the requested changes! |
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.
LGTM
Adds the executable generation functionality for the following benchmark:
The loschmidt echo runs a random unitary forward and backwards and measures how often we return to the starting state. This benchmark checks random unitaries generated on the TiltedSquareLattice topology.
Notes
This PR does not include any BenchmarkConfig's, namely scripts for launching execution and analysis.
I've also removed the
data_class
field from the AlgorithmicBenchmark card catalog. (1) I don't want to make this PR too big by including it (2) I want to work some of the kinks out of the design of the data analysis part of the flow without holding up committing the infrastructure for taking data.Cirq requirements
Following #237 , this will only test the new functionality against the pre-release version of cirq where the
cirq_google.workflow
utilities are available.I've noticed as well that Cirq 0.12 does not include
cirq.NamedTopology
. This is a case where keeping compatibility with the prior version of Cirq is not worth it, esp. since v0.13 has been out for a while. As part of this PR I've disabled the "pre" check with a note. We'll re-enable when Cirq 0.14 comes out.