Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Conversation

@cgranade
Copy link
Contributor

@cgranade cgranade commented Jun 9, 2021

This PR (currently in draft pending work highlighted below) adds the experimental simulators tracked at #714 to main, allowing for the simulators to be used without additional installation while development proceeds (+@bettinaheim, @efratshabtai, and @bromeg). As an experimental feature, these simulators may undergo breaking changes or may be removed entirely in future releases without prior notice.

TODO before taking out of draft:

  • Finish decompositions of all discrete intrinsic operations
  • Expand test coverage of new simulators

Chris Granade and others added 5 commits June 9, 2021 16:18
* Experiment to hook up Rust crate to cmake.

* Add experimental simulator as rlib crate.

* Expanded C API, started consolidating Cargo.toml.

* Just the one crate will do.

* First unit test of QIR ↔ opensim.

* Add rust to builds.

* Start adding to CI.

* Don't set toolchain in CI.

* Started building managed interface.

* Add System.Text.Json dependency.

* Add native opensim sharedlibs to nupkg.

* Updated DLL name in NativeInterface.

* downgrade s.t.json.

* Fix pack.ps1 paths.

* Set --release flag in opensim.

* Add get_name.

* Added rest of c_api to NativeInterface.cs.

* Initial attempt at type1 implementation.

* Add open systems data model.

* Fix null reference exception by adding explicit qubit manager.

* Started using QSharpCore interface temporarily.

* Begin adding decompositions for opensim.

* Expose noise_model::ideal() through c_api.

* Fix json serialization of instruments.

* More informative exceptions in SetNoiseModel

* Pass DumpMachine through OnDisplayableDiagnostic.

* Began addressing warnings and adding unit tests.

* A couple more tests.

* Started enabling doctests for Rust runtime.

* Fix new doctest.

* Added more API doc comments.

* A bit of code cleanup.

* Start adding integration tests for experimental simulator in C# runtime.

* Fix teleport test.

* Attempt at fixing project-based tests.

* One more Rust-side unit test.

* Added opensim to local dev props, and reverted bad change to unittests.qs.

* Undo one other bad change.

* Disable test that depends on Rz.

* Started adding Rust-language integration tests.

* Added more informative error message when R is not supported.

* Forgot to add test data to prev commit.

* Start enabling performance reporting for opensim.

* Adapt opensim / managed interface to #538.

* Adapt QIR / opensim interface to #553.

* Apply rust-fmt, and reduce extraneous copying in conjugate_by.

* Started weakening from owned arrays to views.

* Weakened tensor to views by owning views and borrowing owns.

* Started adding microbenchmarks.

* extend_two_to_n

* Clear diskspace and build microbenchmarks in CI.

* Clean more aggressively to avoid disk space issues.

* Format, fix warnings, simplify Cargo.toml.

* Fix choco rustup in prereqs.

* Disable choco rustup.

* Fix path to Cargo.toml.

* Don't check Rust-style names with clang-tidy.

* M is no longer overriden.

* Temporarily disable QIR / opensim integration.

* Clean up extra cargo files after testing opensim.

* Work on API docs and refactoring of Rust crate.

* Separate out qdk_sim into its own crate.

* Work on testing and enforcing rust fmt.

* Run clippy in tests as well.

* Add code quality checks to build/test.

* Ignore jupyter temps and xplat drops.

* Begin exposing build metadata through to C# callers.

* Start injecting version number from build into Cargo.toml.

* Started infrastructure to expose simulation functionality to Python.

* Ignore Python temporaries and build artifacts.

* More partial progress on exposing to Python.

* Add initial precommit config.

* Introduce fmt error.

* Add new checks to pre-commit.

* Continued integrating CHP into simulator API.

* Address clippy warnings.

* Work on docs.

* Separate out paulis.rs.

* Expose more simulation functionality to Python.

* Generalize C API to allow using other state representations.

* Enable CFG for C / Rust boundaries.

* Move Cargo.toml injection into bootstrap.

* Fix path from bootstrap to Cargo.toml injection, debug injection.

* One more path fix.

* One more path fix.

* Remove --release from cargo package.

* Revert CFG change to cmake.

* Fix Rust build script.

* Debug artifact paths.

* Debug drop paths as well.

* More path debugging.

* Fix build paths.

* Don't cargo clean build artifacts away.

* Fix one character typo in Simulators.Dev.props.

* Fix one more dev props typo.

* Eliminate unneeded copy.

* Improve naming conventions in processes.rs.

* Fix pack.ps1 to include qdk_sim_rs drops.

* Expose more information in exceptions.

* Fix one more path.

* Add links on cargo-clippy.

* Fix issues in C API benchmarking.

* Improve Python bindings for NoiseModel.

* Improve readme for qdk_sim_rs crate.

* Improve noise model handling, add test coverage.

