Skip to content

Commit 79113af

Browse files
committed
Merge branch 'GA_release' into 'main'
Prepare for public GA release See merge request cuda-hpc-libraries/cuquantum-sdk/cuquantum-public!4
2 parents 38dae54 + ae37147 commit 79113af

Some content is hidden

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

76 files changed

+5483
-1071
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD-3-Clause
22

3-
Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
44

55
Redistribution and use in source and binary forms, with or without
66
modification, are permitted provided that the following conditions are met:

python/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
__pycache__
2+
*.egg-info
3+
*.eggs
4+
*.cpp
5+
*.so

python/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD-3-Clause
22

3-
Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
44

55
Redistribution and use in source and binary forms, with or without
66
modification, are permitted provided that the following conditions are met:

python/README.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ Please visit the [NVIDIA cuQuantum Python documentation](https://docs.nvidia.com
1111
Build-time dependencies of the cuQuantum Python package and some versions that
1212
are known to work are as follows:
1313

14-
* CUDA Toolkit 11.4+
15-
* cuQuantum 0.1.0
16-
* cuTENSOR 1.4.0+
14+
* CUDA Toolkit 11.x
15+
* cuQuantum 22.03
16+
* cuTENSOR 1.5.0+
1717
* Cython - e.g. 0.29.21
18+
* [packaging](https://packaging.pypa.io/en/latest/)
1819

1920
### Install cuQuantum Python from conda-forge
2021

@@ -24,6 +25,18 @@ conda install -c conda-forge cuquantum-python
2425
```
2526
The Conda solver will install all required dependencies for you.
2627

28+
### Install cuQuantum Python from PyPI
29+
30+
Alternatively, assuming you already have a Python environment set up (it doesn't matter if it's a Conda env or not),
31+
you can also install cuQuantum Python this way:
32+
33+
```
34+
pip install cuquantum-python
35+
```
36+
The `pip` solver will also install both cuTENSOR and cuQuantum for you.
37+
38+
Note: To properly install the wheels the environment variable `CUQUANTUM_ROOT` must not be set.
39+
2740
### Install cuQuantum Python from source
2841

2942
To compile and install cuQuantum Python from source, please follow the steps below:
@@ -48,9 +61,9 @@ Runtime dependencies of the cuQuantum Python package include:
4861

4962
* An NVIDIA GPU with compute capability 7.0+
5063
* Driver: Linux (450.80.02+)
51-
* CUDA Toolkit 11.4+
52-
* cuQuantum 0.1.0
53-
* cuTENSOR 1.4.0+
64+
* CUDA Toolkit 11.x
65+
* cuQuantum 22.03
66+
* cuTENSOR 1.5.0+
5467
* NumPy v1.17+
5568
* CuPy v9.5.0+
5669
* PyTorch v1.10+ (optional)
@@ -77,4 +90,5 @@ library in Python.
7790
## Testing
7891

7992
If pytest is installed, run `pytest tests` in the Python source root directory would
80-
run all tests.
93+
run all tests. Some tests would be skipped if `cffi` is not installed or if the environment
94+
variable `CUDA_PATH` is not set.

python/cuquantum/__init__.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from cuquantum import custatevec
22
from cuquantum import cutensornet
33
from cuquantum.cutensornet import (
4-
contract, contract_path, einsum, einsum_path, Network,
4+
contract, contract_path, einsum, einsum_path, Network, BaseCUDAMemoryManager, MemoryPointer,
55
NetworkOptions, OptimizerInfo, OptimizerOptions, PathFinderOptions, ReconfigOptions, SlicerOptions)
66
from cuquantum.utils import ComputeType, cudaDataType, libraryPropertyType
77
from cuquantum._version import __version__
@@ -17,14 +17,11 @@
1717
cutensornet.ContractionOptimizerInfoAttribute,
1818
cutensornet.ContractionOptimizerConfigAttribute,
1919
cutensornet.ContractionAutotunePreferenceAttribute,
20+
cutensornet.WorksizePref,
21+
cutensornet.Memspace,
22+
cutensornet.GraphAlgo,
23+
cutensornet.MemoryModel,
2024
):
2125
cutensornet._internal.enum_utils.add_enum_class_doc(enum, chomp="_ATTRIBUTE|_PREFERENCE_ATTRIBUTE")
22-
# these have yet another convention...
23-
for v in cutensornet.GraphAlgorithm:
24-
v.__doc__ = f"See `CUTENSORNET_CONTRACTION_OPTIMIZER_CONFIG_GRAPH_ALGORITHM_{v.name}`."
25-
cutensornet.MemoryModel.SLICER_HEURISTIC.__doc__ = \
26-
f"See `CUTENSORNET_CONTRACTION_OPTIMIZER_CONFIG_SLICER_MEMORY_MODEL_HEURISTIC`."
27-
cutensornet.MemoryModel.SLICER_CUTENSOR.__doc__ = \
28-
f"See `CUTENSORNET_CONTRACTION_OPTIMIZER_CONFIG_SLICER_MEMORY_MODEL_CUTENSOR`."
2926

30-
del enum, utils, v
27+
del enum, utils

python/cuquantum/_version.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
# TODO: find a better approach to sync the version string with the C libs
2-
__version__ = '.'.join(['0.1.0', '1']) # the last digit is for cuQuantum Python only
1+
# Note: cuQuantum Python follows the cuQuantum SDK version, which is now
2+
# switched to YY.MM and is different from individual libraries' (semantic)
3+
# versioning scheme.
4+
__version__ = '22.03.0' # the last digit is for cuQuantum Python only

python/cuquantum/custatevec/custatevec.pxd

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,42 @@
33

44
from libc.stdint cimport intptr_t, int32_t, uint32_t, int64_t
55

6+
from cuquantum.utils cimport Stream
7+
68

79
# The C types are prefixed with an underscore because we are not
810
# yet protected by the module namespaces as done in CUDA Python.
911
# Once we switch over the names would be prettier (in the Cython
1012
# layer).
1113

14+
15+
# Cython limitation: need standalone typedef if we wanna use it for casting
16+
ctypedef int (*DeviceAllocType)(void*, void**, size_t, Stream)
17+
ctypedef int (*DeviceFreeType)(void*, void*, size_t, Stream)
18+
19+
1220
cdef extern from '<custatevec.h>' nogil:
1321
# cuStateVec types
1422
ctypedef void* _Handle 'custatevecHandle_t'
1523
ctypedef int64_t _Index 'custatevecIndex_t'
1624
ctypedef int _Status 'custatevecStatus_t'
17-
ctypedef struct _SamplerDescriptor 'custatevecSamplerDescriptor_t':
18-
pass
19-
ctypedef struct _AccessorDescriptor 'custatevecAccessorDescriptor':
20-
pass
25+
ctypedef void* _SamplerDescriptor 'custatevecSamplerDescriptor_t'
26+
ctypedef void* _AccessorDescriptor 'custatevecAccessorDescriptor_t'
2127
ctypedef enum _ComputeType 'custatevecComputeType_t':
2228
pass
23-
# ctypedef void(*custatevecLoggerCallback_t)(
24-
# int32_t logLevel,
25-
# const char* functionName,
26-
# const char* message)
27-
# ctypedef custatevecLoggerCallback_t LoggerCallback
29+
ctypedef struct _DeviceMemHandler 'custatevecDeviceMemHandler_t':
30+
void* ctx
31+
DeviceAllocType device_alloc
32+
DeviceFreeType device_free
33+
34+
# Cython limitation: cannot use C defines in declaring a static array,
35+
# so we just have to hard-code CUSTATEVEC_ALLOCATOR_NAME_LEN here...
36+
char name[64]
37+
ctypedef void(*LoggerCallbackData 'custatevecLoggerCallbackData_t')(
38+
int32_t logLevel,
39+
const char* functionName,
40+
const char* message,
41+
void* userData)
2842

2943
# cuStateVec enums
3044
ctypedef enum _Pauli 'custatevecPauli_t':
@@ -55,3 +69,4 @@ cdef extern from '<custatevec.h>' nogil:
5569
int CUSTATEVEC_VER_MINOR
5670
int CUSTATEVEC_VER_PATCH
5771
int CUSTATEVEC_VERSION
72+
int CUSTATEVEC_ALLOCATOR_NAME_LEN

0 commit comments

Comments
 (0)