-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add structure for multiple Rust crates #9742
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
[package] | ||
name = "qiskit_accelerate" | ||
# The following options can be inherited with (e.g.) `version.workspace = true` once we hit Rust | ||
# 1.64. Until then, keep in sync with the root `Cargo.toml`. | ||
version = "0.24.0" | ||
edition = "2021" | ||
rust-version = "1.61" | ||
license = "Apache-2.0" | ||
|
||
[lib] | ||
name = "qiskit_accelerate" | ||
crate-type = ["cdylib"] | ||
|
||
[dependencies] | ||
rayon = "1.7" | ||
numpy = "0.18.0" | ||
rand = "0.8" | ||
rand_pcg = "0.3" | ||
rand_distr = "0.4.3" | ||
ahash = "0.8.3" | ||
num-complex = "0.4" | ||
num-bigint = "0.4" | ||
rustworkx-core = "0.12" | ||
|
||
# The base version of PyO3 and setting a minimum feature set (e.g. probably just 'extension-module') | ||
# can be done in the workspace and inherited once we hit Rust 1.64. | ||
[dependencies.pyo3] | ||
version = "0.18.1" | ||
features = ["extension-module", "hashbrown", "indexmap", "num-complex", "num-bigint"] | ||
|
||
[dependencies.ndarray] | ||
version = "^0.15.6" | ||
features = ["rayon"] | ||
|
||
[dependencies.hashbrown] | ||
version = "0.13.2" | ||
features = ["rayon"] | ||
|
||
[dependencies.indexmap] | ||
version = "1.9" | ||
features = ["rayon"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# `qiskit._accelerate` | ||
|
||
This crate provides a bits-and-pieces Python extension module for small, self-contained functions | ||
that are used by the main Python-space components to accelerate certain tasks. If you're trying to | ||
speed up one particular Python function by replacing its innards with a Rust one, this is the best | ||
place to put the code. This is _usually_ the right place to put Rust/Python interfacing code. | ||
|
||
The crate is made accessible as a private submodule, `qiskit._accelerate`. There are submodules | ||
within that (largely matching the structure of the Rust code) mostly for grouping similar functions. | ||
|
||
Some examples of when it might be more appropriate to start a new crate instead of using the | ||
ready-made solution of `qiskit._accelerate`: | ||
|
||
* The feature you are developing will have a large amount of domain-specific Rust code and is a | ||
large self-contained module. If it reasonably works in a single Rust file, you probably just want | ||
to put it here. | ||
|
||
* The Rust code is for re-use within other Qiskit crates and maintainability of the code will be | ||
helped by using the crate system to provide API boundaries between the different sections. | ||
|
||
* You want to start writing your own procedural macros. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Well this assumes we'll never have shared rust crates across our Python extension crates. A use case I could see is maybe some parser utils for OQ3 and OQ2 that we want to reuse between two separate crates (this is similar to how we use rustworkx-core in rustworkx).
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.
Each subpackage still has to opt in to inherit a dependency, such as by
If you don't have
<pkg>.workspace = true
, it's not inherited.