* Update System.Text.Json to 4.7.2.

* Address clippy warnings.

* Don't use new C# 9 features.

* Don't store cargo lockfile in repo for now.

* Remove outdated gitignore.

* Fix serialization test, false negatives.

* Use +nightly to run doctests.

* Allow serializing and deserializing mixed pauli channels.

* Expose as_json to more Python classes.

* Added ideal_stabilizer noise model, split up processes, and start CHP decomp.

* Allow applying CHP decompositions.

* Fix clippy warnings.

* Check error conditions on get_noise_model.

* Allow for getting/setting noise models by name.

* Expose as_json for State to Python.

* Added stabilizer states to data model for serialization.

* Significantly expanded documentation.

* Added header explaining how to call cargo doc.

* Fix doctest.

* Add extra assertions.

* Add more debug outputs to assertion failure.

* Fixed assertion.

* Fixed assert.

* Fix clippy warning.

* Update src/Simulation/Simulators/OpenSystemsSimulator/NativeInterface.cs

Co-authored-by: Robin Kuzmin <kuzmin.robin@gmail.com>

* Fixed C# serialization.

* Slight comment fixes.

* Fix build failure.

* Address review comments.

* qdk_sim → qdk_sim_experimental,improve Python version handling.

* Revert src/Qir to main.

QIR integration deferred to #713.

* Add prerequisites.ps1.

* Finish reverting QIR.

* Generate C++ headers as well as C.

* Fixed issue building docs locally with python disabled.

* Updated link to tracking issue for experimental sims.

* Gate `cargo clean` on CI builds.

* Addressing feedback.

* Force dependency on S.T.Encodings.Web to be >= 4.7.2.

* Adding comment to explain serialization field.

* Added README link to experimental simulators doc.

* Fix typo.

* Add stabilizers to state converter.

* Move format/linting checks to build from test.

* Fix stabilizer noise model serialization, added new test.

* Work on docs.

* Fixed some slight issues with n_qubits handling.

* Update documentation notebook.

* Regenerate notebook from latest build.

* Fixed some serialization issues.

* Fixed some serialization tests.

* Expose build info and fix mixed pauli channels.

* Updated documentation notebook from latest build.

Co-authored-by: Robin Kuzmin <kuzmin.robin@gmail.com>
…imulators. (#724)

* Update documentation notebook for latest IQ# bugfix.

* Started work on decompositions.

* Added more detail to documentation notebook.

* Moved all decomposition logic to Q# operations.

* Added more decompositions.

* Make known limitations more explicit in README.md.

* Move known limitations to Markdown documentation./

* Started adding tests of decompositions.

* Added missing `open` statement.

* Don't mark decompositions as internal.

* Fixed build issue (💕 to @swernli for all the help!)

* Unit tests now pass.

* Address feedback.

* Fix two small build issues.

* Added comment explaining reset / release.

* Remove DLL added by accident.

* Removed one more file added by accident.

* Revert "Removed one more file added by accident."

This reverts commit 1cc67a3.

* Added comment explaining vcomp140.dll.
@cgranade cgranade marked this pull request as ready for review June 15, 2021 21:56
* Call cbindgen manually instead of in build.rs.

* Updated metadata in Cargo.toml.
Copy link
Collaborator

@swernli swernli left a comment

Choose a reason for hiding this comment

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

Two minor comments below, otherwise everything looks good (and matches previously reviewed content)!

}


if ($Env:ENABLE_EXPERIMENTALSIM -ne "false") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I missed this in the previous review, but this script should warn if cargo is missing and skip the test like the build script does. That way test.ps1 won't fail for folks who haven't built opensim due to missing cargo install.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, let me fix that quickly, then.

Comment on lines 37 to 41
# Free disk space by cleaning up.
# Note that this takes longer, but saves ~1 GB of space, which is
# exceptionally helpful in CI builds.
# When building in CI, free disk space by cleaning up.
# Note that this takes longer, but saves ~1 GB of space.
Copy link
Collaborator

Choose a reason for hiding this comment

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

nitpick: I think this comment got accidentally duplicated by a merge at some point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, good catch, will go on and fix, then. Thanks!

Copy link
Member

@msoeken msoeken left a comment

Choose a reason for hiding this comment

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

Approving previously approved PRs from feature branch to main. Merge looks good to me. Thanks @cgranade

Chris Granade and others added 2 commits June 16, 2021 12:42
Co-authored-by: Robin Kuzmin <kuzmin.robin@gmail.com>
Co-authored-by: Robin Kuzmin <kuzmin.robin@gmail.com>
Copy link
Contributor

@kuzminrobin kuzminrobin left a comment

Choose a reason for hiding this comment

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

Incredible work! Large number of technologies used.
Unreachably high pilotage for me.
I admire your contributions.

@cgranade cgranade merged commit 1334dc8 into main Jun 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants