Skip to content

Commit 8ddf23a

Browse files
author
Daniel Lowell
committed
Public update of release version 25.06 to github
1 parent 9c05ce7 commit 8ddf23a

93 files changed

Lines changed: 5772 additions & 3793 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

python/README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@ For instructions on installing *cuQuantum Python*, refer to our
1414
The build-time dependencies of the cuQuantum Python package include:
1515

1616
* CUDA Toolkit 11.x or 12.x
17-
* cuStateVec 1.8.0+
18-
* cuTensorNet 2.7.0+
19-
* cuDensityMat >=0.1.0
20-
* Python 3.10+
21-
* Cython >=0.29.22,<3
17+
* Python >=3.11, <3.14
18+
* Cython >=0.29.22
2219
* pip 21.3.1+
2320
* [packaging](https://packaging.pypa.io/en/latest/)
2421
* setuptools 61.0.0+
2522
* wheel 0.34.0+
2623

24+
> **Note:** Starting with cuQuantum Python v25.06, cuQuantum C libraries including cuDensityMat, cuStateVec and cuTensorNet are no longer build-time dependencies. However, they are still required at runtime.
25+
2726
Except for CUDA and Python, the rest of the build-time dependencies are handled by the new PEP-517-based build system (see Step 7 below).
2827

2928
To compile and install cuQuantum Python from source, please follow the steps below:
@@ -56,14 +55,14 @@ Runtime dependencies of the cuQuantum Python package include:
5655
* An NVIDIA GPU with compute capability 7.0+
5756
* Driver: Linux (450.80.02+ for CUDA 11, 525.60.13+ for CUDA 12)
5857
* CUDA Toolkit 11.x or 12.x
59-
* cuStateVec 1.8.0+
60-
* cuTensorNet 2.6.0+
61-
* cuDensityMat >=0.0.5, <0.1.0
62-
* Python 3.10+
58+
* cuStateVec 1.9.0+
59+
* cuTensorNet 2.8.0+
60+
* cuDensityMat >=0.2.0, <0.3.0
61+
* Python >=3.11, <3.14
6362
* NumPy v1.21+
6463
* CuPy v13.0.0+ (see [installation guide](https://docs.cupy.dev/en/stable/install.html))
6564
* PyTorch v1.10+ (optional, see [installation guide](https://pytorch.org/get-started/locally/))
66-
* Qiskit v0.24.0+ (optional, see [installation guide](https://qiskit.org/documentation/getting_started.html))
65+
* Qiskit v1.4.2+ (optional, see [installation guide](https://qiskit.org/documentation/getting_started.html))
6766
* Cirq v0.6.0+ (optional, see [installation guide](https://quantumai.google/cirq/install))
6867
* mpi4py v3.1.0+ (optional, see [installation guide](https://mpi4py.readthedocs.io/en/stable/install.html))
6968

@@ -77,7 +76,6 @@ to your `LD_LIBRARY_PATH` environment variable, and that a compatible CuPy is in
7776

7877
Known issues:
7978
- 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!
80-
- 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`.
8179
- Please ensure that you use consistent binaries and packages for either CUDA 11 or 12. Mixing-and-matching will result in undefined behavior.
8280

8381
### Samples

python/builder/pep517.py

Lines changed: 0 additions & 45 deletions
This file was deleted.

python/cuquantum/__main__.py

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
import os
77
import site
88
import sys
9+
import logging
910

11+
logger = logging.getLogger(__name__)
1012

1113
def get_lib_path(name):
1214
"""Get the loaded shared library path."""
@@ -54,11 +56,21 @@ def get_lib_path(name):
5456
return lib.pop()
5557

5658

59+
def _get_cuquantum_lib(lib):
60+
try:
61+
path = os.path.normpath(get_lib_path(f"lib{lib}.so"))
62+
return path
63+
except Exception as e:
64+
logger.warning(f"library {lib} not found: {e}")
65+
return None
66+
67+
5768
def _get_cuquantum_libs():
5869
paths = set()
5970
for lib in ('custatevec', 'cutensornet', 'cutensor', 'cudensitymat'):
60-
path = os.path.normpath(get_lib_path(f"lib{lib}.so"))
61-
paths.add(path)
71+
path = _get_cuquantum_lib(lib)
72+
if path is not None:
73+
paths.add(path)
6274
return tuple(paths)
6375

6476

@@ -70,21 +82,20 @@ def _get_cuquantum_includes():
7082
path = os.path.normpath(os.path.join(path, '../include'))
7183
else:
7284
path = os.path.join(path, 'include')
73-
assert os.path.isdir(path), f"path={path} is invalid"
74-
paths.add(path)
85+
86+
if os.path.isdir(path):
87+
paths.add(path)
7588
return tuple(paths)
7689

7790

7891
def _get_cuquantum_target(target):
79-
target = f"lib{target}.so"
80-
libs = [os.path.basename(lib) for lib in _get_cuquantum_libs()]
81-
for lib in libs:
82-
if target in lib:
83-
lib = '.'.join(lib.split('.')[:3]) # keep SONAME
84-
flag = f"-l:{lib} "
85-
break
86-
else:
87-
assert False
92+
path = _get_cuquantum_lib(target)
93+
if path is None:
94+
# Return error as the target library was explicitly asked but not found
95+
raise RuntimeError(f"library {target} not found")
96+
lib = os.path.basename(path)
97+
lib = '.'.join(lib.split('.')[:3]) # keep SONAME
98+
flag = f"-l:{lib} "
8899
return flag
89100

90101

python/cuquantum/_internal/tensor_wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import torch
2828
from .tensor_ifc_torch import TorchTensor
2929
_TENSOR_TYPES['torch'] = TorchTensor
30-
torch_asarray = functools.partial(torch.as_tensor, device='cuda')
30+
torch_asarray = functools.partial(torch.tensor, device='cuda')
3131
except ImportError as e:
3232
torch = None
3333
torch_asarray = None

python/cuquantum/_internal/utils.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -492,21 +492,21 @@ def get_mpi_comm_pointer(comm):
492492
mpi_comm_size = MPI._sizeof(MPI.Comm)
493493
return comm_ptr, mpi_comm_size
494494

495-
def deprecate_function(my_func, message):
495+
def deprecate_function(my_func, message, deprecation_class):
496496
def add_deprecation_warning(message):
497497
def decorator(func):
498498
@functools.wraps(func)
499499
def wrapper(*args, **kwargs):
500-
warnings.warn(message, DeprecationWarning, stacklevel=2)
500+
warnings.warn(message, deprecation_class, stacklevel=2)
501501
return func(*args, **kwargs)
502502
return wrapper
503503
return decorator
504504
return add_deprecation_warning(message)(my_func)
505505

506-
def deprecate_class(cls, message):
506+
def deprecate_class(cls, message, deprecation_class):
507507
class DeprecatedClass(cls):
508508
def __new__(cls, *args, **kwargs):
509-
warnings.warn(message, DeprecationWarning, stacklevel=2)
509+
warnings.warn(message, deprecation_class, stacklevel=2)
510510
return super(DeprecatedClass, cls).__new__(cls)
511511

512512
def __init__(self, *args, **kwargs):
@@ -516,10 +516,10 @@ def __init__(self, *args, **kwargs):
516516
DeprecatedClass.__doc__ = cls.__doc__
517517
return DeprecatedClass
518518

519-
def deprecate(api, message):
519+
def deprecate(api, message, deprecation_class):
520520
if inspect.isfunction(api):
521-
return deprecate_function(api, message)
521+
return deprecate_function(api, message, deprecation_class)
522522
elif inspect.isclass(api):
523-
return deprecate_class(api, message)
523+
return deprecate_class(api, message, deprecation_class)
524524
else:
525525
raise ValueError(f'API type {type(api)} not supported')

python/cuquantum/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
# Note: cuQuantum Python follows the cuQuantum SDK version, which is now
66
# switched to YY.MM and is different from individual libraries' (semantic)
77
# versioning scheme.
8-
__version__ = '25.03.0'
8+
__version__ = '25.06.0'
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES
1+
# Copyright (c) 2024-2025, NVIDIA CORPORATION & AFFILIATES
22
#
33
# SPDX-License-Identifier: BSD-3-Clause
44

5-
from cuquantum.bindings import cudensitymat
5+
from cuquantum.bindings import cudensitymat
6+
from cuquantum.bindings import custatevec
7+
from cuquantum.bindings import cutensornet
8+
9+
__all__ = [
10+
"cudensitymat",
11+
"custatevec",
12+
"cutensornet",
13+
]

0 commit comments

Comments
 (0)