cuquantum-python-jax 0.0.1__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.
Files changed (25) hide show
  1. cuquantum_python_jax-0.0.1/LICENSE +28 -0
  2. cuquantum_python_jax-0.0.1/MANIFEST.in +6 -0
  3. cuquantum_python_jax-0.0.1/PKG-INFO +138 -0
  4. cuquantum_python_jax-0.0.1/README.md +101 -0
  5. cuquantum_python_jax-0.0.1/cuquantum/densitymat/jax/__init__.py +11 -0
  6. cuquantum_python_jax-0.0.1/cuquantum/densitymat/jax/cppsrc/CMakeLists.txt +93 -0
  7. cuquantum_python_jax-0.0.1/cuquantum/densitymat/jax/cppsrc/cudensitymat_jax.cpp +329 -0
  8. cuquantum_python_jax-0.0.1/cuquantum/densitymat/jax/cppsrc/cudensitymat_jax.h +13 -0
  9. cuquantum_python_jax-0.0.1/cuquantum/densitymat/jax/cppsrc/pybind.cpp +35 -0
  10. cuquantum_python_jax-0.0.1/cuquantum/densitymat/jax/cppsrc/utils.h +31 -0
  11. cuquantum_python_jax-0.0.1/cuquantum/densitymat/jax/operator_action.py +178 -0
  12. cuquantum_python_jax-0.0.1/cuquantum/densitymat/jax/pysrc/__init__.py +0 -0
  13. cuquantum_python_jax-0.0.1/cuquantum/densitymat/jax/pysrc/base.py +89 -0
  14. cuquantum_python_jax-0.0.1/cuquantum/densitymat/jax/pysrc/context.py +236 -0
  15. cuquantum_python_jax-0.0.1/cuquantum/densitymat/jax/pysrc/operator_action.py +324 -0
  16. cuquantum_python_jax-0.0.1/cuquantum/densitymat/jax/pysrc/operators.py +634 -0
  17. cuquantum_python_jax-0.0.1/cuquantum_python_jax.egg-info/PKG-INFO +138 -0
  18. cuquantum_python_jax-0.0.1/cuquantum_python_jax.egg-info/SOURCES.txt +23 -0
  19. cuquantum_python_jax-0.0.1/cuquantum_python_jax.egg-info/dependency_links.txt +1 -0
  20. cuquantum_python_jax-0.0.1/cuquantum_python_jax.egg-info/not-zip-safe +1 -0
  21. cuquantum_python_jax-0.0.1/cuquantum_python_jax.egg-info/requires.txt +3 -0
  22. cuquantum_python_jax-0.0.1/cuquantum_python_jax.egg-info/top_level.txt +2 -0
  23. cuquantum_python_jax-0.0.1/pyproject.toml +3 -0
  24. cuquantum_python_jax-0.0.1/setup.cfg +4 -0
  25. cuquantum_python_jax-0.0.1/setup.py +130 -0
@@ -0,0 +1,28 @@
1
+ Copyright (c) 2021-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2
+
3
+ BSD-3-Clause
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,6 @@
1
+ include cuquantum/densitymat/jax/cppsrc/CMakeLists.txt
2
+ include cuquantum/densitymat/jax/cppsrc/cudensitymat_jax.cpp
3
+ include cuquantum/densitymat/jax/cppsrc/cudensitymat_jax.h
4
+ include cuquantum/densitymat/jax/cppsrc/pybind.cpp
5
+ include cuquantum/densitymat/jax/cppsrc/utils.h
6
+ prune tests*
@@ -0,0 +1,138 @@
1
+ Metadata-Version: 2.4
2
+ Name: cuquantum-python-jax
3
+ Version: 0.0.1
4
+ Summary: NVIDIA cuQuantum Python JAX
5
+ Home-page: https://developer.nvidia.com/cuquantum-sdk
6
+ Author: NVIDIA Corporation
7
+ Author-email: cuquantum-python@nvidia.com
8
+ License: BSD-3-Clause
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Operating System :: POSIX :: Linux
11
+ Classifier: Topic :: Education
12
+ Classifier: Topic :: Scientific/Engineering
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: Implementation :: CPython
18
+ Classifier: Environment :: GPU :: NVIDIA CUDA
19
+ Classifier: Environment :: GPU :: NVIDIA CUDA :: 12
20
+ Requires-Python: >=3.11.0
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: cuquantum-python-cu12~=25.09
24
+ Requires-Dist: jax[cuda12-local]<0.7,>=0.5
25
+ Requires-Dist: pybind11
26
+ Dynamic: author
27
+ Dynamic: author-email
28
+ Dynamic: classifier
29
+ Dynamic: description
30
+ Dynamic: description-content-type
31
+ Dynamic: home-page
32
+ Dynamic: license
33
+ Dynamic: license-file
34
+ Dynamic: requires-dist
35
+ Dynamic: requires-python
36
+ Dynamic: summary
37
+
38
+ # cuQuantum Python JAX
39
+
40
+ cuQuantum Python JAX provides a JAX extension for cuQuantum Python. It exposes selected functionality of cuQuantum SDK in a JAX-compatible way that enables JAX frameworks to directly interface with the exposed cuQuantum API. In the current release, cuQuantum JAX exposes a JAX interface to the Operator Action API from the cuDensityMat library.
41
+
42
+ ## Documentation
43
+
44
+ Please visit the [NVIDIA cuQuantum Python documentation](https://docs.nvidia.com/cuda/cuquantum/latest/python).
45
+
46
+ ## Building and installing cuQuantum Python JAX
47
+
48
+ ### Requirements
49
+
50
+ The install-time dependencies of the cuQuantum Python package include:
51
+
52
+ * cuquantum-python-cu12~=25.09
53
+ * setuptools>=77.0.3
54
+ * jax[cuda12]>=0.5,<0.7 or jax[cuda12-local]>=0.5,<0.7
55
+ * pybind11
56
+
57
+ Note: cuQuantum Python JAX is only supported with CUDA 12.
58
+
59
+ #### Installation using `jax[cuda12-local]`
60
+
61
+ `cuquantum-python-jax` depends explicitly on `jax[cuda12-local]`. `pip install cuquantum-python-jax` will install `jax[cuda12-local]`.
62
+
63
+ Using `jax[cuda12-local]` assumes the user provides both cuDNN and the CUDA Toolkit. cuDNN is not a part of the CUDA Toolkit and requires an additional installation. The user must also specify `LD_LIBRARY_PATH`, including the library folders containing `libcudnn.so` and `libcupti.so`.
64
+
65
+ `libcupti.so` is provided by the CUDA Toolkit. If the CUDA Toolkit is installed under `/usr/local/cuda`, `libcupti.so` is located under `/usr/local/cuda/extras/CUPTI/lib64` and `LD_LIBRARY_PATH` should contain this path.
66
+
67
+ `libcudnn.so` is installed separately from the CUDA Toolkit. The default installation location is `/usr/local/cuda/lib64`, and `LD_LIBRARY_PATH` should contain this path.
68
+
69
+ Both `libcudnn.so` and `libcupti.so` are installable with pip:
70
+
71
+ ```
72
+ pip install nvidia-cudnn-cu12
73
+ pip install nvidia-cuda-cupti-cu12
74
+ ```
75
+
76
+ After installing cuDNN and cuPTI, the user may install `cuquantum-python-jax` using `pip` using either:
77
+
78
+ ```
79
+ pip install cuquantum-python-jax
80
+ ```
81
+
82
+ or
83
+
84
+ ```
85
+ pip install cuquantum-python-cu12[jax]
86
+ ```
87
+
88
+ Note: if cuDNN and cuPTI are installed with `pip`, the user does not need to specify library folders in `LD_LIBRARY_PATH`.
89
+
90
+ #### Installation using `jax[cuda12]`
91
+
92
+ Alternatively, the user may
93
+
94
+ ```
95
+ pip install jax[cuda12] # install cuPTI and cuDNN together with CUDA-enabled JAX
96
+ ```
97
+
98
+ and either
99
+
100
+ ```
101
+ pip install cuquantum-python-jax
102
+ ```
103
+
104
+ or
105
+
106
+ ```
107
+ pip install cuquantum-python-cu12[jax]
108
+ ```
109
+
110
+ Warning: if the user has an installation of CUDA outside of `pip`, this may create conflicts and undefined behavior.
111
+
112
+ #### Installing from source
113
+
114
+ To install cuQuantum Python JAX from source, first compile cuQuantum Python from source using the [instructions on GitHub](https://github.com/NVIDIA/cuQuantum/blob/main/python/README.md). Once complete, navigate to `python/extensions`, then:
115
+
116
+ ```
117
+ export CUDENSITYMAT_ROOT=...
118
+ pip install .
119
+ ```
120
+
121
+ Where `CUDENSITYMAT_ROOT` is the path to the libraries parent directory. For example, if `CUDENSITYMAT_ROOT=/usr/local`, `libcudensitymat.so` would be found under `/usr/local/lib` or `/usr/local/lib64`.
122
+
123
+ ## Running
124
+
125
+ ### Requirements
126
+
127
+ Runtime dependencies of the cuQuantum Python package include:
128
+
129
+ * An NVIDIA GPU with compute capability 7.5+
130
+ * cuquantum-python-cu12~=25.09
131
+ * jax[cuda12]>=0.5,<0.7 or jax[cuda12-local]>=0.5,<0.7
132
+ * pybind11
133
+
134
+ ## Developer Notes
135
+
136
+ * cuQuantum Python JAX does not support editable installation.
137
+ * Both cuQuantum Python and cuQuantum Python JAX need to be installed into `site-packages` for proper import of the library.
138
+ * cuQuantum Python JAX assumes cuQuantum Python will be available under the current `site-packages` directory.
@@ -0,0 +1,101 @@
1
+ # cuQuantum Python JAX
2
+
3
+ cuQuantum Python JAX provides a JAX extension for cuQuantum Python. It exposes selected functionality of cuQuantum SDK in a JAX-compatible way that enables JAX frameworks to directly interface with the exposed cuQuantum API. In the current release, cuQuantum JAX exposes a JAX interface to the Operator Action API from the cuDensityMat library.
4
+
5
+ ## Documentation
6
+
7
+ Please visit the [NVIDIA cuQuantum Python documentation](https://docs.nvidia.com/cuda/cuquantum/latest/python).
8
+
9
+ ## Building and installing cuQuantum Python JAX
10
+
11
+ ### Requirements
12
+
13
+ The install-time dependencies of the cuQuantum Python package include:
14
+
15
+ * cuquantum-python-cu12~=25.09
16
+ * setuptools>=77.0.3
17
+ * jax[cuda12]>=0.5,<0.7 or jax[cuda12-local]>=0.5,<0.7
18
+ * pybind11
19
+
20
+ Note: cuQuantum Python JAX is only supported with CUDA 12.
21
+
22
+ #### Installation using `jax[cuda12-local]`
23
+
24
+ `cuquantum-python-jax` depends explicitly on `jax[cuda12-local]`. `pip install cuquantum-python-jax` will install `jax[cuda12-local]`.
25
+
26
+ Using `jax[cuda12-local]` assumes the user provides both cuDNN and the CUDA Toolkit. cuDNN is not a part of the CUDA Toolkit and requires an additional installation. The user must also specify `LD_LIBRARY_PATH`, including the library folders containing `libcudnn.so` and `libcupti.so`.
27
+
28
+ `libcupti.so` is provided by the CUDA Toolkit. If the CUDA Toolkit is installed under `/usr/local/cuda`, `libcupti.so` is located under `/usr/local/cuda/extras/CUPTI/lib64` and `LD_LIBRARY_PATH` should contain this path.
29
+
30
+ `libcudnn.so` is installed separately from the CUDA Toolkit. The default installation location is `/usr/local/cuda/lib64`, and `LD_LIBRARY_PATH` should contain this path.
31
+
32
+ Both `libcudnn.so` and `libcupti.so` are installable with pip:
33
+
34
+ ```
35
+ pip install nvidia-cudnn-cu12
36
+ pip install nvidia-cuda-cupti-cu12
37
+ ```
38
+
39
+ After installing cuDNN and cuPTI, the user may install `cuquantum-python-jax` using `pip` using either:
40
+
41
+ ```
42
+ pip install cuquantum-python-jax
43
+ ```
44
+
45
+ or
46
+
47
+ ```
48
+ pip install cuquantum-python-cu12[jax]
49
+ ```
50
+
51
+ Note: if cuDNN and cuPTI are installed with `pip`, the user does not need to specify library folders in `LD_LIBRARY_PATH`.
52
+
53
+ #### Installation using `jax[cuda12]`
54
+
55
+ Alternatively, the user may
56
+
57
+ ```
58
+ pip install jax[cuda12] # install cuPTI and cuDNN together with CUDA-enabled JAX
59
+ ```
60
+
61
+ and either
62
+
63
+ ```
64
+ pip install cuquantum-python-jax
65
+ ```
66
+
67
+ or
68
+
69
+ ```
70
+ pip install cuquantum-python-cu12[jax]
71
+ ```
72
+
73
+ Warning: if the user has an installation of CUDA outside of `pip`, this may create conflicts and undefined behavior.
74
+
75
+ #### Installing from source
76
+
77
+ To install cuQuantum Python JAX from source, first compile cuQuantum Python from source using the [instructions on GitHub](https://github.com/NVIDIA/cuQuantum/blob/main/python/README.md). Once complete, navigate to `python/extensions`, then:
78
+
79
+ ```
80
+ export CUDENSITYMAT_ROOT=...
81
+ pip install .
82
+ ```
83
+
84
+ Where `CUDENSITYMAT_ROOT` is the path to the libraries parent directory. For example, if `CUDENSITYMAT_ROOT=/usr/local`, `libcudensitymat.so` would be found under `/usr/local/lib` or `/usr/local/lib64`.
85
+
86
+ ## Running
87
+
88
+ ### Requirements
89
+
90
+ Runtime dependencies of the cuQuantum Python package include:
91
+
92
+ * An NVIDIA GPU with compute capability 7.5+
93
+ * cuquantum-python-cu12~=25.09
94
+ * jax[cuda12]>=0.5,<0.7 or jax[cuda12-local]>=0.5,<0.7
95
+ * pybind11
96
+
97
+ ## Developer Notes
98
+
99
+ * cuQuantum Python JAX does not support editable installation.
100
+ * Both cuQuantum Python and cuQuantum Python JAX need to be installed into `site-packages` for proper import of the library.
101
+ * cuQuantum Python JAX assumes cuQuantum Python will be available under the current `site-packages` directory.
@@ -0,0 +1,11 @@
1
+ # Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES
2
+ #
3
+ # SPDX-License-Identifier: BSD-3-Clause
4
+
5
+ from .operator_action import operator_action
6
+ from .pysrc.operators import (
7
+ ElementaryOperator,
8
+ MatrixOperator,
9
+ OperatorTerm,
10
+ Operator
11
+ )
@@ -0,0 +1,93 @@
1
+ # Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES
2
+ #
3
+ # SPDX-License-Identifier: BSD-3-Clause
4
+
5
+ cmake_minimum_required(VERSION 3.22)
6
+ project(cudensitymat_jax LANGUAGES CXX)
7
+
8
+ set(CMAKE_CXX_STANDARD 17)
9
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
10
+
11
+ find_package(Python3 REQUIRED REQUIRED COMPONENTS Interpreter Development)
12
+ message(STATUS "Python executable: ${Python3_EXECUTABLE}")
13
+
14
+ find_package(CUDAToolkit REQUIRED)
15
+ message(STATUS "CUDA toolkit directory: ${CUDAToolkit_INCLUDE_DIRS}")
16
+
17
+ # Find XLA directory
18
+ execute_process(
19
+ COMMAND ${Python3_EXECUTABLE} -c "import jax; print(jax.ffi.include_dir())"
20
+ OUTPUT_STRIP_TRAILING_WHITESPACE
21
+ OUTPUT_VARIABLE XLA_DIR
22
+ )
23
+ if(NOT XLA_DIR)
24
+ message(FATAL_ERROR "XLA directory not found")
25
+ else()
26
+ message(STATUS "XLA directory: ${XLA_DIR}")
27
+ endif()
28
+
29
+ # Find pybind11 directory
30
+ execute_process(
31
+ COMMAND ${Python3_EXECUTABLE} -c "import pybind11; print(pybind11.get_include())"
32
+ OUTPUT_STRIP_TRAILING_WHITESPACE
33
+ OUTPUT_VARIABLE pybind11_INCLUDE_DIR
34
+ )
35
+ if(NOT pybind11_INCLUDE_DIR)
36
+ message(FATAL_ERROR "Pybind11 include directory not found")
37
+ else()
38
+ message(STATUS "Pybind11 include directory: ${pybind11_INCLUDE_DIR}")
39
+ endif()
40
+
41
+ set(pybind11_DIR ${pybind11_INCLUDE_DIR}/../share/cmake/pybind11)
42
+ find_package(pybind11 REQUIRED)
43
+
44
+ # FIXME: This should be made more robust and moved to setup.py.
45
+ execute_process(
46
+ COMMAND ${Python3_EXECUTABLE} -c "import site; print(f'{site.getsitepackages()[0]}/cuquantum')"
47
+ OUTPUT_STRIP_TRAILING_WHITESPACE
48
+ OUTPUT_VARIABLE CUQUANTUM_PYTHON_ROOT
49
+ )
50
+
51
+ if(DEFINED ENV{CUDENSITYMAT_ROOT})
52
+ set(CUDENSITYMAT_ROOT $ENV{CUDENSITYMAT_ROOT})
53
+ else()
54
+ set(CUDENSITYMAT_ROOT ${CUQUANTUM_PYTHON_ROOT})
55
+ endif()
56
+
57
+ message(STATUS "cuQuantum Python directory: ${CUQUANTUM_PYTHON_ROOT}")
58
+ message(STATUS "cuDensityMat directory: ${CUDENSITYMAT_ROOT}")
59
+
60
+ pybind11_add_module(
61
+ ${PROJECT_NAME}
62
+ cudensitymat_jax.cpp
63
+ pybind.cpp
64
+ )
65
+ target_include_directories(
66
+ ${PROJECT_NAME}
67
+ PUBLIC
68
+ ${CUDAToolkit_INCLUDE_DIRS}
69
+ ${XLA_DIR}
70
+ ${pybind11_INCLUDE_DIR}
71
+ ${CUDENSITYMAT_ROOT}/include
72
+ )
73
+
74
+ find_library(
75
+ CUDENSITYMAT_LIBRARY
76
+ NAMES libcudensitymat.so
77
+ libcudensitymat.so.0
78
+ HINTS ${CUDENSITYMAT_ROOT}/lib64
79
+ ${CUDENSITYMAT_ROOT}/lib
80
+ )
81
+
82
+ if(NOT CUDENSITYMAT_LIBRARY)
83
+ message(FATAL_ERROR "cuDensityMat library not found")
84
+ else()
85
+ message(STATUS "cuDensityMat library: ${CUDENSITYMAT_LIBRARY}")
86
+ endif()
87
+
88
+ target_link_libraries(
89
+ ${PROJECT_NAME}
90
+ PRIVATE
91
+ CUDA::cudart_static
92
+ ${CUDENSITYMAT_LIBRARY}
93
+ )