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

Merge the demo branch into master #319

Merged
merged 421 commits into from
Mar 19, 2020
Merged

Merge the demo branch into master #319

merged 421 commits into from
Mar 19, 2020

Conversation

josh146
Copy link
Member

@josh146 josh146 commented Mar 16, 2020

This PR merges the demo branch into master in preparation for release. In particular, it adds the following features which so far have been developed in isolation in the demo branch:

  • The Connection and Job classes

  • The RemoteEngine

  • The sf command line interface

  • The sf.configuration module

  • Documentation and tests related to the above, including a tutorial tutorials/remote.rst walking through usage of RemoteEngine.

While this PR is large, it is composed of code-reviewed PRs, it is still worth giving it a quick once-over.

Note: please have a look at the updated changelog (rendered version here: https://strawberryfields.readthedocs.io/en/demo/development/release_notes.html). I have collated several independent PRs into single bullet points, since this will be squash-merged into master, and added examples.

  • @nquesada and @thisac, do you have a nice plot we could add to the 'speeding up the fock backend' change?

  • @trbromley, do you have a nice small example we could add to the 'weighted graphs' change?

antalszava and others added 30 commits February 19, 2020 16:25
…variable test; adding teardown logic for env vars; correcting typo
Comment on lines +17 to +18
tensorflow-tensorboard>=0.1.8
tensorflow==1.3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel really confused now 😅

Copy link
Member Author

@josh146 josh146 Mar 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be changed, good eye!
Edit: oh, it needs to be changed after the tf2 branch is merged in, not yet.

Copy link
Contributor

@antalszava antalszava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't find any major things that would need changing here 😊 I was not too sure if we wanted to remove the TF requirements for now. Apart from that I've left some further comments/suggestions. One thing for formatting would be to adjust the date of the licenses, though that would be global for SF (not just limited to demo).

Copy link
Contributor

@trbromley trbromley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @josh146 - looks great and exciting to get this part merged in. I left some comments and focused mainly on the documentation.

.github/CHANGELOG.md Show resolved Hide resolved
.github/CHANGELOG.md Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
Comment on lines +119 to +120
Functions
---------
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why, but I get a WARNING: Title level inconsistent for this part 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also noticed a few other errors upon making the docs, e.g., WARNING: autodoc: failed to import class 'Chip0Specs' - are these ok?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird 🤔 Works fine for me

doc/code/sf_cli.rst Outdated Show resolved Hide resolved
doc/introduction/remote.rst Outdated Show resolved Hide resolved
doc/introduction/remote.rst Outdated Show resolved Hide resolved
>>> save("test_compiled.xbb", prog)


Tips and tricks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could rename this to "Advanced", do we expect the average user to know the signal and idler modes?

:tooltip: Photonic gate visualization
:description: :doc:`/gallery/gate_visualisation/GateVisualisation`
:tooltip: RemoteEngine
:description: :doc:`/introduction/remote`
:figure: /gallery/gate_visualisation/GateVisualisation.gif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any ideas for a nice thumbnail? 🤔 We need the iPad now!

<div style='clear:both'></div>
<br>

Hardware
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would potentially recommend putting this part above or directly below applications

@josh146
Copy link
Member Author

josh146 commented Mar 17, 2020

@trbromley, thanks! I agree with your comments re: the configuration page and the hardware tutorial. However, I think it's best to address them in separate PRs post-demo merge. Partly because this PR is so big, and blocking a few other changes required for release.

.github/CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Member

@co9olguy co9olguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only looked at code, did not check rendered docs yet

doc/development/research.rst Outdated Show resolved Hide resolved
doc/development/research.rst Outdated Show resolved Hide resolved
doc/index.rst Outdated Show resolved Hide resolved

>>> sf.store_account("MYAUTH")

to create a configuration file containing your credentials. This is the recommended approach.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good points @trbromley, agreed


.. code-block:: bash

$ sf configure --token MYAUTH
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might not be clear to users what MYAUTH is

.github/CHANGELOG.md Outdated Show resolved Hide resolved

* Adds the `x_quad_values` and `p_quad_values` methods to the `state` class.
This allows calculation of x and p quadrature
probability distributions by integrating across the Wigner function.
[#270](https:/XanaduAI/strawberryfields/pull/270)
[(#270)](https:/XanaduAI/strawberryfields/pull/270)

* Adds support in the applications layer for node-weighted graphs. Users can sample from graphs
with node weights using the WAW encoding and input node weights into search algorithms in the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users might not know what the WAW encoding is

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we address this is a new smaller PR after demo is merged, as it is a pre-existing changelog entry.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Currently the user could look at the linked PRs to find out
To include it here, are we able to have math equations in markdown?
(but yes I agree this could be done outside of this PR)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Easiest thing is to not give any specifics that we have to define. Maybe "sample from graphs with node weights using special-purpose encodings"

[#311](https:/XanaduAI/strawberryfields/pull/311)

### Bug fixes
<h3>Bug fixes</h3>

* Symbolic Operation parameters are now compatible with TensorFlow 2.0 objects.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why would a user want to use a tensorflow 2.0 object? 🤔

[#280](https:/XanaduAI/strawberryfields/pull/280)

[(#280)](https:/XanaduAI/strawberryfields/pull/280)

* Removed two unnecessary else statements that pylint complained about.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Removed two unnecessary else statements that pylint complained about.
* Removed two unnecessary else statements.

imo, not even worth putting in changelog

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree

.github/CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@thisac thisac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mainly found some small things that might be good to change, but nothing major. Looks good! 🙂

doc/introduction/configuration.rst Outdated Show resolved Hide resolved
doc/introduction/remote.rst Outdated Show resolved Hide resolved
doc/introduction/remote.rst Outdated Show resolved Hide resolved
doc/tutorials/tutorial_teleportation.rst Outdated Show resolved Hide resolved

>>> results = eng.run(prog, shots=20)
Job e6ead866-04c9-4d48-ba28-680e8639fc41 is sent to server.
>>> results.samples.T
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. It should return all samples as (shots, modes) now, so the transposing of results.samples shouldn't be necessary.

strawberryfields/configuration.py Outdated Show resolved Hide resolved
tests/frontend/test_circuitspecs_chip2.py Outdated Show resolved Hide resolved
tests/frontend/test_sf_cli.py Outdated Show resolved Hide resolved
tests/frontend/test_sf_cli.py Outdated Show resolved Hide resolved
tests/frontend/test_sf_cli.py Outdated Show resolved Hide resolved
Co-Authored-By: Nathan Killoran <[email protected]>
Co-Authored-By: Theodor <[email protected]>
Copy link
Contributor

@trbromley trbromley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @josh146!

@trbromley
Copy link
Contributor

@trbromley, do you have a nice small example we could add to the 'weighted graphs' change?

This is addressed in #321 - should be a few minutes to review, but wanted to do as a PR to keep the change clear.

* Add apps example

* Clarify WAW encoding
eng = RemoteEngine(program.target)

sys.stdout.write("Executing program on remote hardware...\n")
result = eng.run(program)
Copy link
Contributor

@pauljxtan pauljxtan Mar 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I noticed something with the RemoteEngine implementation that may not be ideal... The run() method accepts a shots argument, which overrides the value specified in the Blackbird script (which it probably shouldn't), and defaults to 1 if not given. So this line here would run every program with 1 shot regardless of what is in the script, which is probably not the intended behaviour (?). My bad for not catching this earlier!

I think the best thing to do for now might be to explicitly pass in shots here, i.e.

result = eng.run(program, shots=program.run_options["shots"])

but ideally, I think this line should be eventually modified to only override shots if it is explicitly passed in:

bb._target["options"] = {"shots": shots}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pauljxtan for catching this! Do you want to create a quick PR to master to fix this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing, I will get that done ASAP!

Co-Authored-By: Nathan Killoran <[email protected]>
Co-Authored-By: Theodor <[email protected]>
@josh146 josh146 merged commit e557ba2 into master Mar 19, 2020
@josh146 josh146 deleted the demo branch March 19, 2020 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants