cudaq 0.9.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ cff-version: 1.2.0
2
+ title: 'CUDA-Q'
3
+ message: 'If you use this software, please cite it as below.'
4
+ authors:
5
+ - name: "The CUDA-Q development team"
6
+ license: Apache-2.0
7
+ license-url: "https://github.com/NVIDIA/cuda-quantum/blob/main/LICENSE"
8
+ repository-code: "https://github.com/NVIDIA/cuda-quantum"
9
+ type: software
10
+ url: "https://github.com/NVIDIA/cuda-quantum"
11
+ # doi:
cudaq-0.9.0/LICENSE ADDED
@@ -0,0 +1,16 @@
1
+ Apache License Version 2.0
2
+
3
+ Copyright (c) 2023 - 2024 NVIDIA Corporation & Affiliates
4
+ All rights reserved.
5
+
6
+ Licensed under the Apache License, Version 2.0 (the "License");
7
+ you may not use this file except in compliance with the License.
8
+ You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
cudaq-0.9.0/NOTICE ADDED
@@ -0,0 +1,190 @@
1
+ CUDA-Q
2
+
3
+ This product includes software developed by NVIDIA corporation and affiliates and includes material from third parties. It includes work released under the following licenses:
4
+
5
+ ----------------------------------------------------------------
6
+
7
+ LLVM - Apache License 2.0 with LLVM Exceptions
8
+ <https://github.com/llvm/llvm-project> and <https://github.com/llvm/circt/>
9
+
10
+ Originally developed by University of Illinois at Urbana Campaign.
11
+ The incorporated source code and its license can be found as as submodule on the CUDA-Q repository.
12
+ License at <https://github.com/llvm/llvm-project/blob/main/LICENSE.TXT>
13
+
14
+ ----------------------------------------------------------------
15
+
16
+ Eigen - various licenses, primarily MPL2 and BSD
17
+ <https://gitlab.com/libeigen/eigen>
18
+
19
+ The incorporated source code and its licenses can be found as a submodule on the CUDA-Q repository.
20
+ See also <https://gitlab.com/libeigen/eigen/-/blob/master/COPYING.README>.
21
+
22
+ ----------------------------------------------------------------
23
+
24
+ PyBind11 - BSD-style license
25
+ <https://github.com/pybind/pybind11>
26
+
27
+ The source code is based on the work originally developed by Wenzel Jakob
28
+ License at <https://github.com/pybind/pybind11/blob/master/LICENSE>
29
+
30
+ ----------------------------------------------------------------
31
+
32
+ Ensmallen - 3-Clause BSD License
33
+ <https://github.com/mlpack/ensmallen>
34
+
35
+ The incorporated source code and its license can be found as a submodule on the CUDA-Q repository.
36
+ License at <https://github.com/mlpack/ensmallen/blob/master/LICENSE.txt>
37
+
38
+ ----------------------------------------------------------------
39
+
40
+ Armadillo - Apache License 2.0
41
+ <https://gitlab.com/conradsnicta/armadillo-code>
42
+
43
+ The incorporated source code and its license can be found as as submodule on the CUDA-Q repository.
44
+ License at <https://gitlab.com/conradsnicta/armadillo-code/-/blob/12.0.x/LICENSE.txt>
45
+
46
+ ----------------------------------------------------------------
47
+
48
+ NLohmann JSON - MIT License
49
+ <https://github.com/nlohmann/json>
50
+
51
+ The source code is based on the work originally developed by Niels Lohmann
52
+ License at <https://github.com/nlohmann/json/blob/develop/LICENSE.MIT>
53
+
54
+ ----------------------------------------------------------------
55
+
56
+ Quantum++ - MIT License
57
+ <https://github.com/softwareqinc/qpp/>
58
+
59
+ The source code is based on the work originally developed by SoftwareQ Inc
60
+ License at <https://github.com/softwareQinc/qpp/blob/main/LICENSE>
61
+
62
+ ----------------------------------------------------------------
63
+
64
+ {fmt} - MIT License
65
+ <https://github.com/fmtlib/fmt>
66
+
67
+ Originally developed by Victor Zverovich and contributors.
68
+ The incorporated source code and its license can be found as a submodule on the CUDA-Q repository.
69
+ License at <https://github.com/fmtlib/fmt/blob/master/LICENSE.rst>
70
+
71
+ ----------------------------------------------------------------
72
+
73
+ SPDLog - MIT License
74
+ <https://github.com/gabime/spdlog>
75
+
76
+ Originally developed by Gabi Melman.
77
+ The incorporated source code and its license can be found as a submodule on the CUDA-Q repository.
78
+ License at <https://github.com/gabime/spdlog/blob/v1.x/LICENSE>
79
+
80
+ ----------------------------------------------------------------
81
+
82
+ NLopt - various licenses, primarily MIT
83
+ <https://github.com/stevengj/nlopt>
84
+
85
+ The source code includes a subset of the optimization libraries combined in NLopt.
86
+ The relevant code included with CUDA-Q is based on work that is licensed under MIT license. More information about the original authors and copyright holders can be found on the respository in the folder for the respective algorithm.
87
+ See also <https://github.com/stevengj/nlopt/blob/master/COPYING>
88
+
89
+ ----------------------------------------------------------------
90
+
91
+ ExaTN - 3-Clause BSD License
92
+ <https://github.com/ORNL-QCI/exatn>
93
+
94
+ License at <https://github.com/ORNL-QCI/exatn/blob/devel/LICENSE>
95
+
96
+ ----------------------------------------------------------------
97
+
98
+ CuQuantum - 3-Clause BSD License
99
+ <https://github.com/NVIDIA/cuQuantum>
100
+
101
+ License at <https://github.com/NVIDIA/cuQuantum/blob/main/LICENSE>
102
+
103
+ ----------------------------------------------------------------
104
+
105
+ C++ Requests - MIT License
106
+ <https://github.com/libcpr/cpr>
107
+
108
+ Originally developed by Huu Nguyen, libcpr and contributors.
109
+ License at <https://github.com/libcpr/cpr/blob/master/LICENSE>
110
+
111
+ ----------------------------------------------------------------
112
+
113
+ BLAS - custom license
114
+ <https://netlib.org/blas/>
115
+
116
+ See also <https://netlib.org/blas/#_licensing>
117
+
118
+ ----------------------------------------------------------------
119
+
120
+ XTL - BSD-3-Clause
121
+ <https://github.com/xtensor-stack/xtl>
122
+
123
+ License at <https://github.com/xtensor-stack/xtensor/blob/master/LICENSE>
124
+
125
+ ----------------------------------------------------------------
126
+
127
+ XTensor - BSD-3-Clause
128
+ <https://github.com/xtensor-stack/xtensor>
129
+
130
+ License at <https://github.com/xtensor-stack/xtensor/blob/master/LICENSE>
131
+
132
+ ----------------------------------------------------------------
133
+
134
+ zlib - custom license
135
+ <https://github.com/madler/zlib>
136
+
137
+ License at <https://github.com/madler/zlib/blob/master/LICENSE>
138
+
139
+ ----------------------------------------------------------------
140
+
141
+ OpenSSL - Apache License 2.0
142
+ <https://www.openssl.org>
143
+
144
+ Licenses at <https://www.openssl.org/source/license.html>
145
+
146
+ ----------------------------------------------------------------
147
+
148
+ Curl - custom license
149
+ <https://github.com/curl/curl/>
150
+
151
+ Licenses at <https://github.com/curl/curl/tree/master/LICENSES>
152
+
153
+ ----------------------------------------------------------------
154
+
155
+ ASIO - Boost Software License - Version 1.0
156
+ <https://github.com/chriskohlhoff/asio>
157
+
158
+ License at <https://github.com/chriskohlhoff/asio/blob/master/asio/LICENSE_1_0.txt>
159
+
160
+ ----------------------------------------------------------------
161
+
162
+ Crow - BSD-3-Clause
163
+ <https://github.com/CrowCpp/Crow>
164
+
165
+ License at <https://github.com/CrowCpp/Crow/blob/master/LICENSE>
166
+
167
+ ----------------------------------------------------------------
168
+
169
+ Tweedledum - MIT License
170
+ <https://github.com/boschmitt/tweedledum>
171
+
172
+ License at <https://github.com/boschmitt/tweedledum/blob/master/LICENSE>
173
+
174
+ ----------------------------------------------------------------
175
+
176
+ Stim - Apache License 2.0
177
+ <https://github.com/quantumlib/Stim>
178
+
179
+ The incorporated source code and its license can be found as a submodule on the CUDA-Q repository.
180
+ License at <https://github.com/quantumlib/Stim/blob/main/LICENSE>
181
+
182
+ ----------------------------------------------------------------
183
+
184
+ AWS SDK for C++ - Apache License 2.0
185
+ <https://github.com/aws/aws-sdk-cpp>
186
+
187
+ The incorporated source code and its license can be found as a submodule on the CUDA-Q repository.
188
+ License at <https://github.com/aws/aws-sdk-cpp/blob/main/LICENSE>
189
+
190
+ ----------------------------------------------------------------
cudaq-0.9.0/PKG-INFO ADDED
@@ -0,0 +1,194 @@
1
+ Metadata-Version: 2.1
2
+ Name: cudaq
3
+ Version: 0.9.0
4
+ Summary: Python bindings for the CUDA-Q toolkit for heterogeneous quantum-classical workflows.
5
+ Author: NVIDIA Corporation & Affiliates
6
+ Maintainer: NVIDIA Corporation & Affiliates
7
+ License: Apache License Version 2.0
8
+
9
+ Copyright (c) 2023 - 2024 NVIDIA Corporation & Affiliates
10
+ All rights reserved.
11
+
12
+ Licensed under the Apache License, Version 2.0 (the "License");
13
+ you may not use this file except in compliance with the License.
14
+ You may obtain a copy of the License at
15
+
16
+ http://www.apache.org/licenses/LICENSE-2.0
17
+
18
+ Unless required by applicable law or agreed to in writing, software
19
+ distributed under the License is distributed on an "AS IS" BASIS,
20
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ See the License for the specific language governing permissions and
22
+ limitations under the License.
23
+
24
+ Project-URL: Homepage, https://developer.nvidia.com/cuda-q
25
+ Project-URL: Documentation, https://nvidia.github.io/cuda-quantum
26
+ Project-URL: Repository, https://github.com/NVIDIA/cuda-quantum
27
+ Project-URL: Releases, https://nvidia.github.io/cuda-quantum/latest/releases.html
28
+ Keywords: cudaq,cuda-quantum,cuda,quantum,quantum computing,nvidia,high-performance computing
29
+ Classifier: Intended Audience :: Science/Research
30
+ Classifier: Intended Audience :: Developers
31
+ Classifier: Programming Language :: Python
32
+ Classifier: Programming Language :: Python :: 3
33
+ Classifier: Programming Language :: Python :: 3.10
34
+ Classifier: Programming Language :: Python :: 3.11
35
+ Classifier: Programming Language :: Python :: 3.12
36
+ Classifier: Environment :: GPU :: NVIDIA CUDA
37
+ Classifier: Environment :: GPU :: NVIDIA CUDA :: 11
38
+ Classifier: Environment :: GPU :: NVIDIA CUDA :: 12
39
+ Classifier: Topic :: Software Development
40
+ Classifier: Topic :: Scientific/Engineering
41
+ Requires-Python: >=3.10
42
+ Description-Content-Type: text/markdown
43
+ License-File: LICENSE
44
+ License-File: NOTICE
45
+ License-File: CITATION.cff
46
+ Provides-Extra: chemistry
47
+ Requires-Dist: scipy==1.10.1; extra == "chemistry"
48
+ Requires-Dist: openfermionpyscf==0.5; extra == "chemistry"
49
+ Requires-Dist: h5py<3.11; extra == "chemistry"
50
+ Provides-Extra: visualization
51
+ Requires-Dist: qutip<5; extra == "visualization"
52
+ Requires-Dist: matplotlib>=3.5; extra == "visualization"
53
+
54
+ # Welcome to the CUDA-Q Python API
55
+
56
+ CUDA-Q is a comprehensive framework for quantum programming. It features:
57
+
58
+ - A programming model which extends C++ and Python with quantum kernels,
59
+ enabling high-level programming in familiar languages
60
+ - A high-performance quantum compiler, `nvq++`, based on the industry standard
61
+ LLVM toolchain
62
+ - Interoperability with all of the leading models and tools for accelerated
63
+ computing, including CUDA, ISO standard parallelism, OpenMP, and OpenACC
64
+ - The ability to utilize and seamlessly switch between different quantum
65
+ technologies, including state-of-the-art simulator backends with NVIDIA
66
+ cuQuantum and a number of different physical quantum processors (QPUs)
67
+
68
+ The CUDA-Q Python wheels contain the Python API and core components of CUDA-Q.
69
+ This package installs CUDA-Q binaries that are compatible with a CUDA version
70
+ 11.x (where x >= 8) or 12.x. More information about available packages as
71
+ well as a link to the documentation and examples for each version can be found
72
+ in the [release notes][cudaq_docs_releases]. System and compatibility
73
+ requirements are listed in the Installation Guide of the linked documentation.
74
+
75
+ **Note**: CUDA-Q is currently only supported on Linux operating systems using
76
+ `x86_64` or `aarch64`/`arm64` processors.
77
+
78
+ [cudaq_docs_releases]:
79
+ https://nvidia.github.io/cuda-quantum/latest/releases.html
80
+
81
+ ## Installation Including GPU-Acceleration
82
+
83
+ [//]: # (Begin complete install)
84
+
85
+ CUDA-Q does not require a GPU to use, but some components are GPU-accelerated.
86
+
87
+ Getting started with CUDA-Q on `x86_64` platforms simply requires `pip install
88
+ cudaq`. Please make sure your `pip` version is \>= 24.0.
89
+ If you have an NVIDIA GPU on your host system, you will be
90
+ able to use it without any further installation steps.
91
+
92
+ > **Important:**
93
+ > Please check if you have an existing installation of the `cuda-quantum`, `cudaq-quantum-cu11`, or `cuda-quantum-cu12` package, and uninstall it prior to installation. Different CUDA-Q binary distributions may conflict with each other causing issues.
94
+
95
+
96
+ If you want to perform multi-GPU simulations, or if you are using
97
+ `aarch64`/`arm64` processors, additional components must be installed. We
98
+ recommend using [Conda](https://docs.conda.io/en/latest/) to do so. If you are
99
+ not already using Conda, you can install a minimal version following the
100
+ instructions [here](https://docs.anaconda.com/miniconda/). The following
101
+ commands will create and activate a complete environment for CUDA-Q with all its
102
+ dependencies:
103
+
104
+ [//]: # (Begin conda install)
105
+
106
+ ```console
107
+ cuda_version=11.8.0 # set this variable to version 11.x (where x >= 8) or 12.x
108
+ conda create -y -n cudaq-env python=3.11 pip
109
+ conda install -y -n cudaq-env -c "nvidia/label/cuda-${cuda_version}" cuda
110
+ conda install -y -n cudaq-env -c conda-forge mpi4py openmpi cxx-compiler
111
+ conda env config vars set -n cudaq-env LD_LIBRARY_PATH="$CONDA_PREFIX/envs/cudaq-env/lib:$LD_LIBRARY_PATH"
112
+ conda env config vars set -n cudaq-env MPI_PATH=$CONDA_PREFIX/envs/cudaq-env
113
+ conda activate cudaq-env
114
+ pip install cudaq
115
+ source $CONDA_PREFIX/lib/python3.11/site-packages/distributed_interfaces/activate_custom_mpi.sh
116
+ ```
117
+
118
+ [//]: # (End conda install)
119
+
120
+ You must configure MPI by setting the following environment variables:
121
+
122
+ [//]: # (Begin ompi setup)
123
+
124
+ ```console
125
+ export OMPI_MCA_opal_cuda_support=true OMPI_MCA_btl='^openib'
126
+ ```
127
+
128
+ [//]: # (End ompi setup)
129
+
130
+ *If you do not set these variables you may encounter a segmentation fault.*
131
+
132
+ **Important**: It is *not* sufficient to set these variable within the Conda
133
+ environment, like the commands above do for `LD_LIBRARY_PATH`. To avoid having
134
+ to set them every time you launch a new shell, we recommend adding them to
135
+ `~/.profile` (create the file if it does not exist), and to `~/.bash_profile` or
136
+ `~/.bash_login` if such a file exists.
137
+
138
+ [//]: # (End complete install)
139
+
140
+ MPI uses [SSH](https://en.wikipedia.org/wiki/Secure_Shell) or
141
+ [RSH](https://en.wikipedia.org/wiki/Remote_Shell) to communicate with each node
142
+ unless another resource manager, such as
143
+ [SLURM](https://slurm.schedmd.com/overview.html), is used. If you are
144
+ encountering an error "The value of the MCA parameter `plm_rsh_agent` was set to
145
+ a path that could not be found", please make sure you have an SSH Client
146
+ installed.
147
+
148
+ ## Running CUDA-Q
149
+
150
+ You should now be able to import CUDA-Q and start building quantum programs in
151
+ Python!
152
+
153
+ ```console
154
+ import cudaq
155
+
156
+ kernel = cudaq.make_kernel()
157
+ qubit = kernel.qalloc()
158
+ kernel.x(qubit)
159
+ kernel.mz(qubit)
160
+
161
+ result = cudaq.sample(kernel)
162
+ ```
163
+
164
+ Additional examples and documentation are linked in the [release
165
+ notes][cudaq_docs_releases].
166
+
167
+ ## Contributing
168
+
169
+ There are many ways in which you can get involved with CUDA-Q. If you are
170
+ interested in developing quantum applications with CUDA-Q, our [GitHub
171
+ repository][github_link] is a great place to get started! For more information
172
+ about contributing to the CUDA-Q platform, please take a look at
173
+ [Contributing.md](https://github.com/NVIDIA/cuda-quantum/blob/main/Contributing.md).
174
+
175
+ ## License
176
+
177
+ CUDA-Q is an open source project. The source code is available on
178
+ [GitHub][github_link] and licensed under [Apache License
179
+ 2.0](https://github.com/NVIDIA/cuda-quantum/blob/main/LICENSE). CUDA-Q makes use
180
+ of the NVIDIA cuQuantum SDK to enable high-performance simulation, which is held
181
+ to its own respective license.
182
+
183
+ [github_link]: https://github.com/NVIDIA/cuda-quantum/
184
+
185
+ ## Feedback
186
+
187
+ Please let us know your feedback and ideas for the CUDA-Q platform in the
188
+ [Discussions][discussions] tab of our [GitHub repository][github_repo], or [file
189
+ an issue][cuda_quantum_issues]. To report security concerns please reach out to
190
+ [cuda-quantum@nvidia.com](mailto:cuda-quantum@nvidia.com).
191
+
192
+ [discussions]: https://github.com/NVIDIA/cuda-quantum/discussions
193
+ [cuda_quantum_issues]: https://github.com/NVIDIA/cuda-quantum/issues
194
+ [github_repo]: https://github.com/NVIDIA/cuda-quantum
cudaq-0.9.0/README.md ADDED
@@ -0,0 +1,141 @@
1
+ # Welcome to the CUDA-Q Python API
2
+
3
+ CUDA-Q is a comprehensive framework for quantum programming. It features:
4
+
5
+ - A programming model which extends C++ and Python with quantum kernels,
6
+ enabling high-level programming in familiar languages
7
+ - A high-performance quantum compiler, `nvq++`, based on the industry standard
8
+ LLVM toolchain
9
+ - Interoperability with all of the leading models and tools for accelerated
10
+ computing, including CUDA, ISO standard parallelism, OpenMP, and OpenACC
11
+ - The ability to utilize and seamlessly switch between different quantum
12
+ technologies, including state-of-the-art simulator backends with NVIDIA
13
+ cuQuantum and a number of different physical quantum processors (QPUs)
14
+
15
+ The CUDA-Q Python wheels contain the Python API and core components of CUDA-Q.
16
+ This package installs CUDA-Q binaries that are compatible with a CUDA version
17
+ 11.x (where x >= 8) or 12.x. More information about available packages as
18
+ well as a link to the documentation and examples for each version can be found
19
+ in the [release notes][cudaq_docs_releases]. System and compatibility
20
+ requirements are listed in the Installation Guide of the linked documentation.
21
+
22
+ **Note**: CUDA-Q is currently only supported on Linux operating systems using
23
+ `x86_64` or `aarch64`/`arm64` processors.
24
+
25
+ [cudaq_docs_releases]:
26
+ https://nvidia.github.io/cuda-quantum/latest/releases.html
27
+
28
+ ## Installation Including GPU-Acceleration
29
+
30
+ [//]: # (Begin complete install)
31
+
32
+ CUDA-Q does not require a GPU to use, but some components are GPU-accelerated.
33
+
34
+ Getting started with CUDA-Q on `x86_64` platforms simply requires `pip install
35
+ cudaq`. Please make sure your `pip` version is \>= 24.0.
36
+ If you have an NVIDIA GPU on your host system, you will be
37
+ able to use it without any further installation steps.
38
+
39
+ > **Important:**
40
+ > Please check if you have an existing installation of the `cuda-quantum`, `cudaq-quantum-cu11`, or `cuda-quantum-cu12` package, and uninstall it prior to installation. Different CUDA-Q binary distributions may conflict with each other causing issues.
41
+
42
+
43
+ If you want to perform multi-GPU simulations, or if you are using
44
+ `aarch64`/`arm64` processors, additional components must be installed. We
45
+ recommend using [Conda](https://docs.conda.io/en/latest/) to do so. If you are
46
+ not already using Conda, you can install a minimal version following the
47
+ instructions [here](https://docs.anaconda.com/miniconda/). The following
48
+ commands will create and activate a complete environment for CUDA-Q with all its
49
+ dependencies:
50
+
51
+ [//]: # (Begin conda install)
52
+
53
+ ```console
54
+ cuda_version=11.8.0 # set this variable to version 11.x (where x >= 8) or 12.x
55
+ conda create -y -n cudaq-env python=3.11 pip
56
+ conda install -y -n cudaq-env -c "nvidia/label/cuda-${cuda_version}" cuda
57
+ conda install -y -n cudaq-env -c conda-forge mpi4py openmpi cxx-compiler
58
+ conda env config vars set -n cudaq-env LD_LIBRARY_PATH="$CONDA_PREFIX/envs/cudaq-env/lib:$LD_LIBRARY_PATH"
59
+ conda env config vars set -n cudaq-env MPI_PATH=$CONDA_PREFIX/envs/cudaq-env
60
+ conda activate cudaq-env
61
+ pip install cudaq
62
+ source $CONDA_PREFIX/lib/python3.11/site-packages/distributed_interfaces/activate_custom_mpi.sh
63
+ ```
64
+
65
+ [//]: # (End conda install)
66
+
67
+ You must configure MPI by setting the following environment variables:
68
+
69
+ [//]: # (Begin ompi setup)
70
+
71
+ ```console
72
+ export OMPI_MCA_opal_cuda_support=true OMPI_MCA_btl='^openib'
73
+ ```
74
+
75
+ [//]: # (End ompi setup)
76
+
77
+ *If you do not set these variables you may encounter a segmentation fault.*
78
+
79
+ **Important**: It is *not* sufficient to set these variable within the Conda
80
+ environment, like the commands above do for `LD_LIBRARY_PATH`. To avoid having
81
+ to set them every time you launch a new shell, we recommend adding them to
82
+ `~/.profile` (create the file if it does not exist), and to `~/.bash_profile` or
83
+ `~/.bash_login` if such a file exists.
84
+
85
+ [//]: # (End complete install)
86
+
87
+ MPI uses [SSH](https://en.wikipedia.org/wiki/Secure_Shell) or
88
+ [RSH](https://en.wikipedia.org/wiki/Remote_Shell) to communicate with each node
89
+ unless another resource manager, such as
90
+ [SLURM](https://slurm.schedmd.com/overview.html), is used. If you are
91
+ encountering an error "The value of the MCA parameter `plm_rsh_agent` was set to
92
+ a path that could not be found", please make sure you have an SSH Client
93
+ installed.
94
+
95
+ ## Running CUDA-Q
96
+
97
+ You should now be able to import CUDA-Q and start building quantum programs in
98
+ Python!
99
+
100
+ ```console
101
+ import cudaq
102
+
103
+ kernel = cudaq.make_kernel()
104
+ qubit = kernel.qalloc()
105
+ kernel.x(qubit)
106
+ kernel.mz(qubit)
107
+
108
+ result = cudaq.sample(kernel)
109
+ ```
110
+
111
+ Additional examples and documentation are linked in the [release
112
+ notes][cudaq_docs_releases].
113
+
114
+ ## Contributing
115
+
116
+ There are many ways in which you can get involved with CUDA-Q. If you are
117
+ interested in developing quantum applications with CUDA-Q, our [GitHub
118
+ repository][github_link] is a great place to get started! For more information
119
+ about contributing to the CUDA-Q platform, please take a look at
120
+ [Contributing.md](https://github.com/NVIDIA/cuda-quantum/blob/main/Contributing.md).
121
+
122
+ ## License
123
+
124
+ CUDA-Q is an open source project. The source code is available on
125
+ [GitHub][github_link] and licensed under [Apache License
126
+ 2.0](https://github.com/NVIDIA/cuda-quantum/blob/main/LICENSE). CUDA-Q makes use
127
+ of the NVIDIA cuQuantum SDK to enable high-performance simulation, which is held
128
+ to its own respective license.
129
+
130
+ [github_link]: https://github.com/NVIDIA/cuda-quantum/
131
+
132
+ ## Feedback
133
+
134
+ Please let us know your feedback and ideas for the CUDA-Q platform in the
135
+ [Discussions][discussions] tab of our [GitHub repository][github_repo], or [file
136
+ an issue][cuda_quantum_issues]. To report security concerns please reach out to
137
+ [cuda-quantum@nvidia.com](mailto:cuda-quantum@nvidia.com).
138
+
139
+ [discussions]: https://github.com/NVIDIA/cuda-quantum/discussions
140
+ [cuda_quantum_issues]: https://github.com/NVIDIA/cuda-quantum/issues
141
+ [github_repo]: https://github.com/NVIDIA/cuda-quantum
@@ -0,0 +1 @@
1
+ 0.9.0
@@ -0,0 +1,194 @@
1
+ Metadata-Version: 2.1
2
+ Name: cudaq
3
+ Version: 0.9.0
4
+ Summary: Python bindings for the CUDA-Q toolkit for heterogeneous quantum-classical workflows.
5
+ Author: NVIDIA Corporation & Affiliates
6
+ Maintainer: NVIDIA Corporation & Affiliates
7
+ License: Apache License Version 2.0
8
+
9
+ Copyright (c) 2023 - 2024 NVIDIA Corporation & Affiliates
10
+ All rights reserved.
11
+
12
+ Licensed under the Apache License, Version 2.0 (the "License");
13
+ you may not use this file except in compliance with the License.
14
+ You may obtain a copy of the License at
15
+
16
+ http://www.apache.org/licenses/LICENSE-2.0
17
+
18
+ Unless required by applicable law or agreed to in writing, software
19
+ distributed under the License is distributed on an "AS IS" BASIS,
20
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ See the License for the specific language governing permissions and
22
+ limitations under the License.
23
+
24
+ Project-URL: Homepage, https://developer.nvidia.com/cuda-q
25
+ Project-URL: Documentation, https://nvidia.github.io/cuda-quantum
26
+ Project-URL: Repository, https://github.com/NVIDIA/cuda-quantum
27
+ Project-URL: Releases, https://nvidia.github.io/cuda-quantum/latest/releases.html
28
+ Keywords: cudaq,cuda-quantum,cuda,quantum,quantum computing,nvidia,high-performance computing
29
+ Classifier: Intended Audience :: Science/Research
30
+ Classifier: Intended Audience :: Developers
31
+ Classifier: Programming Language :: Python
32
+ Classifier: Programming Language :: Python :: 3
33
+ Classifier: Programming Language :: Python :: 3.10
34
+ Classifier: Programming Language :: Python :: 3.11
35
+ Classifier: Programming Language :: Python :: 3.12
36
+ Classifier: Environment :: GPU :: NVIDIA CUDA
37
+ Classifier: Environment :: GPU :: NVIDIA CUDA :: 11
38
+ Classifier: Environment :: GPU :: NVIDIA CUDA :: 12
39
+ Classifier: Topic :: Software Development
40
+ Classifier: Topic :: Scientific/Engineering
41
+ Requires-Python: >=3.10
42
+ Description-Content-Type: text/markdown
43
+ License-File: LICENSE
44
+ License-File: NOTICE
45
+ License-File: CITATION.cff
46
+ Provides-Extra: chemistry
47
+ Requires-Dist: scipy==1.10.1; extra == "chemistry"
48
+ Requires-Dist: openfermionpyscf==0.5; extra == "chemistry"
49
+ Requires-Dist: h5py<3.11; extra == "chemistry"
50
+ Provides-Extra: visualization
51
+ Requires-Dist: qutip<5; extra == "visualization"
52
+ Requires-Dist: matplotlib>=3.5; extra == "visualization"
53
+
54
+ # Welcome to the CUDA-Q Python API
55
+
56
+ CUDA-Q is a comprehensive framework for quantum programming. It features:
57
+
58
+ - A programming model which extends C++ and Python with quantum kernels,
59
+ enabling high-level programming in familiar languages
60
+ - A high-performance quantum compiler, `nvq++`, based on the industry standard
61
+ LLVM toolchain
62
+ - Interoperability with all of the leading models and tools for accelerated
63
+ computing, including CUDA, ISO standard parallelism, OpenMP, and OpenACC
64
+ - The ability to utilize and seamlessly switch between different quantum
65
+ technologies, including state-of-the-art simulator backends with NVIDIA
66
+ cuQuantum and a number of different physical quantum processors (QPUs)
67
+
68
+ The CUDA-Q Python wheels contain the Python API and core components of CUDA-Q.
69
+ This package installs CUDA-Q binaries that are compatible with a CUDA version
70
+ 11.x (where x >= 8) or 12.x. More information about available packages as
71
+ well as a link to the documentation and examples for each version can be found
72
+ in the [release notes][cudaq_docs_releases]. System and compatibility
73
+ requirements are listed in the Installation Guide of the linked documentation.
74
+
75
+ **Note**: CUDA-Q is currently only supported on Linux operating systems using
76
+ `x86_64` or `aarch64`/`arm64` processors.
77
+
78
+ [cudaq_docs_releases]:
79
+ https://nvidia.github.io/cuda-quantum/latest/releases.html
80
+
81
+ ## Installation Including GPU-Acceleration
82
+
83
+ [//]: # (Begin complete install)
84
+
85
+ CUDA-Q does not require a GPU to use, but some components are GPU-accelerated.
86
+
87
+ Getting started with CUDA-Q on `x86_64` platforms simply requires `pip install
88
+ cudaq`. Please make sure your `pip` version is \>= 24.0.
89
+ If you have an NVIDIA GPU on your host system, you will be
90
+ able to use it without any further installation steps.
91
+
92
+ > **Important:**
93
+ > Please check if you have an existing installation of the `cuda-quantum`, `cudaq-quantum-cu11`, or `cuda-quantum-cu12` package, and uninstall it prior to installation. Different CUDA-Q binary distributions may conflict with each other causing issues.
94
+
95
+
96
+ If you want to perform multi-GPU simulations, or if you are using
97
+ `aarch64`/`arm64` processors, additional components must be installed. We
98
+ recommend using [Conda](https://docs.conda.io/en/latest/) to do so. If you are
99
+ not already using Conda, you can install a minimal version following the
100
+ instructions [here](https://docs.anaconda.com/miniconda/). The following
101
+ commands will create and activate a complete environment for CUDA-Q with all its
102
+ dependencies:
103
+
104
+ [//]: # (Begin conda install)
105
+
106
+ ```console
107
+ cuda_version=11.8.0 # set this variable to version 11.x (where x >= 8) or 12.x
108
+ conda create -y -n cudaq-env python=3.11 pip
109
+ conda install -y -n cudaq-env -c "nvidia/label/cuda-${cuda_version}" cuda
110
+ conda install -y -n cudaq-env -c conda-forge mpi4py openmpi cxx-compiler
111
+ conda env config vars set -n cudaq-env LD_LIBRARY_PATH="$CONDA_PREFIX/envs/cudaq-env/lib:$LD_LIBRARY_PATH"
112
+ conda env config vars set -n cudaq-env MPI_PATH=$CONDA_PREFIX/envs/cudaq-env
113
+ conda activate cudaq-env
114
+ pip install cudaq
115
+ source $CONDA_PREFIX/lib/python3.11/site-packages/distributed_interfaces/activate_custom_mpi.sh
116
+ ```
117
+
118
+ [//]: # (End conda install)
119
+
120
+ You must configure MPI by setting the following environment variables:
121
+
122
+ [//]: # (Begin ompi setup)
123
+
124
+ ```console
125
+ export OMPI_MCA_opal_cuda_support=true OMPI_MCA_btl='^openib'
126
+ ```
127
+
128
+ [//]: # (End ompi setup)
129
+
130
+ *If you do not set these variables you may encounter a segmentation fault.*
131
+
132
+ **Important**: It is *not* sufficient to set these variable within the Conda
133
+ environment, like the commands above do for `LD_LIBRARY_PATH`. To avoid having
134
+ to set them every time you launch a new shell, we recommend adding them to
135
+ `~/.profile` (create the file if it does not exist), and to `~/.bash_profile` or
136
+ `~/.bash_login` if such a file exists.
137
+
138
+ [//]: # (End complete install)
139
+
140
+ MPI uses [SSH](https://en.wikipedia.org/wiki/Secure_Shell) or
141
+ [RSH](https://en.wikipedia.org/wiki/Remote_Shell) to communicate with each node
142
+ unless another resource manager, such as
143
+ [SLURM](https://slurm.schedmd.com/overview.html), is used. If you are
144
+ encountering an error "The value of the MCA parameter `plm_rsh_agent` was set to
145
+ a path that could not be found", please make sure you have an SSH Client
146
+ installed.
147
+
148
+ ## Running CUDA-Q
149
+
150
+ You should now be able to import CUDA-Q and start building quantum programs in
151
+ Python!
152
+
153
+ ```console
154
+ import cudaq
155
+
156
+ kernel = cudaq.make_kernel()
157
+ qubit = kernel.qalloc()
158
+ kernel.x(qubit)
159
+ kernel.mz(qubit)
160
+
161
+ result = cudaq.sample(kernel)
162
+ ```
163
+
164
+ Additional examples and documentation are linked in the [release
165
+ notes][cudaq_docs_releases].
166
+
167
+ ## Contributing
168
+
169
+ There are many ways in which you can get involved with CUDA-Q. If you are
170
+ interested in developing quantum applications with CUDA-Q, our [GitHub
171
+ repository][github_link] is a great place to get started! For more information
172
+ about contributing to the CUDA-Q platform, please take a look at
173
+ [Contributing.md](https://github.com/NVIDIA/cuda-quantum/blob/main/Contributing.md).
174
+
175
+ ## License
176
+
177
+ CUDA-Q is an open source project. The source code is available on
178
+ [GitHub][github_link] and licensed under [Apache License
179
+ 2.0](https://github.com/NVIDIA/cuda-quantum/blob/main/LICENSE). CUDA-Q makes use
180
+ of the NVIDIA cuQuantum SDK to enable high-performance simulation, which is held
181
+ to its own respective license.
182
+
183
+ [github_link]: https://github.com/NVIDIA/cuda-quantum/
184
+
185
+ ## Feedback
186
+
187
+ Please let us know your feedback and ideas for the CUDA-Q platform in the
188
+ [Discussions][discussions] tab of our [GitHub repository][github_repo], or [file
189
+ an issue][cuda_quantum_issues]. To report security concerns please reach out to
190
+ [cuda-quantum@nvidia.com](mailto:cuda-quantum@nvidia.com).
191
+
192
+ [discussions]: https://github.com/NVIDIA/cuda-quantum/discussions
193
+ [cuda_quantum_issues]: https://github.com/NVIDIA/cuda-quantum/issues
194
+ [github_repo]: https://github.com/NVIDIA/cuda-quantum
@@ -0,0 +1,13 @@
1
+ CITATION.cff
2
+ LICENSE
3
+ NOTICE
4
+ README.md
5
+ _version.txt
6
+ pyproject.toml
7
+ setup.py
8
+ cudaq.egg-info/PKG-INFO
9
+ cudaq.egg-info/SOURCES.txt
10
+ cudaq.egg-info/dependency_links.txt
11
+ cudaq.egg-info/not-zip-safe
12
+ cudaq.egg-info/requires.txt
13
+ cudaq.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,9 @@
1
+
2
+ [chemistry]
3
+ scipy==1.10.1
4
+ openfermionpyscf==0.5
5
+ h5py<3.11
6
+
7
+ [visualization]
8
+ qutip<5
9
+ matplotlib>=3.5
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,57 @@
1
+ # ============================================================================ #
2
+ # Copyright (c) 2022 - 2024 NVIDIA Corporation & Affiliates. #
3
+ # All rights reserved. #
4
+ # #
5
+ # This source code and the accompanying materials are made available under #
6
+ # the terms of the Apache License 2.0 which accompanies this distribution. #
7
+ # ============================================================================ #
8
+
9
+ [project]
10
+ name = "cudaq"
11
+ dynamic = ["version", "dependencies"]
12
+ keywords = [ "cudaq", "cuda-quantum", "cuda", "quantum", "quantum computing", "nvidia", "high-performance computing" ]
13
+ description="Python bindings for the CUDA-Q toolkit for heterogeneous quantum-classical workflows."
14
+ authors = [{name = "NVIDIA Corporation & Affiliates"}]
15
+ maintainers = [{name = "NVIDIA Corporation & Affiliates"}]
16
+ readme = { file="README.md", content-type = "text/markdown"}
17
+ requires-python = ">=3.10"
18
+ license = { file="LICENSE" }
19
+ classifiers = [
20
+ 'Intended Audience :: Science/Research',
21
+ 'Intended Audience :: Developers',
22
+ 'Programming Language :: Python',
23
+ 'Programming Language :: Python :: 3',
24
+ 'Programming Language :: Python :: 3.10',
25
+ 'Programming Language :: Python :: 3.11',
26
+ 'Programming Language :: Python :: 3.12',
27
+ "Environment :: GPU :: NVIDIA CUDA",
28
+ "Environment :: GPU :: NVIDIA CUDA :: 11",
29
+ "Environment :: GPU :: NVIDIA CUDA :: 12",
30
+ 'Topic :: Software Development',
31
+ 'Topic :: Scientific/Engineering',
32
+ ]
33
+
34
+ [project.urls]
35
+ Homepage = "https://developer.nvidia.com/cuda-q"
36
+ Documentation = "https://nvidia.github.io/cuda-quantum"
37
+ Repository = "https://github.com/NVIDIA/cuda-quantum"
38
+ Releases = "https://nvidia.github.io/cuda-quantum/latest/releases.html"
39
+
40
+ # We must use h5py<3.11 because 3.11 doesn't include aarch64 Linux wheels.
41
+ # https://github.com/h5py/h5py/issues/2408
42
+ [project.optional-dependencies]
43
+ chemistry = [ "scipy==1.10.1", "openfermionpyscf==0.5", "h5py<3.11" ]
44
+ visualization = [ "qutip<5" , "matplotlib>=3.5" ]
45
+
46
+ [build-system]
47
+ requires = ["setuptools", "nvidia-ml-py"]
48
+ build-backend = "setuptools.build_meta"
49
+
50
+ [tool.setuptools]
51
+ packages = []
52
+ include-package-data = true
53
+ license-files = [ "LICENSE", "NOTICE", "CITATION.cff" ]
54
+
55
+ [tool.setuptools.dynamic]
56
+ version = {file = "_version.txt"}
57
+
cudaq-0.9.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
cudaq-0.9.0/setup.py ADDED
@@ -0,0 +1,195 @@
1
+ # ============================================================================ #
2
+ # Copyright (c) 2022 - 2024 NVIDIA Corporation & Affiliates. #
3
+ # All rights reserved. #
4
+ # #
5
+ # This source code and the accompanying materials are made available under #
6
+ # the terms of the Apache License 2.0 which accompanies this distribution. #
7
+ # ============================================================================ #
8
+
9
+ import ctypes, os, sys
10
+ import importlib.util
11
+ from setuptools import setup
12
+ from typing import Optional
13
+
14
+
15
+ def _log(msg: str) -> None:
16
+ sys.stdout.write(f'[cudaq] {msg}\n')
17
+ sys.stdout.flush()
18
+
19
+
20
+ def _get_version_from_library(
21
+ libnames: list[str],
22
+ funcname: str,
23
+ nvrtc: bool = False,
24
+ ) -> Optional[int]:
25
+ """Returns the library version from list of candidate libraries."""
26
+
27
+ for libname in libnames:
28
+ try:
29
+ _log(f'Looking for library: {libname}')
30
+ runtime_so = ctypes.CDLL(libname)
31
+ break
32
+ except Exception as e:
33
+ _log(f'Failed to open {libname}: {e}')
34
+ else:
35
+ _log('No more candidate library to find')
36
+ return None
37
+
38
+ func = getattr(runtime_so, funcname, None)
39
+ if func is None:
40
+ raise Exception(f'{libname}: {func} could not be found')
41
+ func.restype = ctypes.c_int
42
+
43
+ if nvrtc:
44
+ func.argtypes = [
45
+ ctypes.POINTER(ctypes.c_int),
46
+ ctypes.POINTER(ctypes.c_int),
47
+ ]
48
+ major = ctypes.c_int()
49
+ minor = ctypes.c_int()
50
+ retval = func(major, minor)
51
+ version = major.value * 1000 + minor.value * 10
52
+ else:
53
+ func.argtypes = [
54
+ ctypes.POINTER(ctypes.c_int),
55
+ ]
56
+ version_ref = ctypes.c_int()
57
+ retval = func(version_ref)
58
+ version = version_ref.value
59
+
60
+ if retval != 0:
61
+ raise Exception(f'{libname}: {func} returned error: {retval}')
62
+ _log(f'Detected version: {version}')
63
+ return version
64
+
65
+
66
+ def _get_cuda_version() -> Optional[int]:
67
+ """Returns the detected CUDA version or None."""
68
+
69
+ version = None
70
+
71
+ # Try to detect version from NVRTC
72
+ libnames = [
73
+ 'libnvrtc.so.12',
74
+ 'libnvrtc.so.11.2',
75
+ 'libnvrtc.so.11.1',
76
+ 'libnvrtc.so.11.0',
77
+ ]
78
+ _log(f'Trying to detect CUDA version from libraries: {libnames}')
79
+ try:
80
+ version = _get_version_from_library(libnames, 'nvrtcVersion', True)
81
+ except Exception as e:
82
+ _log(f"Error: {e}") # log and move on
83
+ if version is not None:
84
+ _log("Autodetection succeeded")
85
+ return version
86
+
87
+ # Try to detect version from CUDART (a CUDA context will be initialized)
88
+ libnames = [
89
+ 'libcudart.so.12',
90
+ 'libcudart.so.11.0',
91
+ ]
92
+ _log(f'Trying to detect CUDA version from libraries: {libnames}')
93
+ try:
94
+ version = _get_version_from_library(libnames, 'cudaRuntimeGetVersion',
95
+ False)
96
+ except Exception as e:
97
+ _log(f"Error: {e}") # log and move on
98
+ if version is not None:
99
+ _log("Autodetection succeeded")
100
+ return version
101
+
102
+ # Try to get version from NVIDIA Management Library
103
+ try:
104
+ _log(f'Trying to detect CUDA version using NVIDIA Management Library')
105
+ from pynvml import nvmlInit, nvmlSystemGetCudaDriverVersion
106
+ nvmlInit()
107
+ version = nvmlSystemGetCudaDriverVersion()
108
+ except Exception as e:
109
+ _log(f"Error: {e}") # log and move on
110
+ if version is not None:
111
+ _log(f'Detected version: {version}')
112
+ _log("Autodetection succeeded")
113
+ return version
114
+
115
+ _log("Autodetection failed")
116
+ return None
117
+
118
+
119
+ def _infer_best_package() -> str:
120
+
121
+ # Find the existing wheel installation
122
+ installed = []
123
+ for pkg_suffix in ['', '-cu11', '-cu12']:
124
+ _log(f"Looking for existing installation of cuda-quantum{pkg_suffix}.")
125
+ try:
126
+ package_spec = importlib.util.find_spec(f"cuda-quantum{pkg_suffix}")
127
+ if package_spec is None:
128
+ _log("No installation found.")
129
+ else:
130
+ installed.append(f"cuda-quantum{pkg_suffix}")
131
+ _log("Installation found.")
132
+ except:
133
+ _log("No installation found.")
134
+ pass
135
+
136
+ cuda_version = _get_cuda_version()
137
+ if cuda_version is None:
138
+ cudaq_bdist = 'cuda-quantum-cu12'
139
+ elif cuda_version < 11000:
140
+ raise Exception(f'Your CUDA version ({cuda_version}) is too old.')
141
+ elif cuda_version < 12000:
142
+ cudaq_bdist = 'cuda-quantum-cu11'
143
+ elif cuda_version < 13000:
144
+ cudaq_bdist = 'cuda-quantum-cu12'
145
+ else:
146
+ raise Exception(f'Your CUDA version ({cuda_version}) is too new.')
147
+ _log(f"Identified {cudaq_bdist} as the best package.")
148
+
149
+ # Disallow -cu11 & -cu12 wheels from coexisting
150
+ conflicting = ", ".join((pkg for pkg in installed if pkg != cudaq_bdist))
151
+ _log(f"Conflicting packages: {conflicting}")
152
+ if conflicting != '':
153
+ _log("Abort.")
154
+ raise Exception(
155
+ f'You have a conflicting CUDA-Q version installed.'
156
+ f'Please remove the following package(s): {conflicting}')
157
+ return cudaq_bdist
158
+
159
+
160
+ # This setup handles 3 cases:
161
+ # 1. At the release time, we use it to generate source distribution (which contains
162
+ # this script).
163
+ # 2. If the source distribution is generated for the deprecated cuda-quantum package
164
+ # name, this script raises an exception at install time asking to install cudaq.
165
+ # 3. If the source distribution is generated for a valid cudaq version,
166
+ # this script identifies the installed CUDA version at cudaq install time
167
+ # and downloads the corresponding CUDA-Q binary distribution.
168
+ # For case 1, `CUDAQ_META_WHEEL_BUILD` is set to 1.
169
+ setup_dir = os.path.dirname(os.path.abspath(__file__))
170
+ data_files = []
171
+ install_requires = []
172
+ if os.environ.get('CUDAQ_META_WHEEL_BUILD', '0') == '1':
173
+ # Case 1: create source distribution
174
+ if os.path.exists(os.path.join(setup_dir, "_deprecated.txt")):
175
+ data_files = [('', [
176
+ '_deprecated.txt',
177
+ ])] # extra files to be copied into the distribution
178
+ else:
179
+ # Case 2: install cuda-quantum source distribution
180
+ if os.path.exists(os.path.join(setup_dir, "_deprecated.txt")):
181
+ with open(os.path.join(setup_dir, "_deprecated.txt"), "r") as f:
182
+ deprecation = f.read()
183
+ raise Exception(f'This package is deprecated. \n' + deprecation)
184
+ # Case 3: install cudaq source distribution
185
+ with open(os.path.join(setup_dir, "_version.txt"), "r") as f:
186
+ __version__ = f.read()
187
+ install_requires = [
188
+ f"{_infer_best_package()}=={__version__}",
189
+ ]
190
+
191
+ setup(
192
+ zip_safe=False,
193
+ data_files=data_files,
194
+ install_requires=install_requires,
195
+ )