-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DO NOT MERGE] Prepare for public beta 2 release See merge request cuda-hpc-libraries/cuquantum-sdk/cuquantum-public!2
- Loading branch information
Showing
89 changed files
with
10,083 additions
and
39 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# Code of Conduct | ||
|
||
## Overview | ||
|
||
Define the code of conduct followed and enforced for the cuQuantum Python project. | ||
|
||
## Our Pledge | ||
|
||
In the interest of fostering an open and welcoming environment, we as | ||
contributors and maintainers pledge to making participation in our project and | ||
our community a harassment-free experience for everyone, regardless of age, body | ||
size, disability, ethnicity, sex characteristics, gender identity and expression, | ||
level of experience, education, socio-economic status, nationality, personal | ||
appearance, race, religion, or sexual identity and orientation. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment | ||
include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and unwelcome sexual attention or | ||
advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic | ||
address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a | ||
professional setting | ||
|
||
## Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable | ||
behavior and are expected to take appropriate and fair corrective action in | ||
response to any instances of unacceptable behavior. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or | ||
reject comments, commits, code, wiki edits, issues, and other contributions | ||
that are not aligned to this Code of Conduct, or to ban temporarily or | ||
permanently any contributor for other behaviors that they deem inappropriate, | ||
threatening, offensive, or harmful. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces | ||
when an individual is representing the project or its community. Examples of | ||
representing a project or community include using an official project e-mail | ||
address, posting via an official social media account, or acting as an appointed | ||
representative at an online or offline event. Representation of a project may be | ||
further defined and clarified by project maintainers. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be | ||
reported by contacting the project team at | ||
[[email protected]](mailto:[email protected]) All | ||
complaints will be reviewed and investigated and will result in a response that | ||
is deemed necessary and appropriate to the circumstances. The project team is | ||
obligated to maintain confidentiality with regard to the reporter of an | ||
incident. Further details of specific enforcement policies may be posted | ||
separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good | ||
faith may face temporary or permanent repercussions as determined by other | ||
members of the project's leadership. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, | ||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html | ||
|
||
[homepage]: https://www.contributor-covenant.org | ||
|
||
For answers to common questions about this code of conduct, see | ||
https://www.contributor-covenant.org/faq |
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,12 @@ | ||
# Contributing | ||
|
||
Thank you for your interest in contributing to cuQuantum Python! Based on the type of contribution, it will fall into two categories: | ||
|
||
1. You want to report a bug, feature request, or documentation issue | ||
- File an [issue](https://github.com/NVIDIA/cuQuantum/issues/new) | ||
describing what you encountered or what you want to see changed. | ||
- The NVIDIA team will evaluate the issues and triage them, scheduling | ||
them for a release. If you believe the issue needs priority attention | ||
comment on the issue to notify the team. | ||
2. You want to implement a feature or bug-fix | ||
- At this time we do not accept code contributions. |
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,82 @@ | ||
# Code of Conduct | ||
|
||
## Overview | ||
|
||
Define the code of conduct followed and enforced for the cuQuantum Python project. | ||
|
||
## Our Pledge | ||
|
||
In the interest of fostering an open and welcoming environment, we as | ||
contributors and maintainers pledge to making participation in our project and | ||
our community a harassment-free experience for everyone, regardless of age, body | ||
size, disability, ethnicity, sex characteristics, gender identity and expression, | ||
level of experience, education, socio-economic status, nationality, personal | ||
appearance, race, religion, or sexual identity and orientation. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment | ||
include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and unwelcome sexual attention or | ||
advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic | ||
address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a | ||
professional setting | ||
|
||
## Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable | ||
behavior and are expected to take appropriate and fair corrective action in | ||
response to any instances of unacceptable behavior. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or | ||
reject comments, commits, code, wiki edits, issues, and other contributions | ||
that are not aligned to this Code of Conduct, or to ban temporarily or | ||
permanently any contributor for other behaviors that they deem inappropriate, | ||
threatening, offensive, or harmful. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces | ||
when an individual is representing the project or its community. Examples of | ||
representing a project or community include using an official project e-mail | ||
address, posting via an official social media account, or acting as an appointed | ||
representative at an online or offline event. Representation of a project may be | ||
further defined and clarified by project maintainers. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be | ||
reported by contacting the project team at | ||
[[email protected]](mailto:[email protected]) All | ||
complaints will be reviewed and investigated and will result in a response that | ||
is deemed necessary and appropriate to the circumstances. The project team is | ||
obligated to maintain confidentiality with regard to the reporter of an | ||
incident. Further details of specific enforcement policies may be posted | ||
separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good | ||
faith may face temporary or permanent repercussions as determined by other | ||
members of the project's leadership. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, | ||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html | ||
|
||
[homepage]: https://www.contributor-covenant.org | ||
|
||
For answers to common questions about this code of conduct, see | ||
https://www.contributor-covenant.org/faq |
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,12 @@ | ||
# Contributing | ||
|
||
Thank you for your interest in contributing to cuQuantum Python! Based on the type of contribution, it will fall into two categories: | ||
|
||
1. You want to report a bug, feature request, or documentation issue | ||
- File an [issue](https://github.com/NVIDIA/cuQuantum/issues/new) | ||
describing what you encountered or what you want to see changed. | ||
- The NVIDIA team will evaluate the issues and triage them, scheduling | ||
them for a release. If you believe the issue needs priority attention | ||
comment on the issue to notify the team. | ||
2. You want to implement a feature or bug-fix | ||
- At this time we do not accept code contributions. |
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,28 @@ | ||
BSD-3-Clause | ||
|
||
Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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,78 @@ | ||
# cuQuantum Python | ||
|
||
## Documentation | ||
|
||
Please visit the [NVIDIA cuQuantum SDK documentation](https://docs.nvidia.com/cuda/cuquantum/). | ||
|
||
## Building | ||
|
||
### Requirements | ||
|
||
Build-time dependencies of the cuQuantum Python package and some versions that | ||
are known to work are as follows: | ||
|
||
* CUDA Toolkit 11.4+ | ||
* cuQuantum 0.1.0 | ||
* cuTENSOR 1.4.0+ | ||
* Cython - e.g. 0.29.21 | ||
|
||
### Install cuQuantum Python from conda-forge | ||
|
||
If you already have a Conda environment set up, it is the easiest to install cuQuantum Python from the conda-forge channel: | ||
``` | ||
conda install -c conda-forge cuquantum-python | ||
``` | ||
The Conda solver will address all dependencies for you. | ||
|
||
### Install cuQuantum Python from source | ||
|
||
To compile and install cuQuantum Python from source, please follow the steps below: | ||
|
||
1. Set `CUDA_PATH` to point to your CUDA installation | ||
2. Set `CUQUANTUM_ROOT` to point to your cuQuantum installation | ||
3. Set `CUTENSOR_ROOT` to point to your cuTENSOR installation | ||
4. Make sure CUDA, cuQuantum and cuTENSOR are visible in your `LD_LIBRARY_PATH` | ||
5. Run `pip install -v .` | ||
|
||
Notes: | ||
- For the `pip install` step, adding the `-e` flag after `-v` would allow installing the package in-place (i.e., in "editable mode" for testing/developing). | ||
- If `CUSTATEVEC_ROOT` and `CUTENSORNET_ROOT` are set (for the cuStateVec and the cuTensorNet libraries, respectively), they overwrite `CUQUANTUM_ROOT`. | ||
- For local development, set `CUQUANTUM_IGNORE_SOLVER=1` to ignore the dependency on the `cuquantum` wheel. | ||
|
||
|
||
## Running | ||
|
||
### Requirements | ||
|
||
Runtime dependencies of the cuQuantum Python package include: | ||
|
||
* An NVIDIA GPU with compute capability 7.0+ | ||
* Driver: Linux (450.80.02+) | ||
* CUDA Toolkit 11.4+ | ||
* cuQuantum 0.1.0 | ||
* cuTENSOR 1.4.0+ | ||
* NumPy v1.17+ | ||
* CuPy v9.5.0+ | ||
* PyTorch v1.10+ (optional) | ||
|
||
If you install everything from conda-forge, the dependencies are taken care for you (except for the driver). | ||
|
||
If you build cuQuantum Python from source, please make sure the paths to the cuQuantum and cuTENSOR libraries are added | ||
to your `LD_LIBRARY_PATH` environment variable. | ||
|
||
Known issues: | ||
- If a system has multiple copies of cuTENSOR, one of which is installed in a default system path, the Python runtime could pick it up despite cuQuantum Python is linked to another copy installed elsewhere, potentially causing a version-mismatch error. The proper fix is to remove cuTENSOR from the system paths to ensure the visibility of the proper copy. **DO NOT ATTEMPT** to use `LD_PRELOAD` to overwrite it --- it could cause hard to debug behaviors! | ||
- In certain environments, if PyTorch is installed `import cuquantum` could fail (with a segmentation fault). It is currently under investigation and a temporary workaround is to import `torch` before importing `cuquantum`. | ||
|
||
### Samples | ||
|
||
Samples for demonstrating the usage of both low-level and high-level Python APIs are | ||
available in the `samples` directory. The low-level API samples are 1:1 translations of the corresponding | ||
samples written in C. The high-level API samples demonstrate pythonic usages of the cuTensorNet | ||
library in Python. | ||
|
||
|
||
## Testing | ||
|
||
If pytest is installed, run `pytest tests` in the Python source root directory would | ||
run all tests. |
Empty file.
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,29 @@ | ||
from cuquantum import custatevec | ||
from cuquantum import cutensornet | ||
from cuquantum.cutensornet import ( | ||
contract, contract_path, einsum, einsum_path, Network, | ||
NetworkOptions, OptimizerInfo, OptimizerOptions, PathFinderOptions, ReconfigOptions, SlicerOptions) | ||
from cuquantum.utils import ComputeType, cudaDataType, libraryPropertyType | ||
|
||
|
||
# We patch all enum values so that they have the correct docstrings | ||
for enum in ( | ||
custatevec.Pauli, | ||
custatevec.MatrixLayout, | ||
custatevec.MatrixType, | ||
custatevec.Collapse, | ||
custatevec.SamplerOutput, | ||
cutensornet.ContractionOptimizerInfoAttribute, | ||
cutensornet.ContractionOptimizerConfigAttribute, | ||
cutensornet.ContractionAutotunePreferenceAttribute, | ||
): | ||
cutensornet._internal.enum_utils.add_enum_class_doc(enum, chomp="_ATTRIBUTE|_PREFERENCE_ATTRIBUTE") | ||
# these have yet another convention... | ||
for v in cutensornet.GraphAlgorithm: | ||
v.__doc__ = f"See `CUTENSORNET_CONTRACTION_OPTIMIZER_CONFIG_GRAPH_ALGORITHM_{v.name}`." | ||
cutensornet.MemoryModel.SLICER_HEURISTIC.__doc__ = \ | ||
f"See `CUTENSORNET_CONTRACTION_OPTIMIZER_CONFIG_SLICER_MEMORY_MODEL_HEURISTIC`." | ||
cutensornet.MemoryModel.SLICER_CUTENSOR.__doc__ = \ | ||
f"See `CUTENSORNET_CONTRACTION_OPTIMIZER_CONFIG_SLICER_MEMORY_MODEL_CUTENSOR`." | ||
|
||
del enum, utils, v |
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 @@ | ||
from cuquantum.custatevec.custatevec import * |
Oops, something went wrong.