Skip to content

Commit

Permalink
Merge branch 'release-v24.08' into 'main'
Browse files Browse the repository at this point in the history
Release v24.08

See merge request cuda-hpc-libraries/cuquantum-sdk/cuquantum-public!28
  • Loading branch information
mtjrider committed Aug 7, 2024
2 parents 788c048 + af5ac75 commit db47013
Show file tree
Hide file tree
Showing 94 changed files with 4,466 additions and 373 deletions.
12 changes: 6 additions & 6 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Please visit the [NVIDIA cuQuantum Python documentation](https://docs.nvidia.com/cuda/cuquantum/latest/python).

For instructions on installing *cuQuantum Python*, refer to our
[getting started section](../getting_started/getting_started.rst)
[getting started section](../getting-started/index.rst)

## Building and installing cuQuantum Python from source

Expand All @@ -15,8 +15,8 @@ The build-time dependencies of the cuQuantum Python package include:

* CUDA Toolkit 11.x or 12.x
* cuStateVec 1.4.0+
* cuTensorNet 2.4.0+
* Python 3.9+
* cuTensorNet 2.5.0+
* Python 3.10+
* Cython >=0.29.22,<3
* pip 21.3.1+
* [packaging](https://packaging.pypa.io/en/latest/)
Expand Down Expand Up @@ -57,8 +57,8 @@ Runtime dependencies of the cuQuantum Python package include:
* Driver: Linux (450.80.02+ for CUDA 11, 525.60.13+ for CUDA 12)
* CUDA Toolkit 11.x or 12.x
* cuStateVec 1.4.0+
* cuTensorNet 2.4.0+
* Python 3.9+
* cuTensorNet 2.5.0+
* Python 3.10+
* NumPy v1.21+
* CuPy v13.0.0+ (see [installation guide](https://docs.cupy.dev/en/stable/install.html))
* PyTorch v1.10+ (optional, see [installation guide](https://pytorch.org/get-started/locally/))
Expand Down Expand Up @@ -96,4 +96,4 @@ variable `CUDA_PATH` is not set.

## Citing cuQuantum

Pleae click this Zenodo badge to see the citation format: [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.6385574.svg)](https://doi.org/10.5281/zenodo.6385574)
Please click this Zenodo badge to see the citation format: [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.6385574.svg)](https://doi.org/10.5281/zenodo.6385574)
2 changes: 1 addition & 1 deletion python/builder/pep517.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def get_requires_for_build_wheel(config_settings=None):
# 22.3 by setuptools, so we must follow the same practice in the constraints;
# also, we don't need the patch number here
cuqnt_require = [f'custatevec-cu{utils.cuda_major_ver}~=1.6', # ">=1.6.0,<2"
f'cutensornet-cu{utils.cuda_major_ver}~=2.4', # ">=2.4.0,<3"
f'cutensornet-cu{utils.cuda_major_ver}~=2.5', # ">=2.5.0,<3"
]

return _build_meta.get_requires_for_build_wheel(config_settings) + cuqnt_require
Expand Down
5 changes: 3 additions & 2 deletions python/cuquantum/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
from cuquantum import custatevec
from cuquantum import cutensornet
from cuquantum.cutensornet import (
contract, contract_path, einsum, einsum_path, tensor, tensor_qualifiers_dtype, Network, BaseCUDAMemoryManager, MemoryPointer,
NetworkOptions, OptimizerInfo, OptimizerOptions, PathFinderOptions, ReconfigOptions, SlicerOptions, CircuitToEinsum)
contract, contract_path, einsum, einsum_path, tensor, tensor_qualifiers_dtype, BaseCUDAMemoryManager, CircuitToEinsum, MemoryPointer,
Network, NetworkOptions, OptimizerInfo, OptimizerOptions, PathFinderOptions,
ReconfigOptions, SlicerOptions)
from cuquantum._utils import ComputeType, cudaDataType, libraryPropertyType
from cuquantum._version import __version__

Expand Down
1 change: 1 addition & 0 deletions python/cuquantum/_utils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class ComputeType(IntEnum):
COMPUTE_32I = 1 << 9
COMPUTE_16BF = 1 << 10
COMPUTE_TF32 = 1 << 12
COMPUTE_3XTF32 = 1 << 13


# TODO: use those exposed by CUDA Python instead, but before removing these
Expand Down
2 changes: 1 addition & 1 deletion python/cuquantum/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# Note: cuQuantum Python follows the cuQuantum SDK version, which is now
# switched to YY.MM and is different from individual libraries' (semantic)
# versioning scheme.
__version__ = '24.03.0'
__version__ = '24.08.0'
4 changes: 2 additions & 2 deletions python/cuquantum/custatevec/_internal/custatevec.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ cdef custatevecStatus_t _custatevecAbs2SumArrayBatched(custatevecHandle_t handle
cdef custatevecStatus_t _custatevecCollapseByBitStringBatchedGetWorkspaceSize(custatevecHandle_t handle, const uint32_t nSVs, const custatevecIndex_t* bitStrings, const double* norms, size_t* extraWorkspaceSizeInBytes) except* nogil
cdef custatevecStatus_t _custatevecCollapseByBitStringBatched(custatevecHandle_t handle, void* batchedSv, cudaDataType_t svDataType, const uint32_t nIndexBits, const uint32_t nSVs, const custatevecIndex_t svStride, const custatevecIndex_t* bitStrings, const int32_t* bitOrdering, const uint32_t bitStringLen, const double* norms, void* extraWorkspace, size_t extraWorkspaceSizeInBytes) except* nogil
cdef custatevecStatus_t _custatevecMeasureBatched(custatevecHandle_t handle, void* batchedSv, cudaDataType_t svDataType, const uint32_t nIndexBits, const uint32_t nSVs, const custatevecIndex_t svStride, custatevecIndex_t* bitStrings, const int32_t* bitOrdering, const uint32_t bitStringLen, const double* randnums, custatevecCollapseOp_t collapse) except* nogil
cdef custatevecStatus_t _custatevecComputeExpectationBatchedGetWorkspaceSize(custatevecHandle_t handle, cudaDataType_t svDataType, const uint32_t nIndexBits, const uint32_t nSVs, const custatevecIndex_t svStride, const void* matrices, cudaDataType_t matrixDataType, custatevecMatrixLayout_t layout, const uint32_t nMatrices, const uint32_t nBasisBits, custatevecComputeType_t computeType, size_t* extraWorkspaceSizeInBytes) except* nogil
cdef custatevecStatus_t _custatevecComputeExpectationBatched(custatevecHandle_t handle, const void* batchedSv, cudaDataType_t svDataType, const uint32_t nIndexBits, const uint32_t nSVs, custatevecIndex_t svStride, double2* expectationValues, const void* matrices, cudaDataType_t matrixDataType, custatevecMatrixLayout_t layout, const uint32_t nMatrices, const int32_t* basisBits, const uint32_t nBasisBits, custatevecComputeType_t computeType, void* extraWorkspace, size_t extraWorkspaceSizeInBytes) except* nogil
cdef custatevecStatus_t _custatevecSubSVMigratorCreate(custatevecHandle_t handle, custatevecSubSVMigratorDescriptor_t* migrator, void* deviceSlots, cudaDataType_t svDataType, int nDeviceSlots, int nLocalIndexBits) except* nogil
cdef custatevecStatus_t _custatevecSubSVMigratorDestroy(custatevecHandle_t handle, custatevecSubSVMigratorDescriptor_t migrator) except* nogil
cdef custatevecStatus_t _custatevecSubSVMigratorMigrate(custatevecHandle_t handle, custatevecSubSVMigratorDescriptor_t migrator, int deviceSlotIndex, const void* srcSubSV, void* dstSubSV, custatevecIndex_t begin, custatevecIndex_t end) except* nogil
cdef custatevecStatus_t _custatevecComputeExpectationBatchedGetWorkspaceSize(custatevecHandle_t handle, cudaDataType_t svDataType, const uint32_t nIndexBits, const uint32_t nSVs, const custatevecIndex_t svStride, const void* matrices, cudaDataType_t matrixDataType, custatevecMatrixLayout_t layout, const uint32_t nMatrices, const uint32_t nBasisBits, custatevecComputeType_t computeType, size_t* extraWorkspaceSizeInBytes) except* nogil
cdef custatevecStatus_t _custatevecComputeExpectationBatched(custatevecHandle_t handle, const void* batchedSv, cudaDataType_t svDataType, const uint32_t nIndexBits, const uint32_t nSVs, custatevecIndex_t svStride, double2* expectationValues, const void* matrices, cudaDataType_t matrixDataType, custatevecMatrixLayout_t layout, const uint32_t nMatrices, const int32_t* basisBits, const uint32_t nBasisBits, custatevecComputeType_t computeType, void* extraWorkspace, size_t extraWorkspaceSizeInBytes) except* nogil
84 changes: 42 additions & 42 deletions python/cuquantum/custatevec/_internal/custatevec_linux.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ cdef void* __custatevecAbs2SumArrayBatched = NULL
cdef void* __custatevecCollapseByBitStringBatchedGetWorkspaceSize = NULL
cdef void* __custatevecCollapseByBitStringBatched = NULL
cdef void* __custatevecMeasureBatched = NULL
cdef void* __custatevecComputeExpectationBatchedGetWorkspaceSize = NULL
cdef void* __custatevecComputeExpectationBatched = NULL
cdef void* __custatevecSubSVMigratorCreate = NULL
cdef void* __custatevecSubSVMigratorDestroy = NULL
cdef void* __custatevecSubSVMigratorMigrate = NULL
cdef void* __custatevecComputeExpectationBatchedGetWorkspaceSize = NULL
cdef void* __custatevecComputeExpectationBatched = NULL


cdef void* load_library() except* nogil:
Expand Down Expand Up @@ -602,20 +602,6 @@ cdef int _check_or_init_custatevec() except -1 nogil:
handle = load_library()
__custatevecMeasureBatched = dlsym(handle, 'custatevecMeasureBatched')

global __custatevecComputeExpectationBatchedGetWorkspaceSize
__custatevecComputeExpectationBatchedGetWorkspaceSize = dlsym(RTLD_DEFAULT, 'custatevecComputeExpectationBatchedGetWorkspaceSize')
if __custatevecComputeExpectationBatchedGetWorkspaceSize == NULL:
if handle == NULL:
handle = load_library()
__custatevecComputeExpectationBatchedGetWorkspaceSize = dlsym(handle, 'custatevecComputeExpectationBatchedGetWorkspaceSize')

global __custatevecComputeExpectationBatched
__custatevecComputeExpectationBatched = dlsym(RTLD_DEFAULT, 'custatevecComputeExpectationBatched')
if __custatevecComputeExpectationBatched == NULL:
if handle == NULL:
handle = load_library()
__custatevecComputeExpectationBatched = dlsym(handle, 'custatevecComputeExpectationBatched')

global __custatevecSubSVMigratorCreate
__custatevecSubSVMigratorCreate = dlsym(RTLD_DEFAULT, 'custatevecSubSVMigratorCreate')
if __custatevecSubSVMigratorCreate == NULL:
Expand All @@ -636,6 +622,20 @@ cdef int _check_or_init_custatevec() except -1 nogil:
if handle == NULL:
handle = load_library()
__custatevecSubSVMigratorMigrate = dlsym(handle, 'custatevecSubSVMigratorMigrate')

global __custatevecComputeExpectationBatchedGetWorkspaceSize
__custatevecComputeExpectationBatchedGetWorkspaceSize = dlsym(RTLD_DEFAULT, 'custatevecComputeExpectationBatchedGetWorkspaceSize')
if __custatevecComputeExpectationBatchedGetWorkspaceSize == NULL:
if handle == NULL:
handle = load_library()
__custatevecComputeExpectationBatchedGetWorkspaceSize = dlsym(handle, 'custatevecComputeExpectationBatchedGetWorkspaceSize')

global __custatevecComputeExpectationBatched
__custatevecComputeExpectationBatched = dlsym(RTLD_DEFAULT, 'custatevecComputeExpectationBatched')
if __custatevecComputeExpectationBatched == NULL:
if handle == NULL:
handle = load_library()
__custatevecComputeExpectationBatched = dlsym(handle, 'custatevecComputeExpectationBatched')

__py_custatevec_init = True
return 0
Expand Down Expand Up @@ -849,12 +849,6 @@ cpdef dict _inspect_function_pointers():
global __custatevecMeasureBatched
data["__custatevecMeasureBatched"] = <intptr_t>__custatevecMeasureBatched

global __custatevecComputeExpectationBatchedGetWorkspaceSize
data["__custatevecComputeExpectationBatchedGetWorkspaceSize"] = <intptr_t>__custatevecComputeExpectationBatchedGetWorkspaceSize

global __custatevecComputeExpectationBatched
data["__custatevecComputeExpectationBatched"] = <intptr_t>__custatevecComputeExpectationBatched

global __custatevecSubSVMigratorCreate
data["__custatevecSubSVMigratorCreate"] = <intptr_t>__custatevecSubSVMigratorCreate

Expand All @@ -863,6 +857,12 @@ cpdef dict _inspect_function_pointers():

global __custatevecSubSVMigratorMigrate
data["__custatevecSubSVMigratorMigrate"] = <intptr_t>__custatevecSubSVMigratorMigrate

global __custatevecComputeExpectationBatchedGetWorkspaceSize
data["__custatevecComputeExpectationBatchedGetWorkspaceSize"] = <intptr_t>__custatevecComputeExpectationBatchedGetWorkspaceSize

global __custatevecComputeExpectationBatched
data["__custatevecComputeExpectationBatched"] = <intptr_t>__custatevecComputeExpectationBatched

return data

Expand Down Expand Up @@ -1551,26 +1551,6 @@ cdef custatevecStatus_t _custatevecMeasureBatched(custatevecHandle_t handle, voi
handle, batchedSv, svDataType, nIndexBits, nSVs, svStride, bitStrings, bitOrdering, bitStringLen, randnums, collapse)


cdef custatevecStatus_t _custatevecComputeExpectationBatchedGetWorkspaceSize(custatevecHandle_t handle, cudaDataType_t svDataType, const uint32_t nIndexBits, const uint32_t nSVs, const custatevecIndex_t svStride, const void* matrices, cudaDataType_t matrixDataType, custatevecMatrixLayout_t layout, const uint32_t nMatrices, const uint32_t nBasisBits, custatevecComputeType_t computeType, size_t* extraWorkspaceSizeInBytes) except* nogil:
global __custatevecComputeExpectationBatchedGetWorkspaceSize
_check_or_init_custatevec()
if __custatevecComputeExpectationBatchedGetWorkspaceSize == NULL:
with gil:
raise FunctionNotFoundError("function custatevecComputeExpectationBatchedGetWorkspaceSize is not found")
return (<custatevecStatus_t (*)(custatevecHandle_t, cudaDataType_t, const uint32_t, const uint32_t, const custatevecIndex_t, const void*, cudaDataType_t, custatevecMatrixLayout_t, const uint32_t, const uint32_t, custatevecComputeType_t, size_t*) nogil>__custatevecComputeExpectationBatchedGetWorkspaceSize)(
handle, svDataType, nIndexBits, nSVs, svStride, matrices, matrixDataType, layout, nMatrices, nBasisBits, computeType, extraWorkspaceSizeInBytes)


cdef custatevecStatus_t _custatevecComputeExpectationBatched(custatevecHandle_t handle, const void* batchedSv, cudaDataType_t svDataType, const uint32_t nIndexBits, const uint32_t nSVs, custatevecIndex_t svStride, double2* expectationValues, const void* matrices, cudaDataType_t matrixDataType, custatevecMatrixLayout_t layout, const uint32_t nMatrices, const int32_t* basisBits, const uint32_t nBasisBits, custatevecComputeType_t computeType, void* extraWorkspace, size_t extraWorkspaceSizeInBytes) except* nogil:
global __custatevecComputeExpectationBatched
_check_or_init_custatevec()
if __custatevecComputeExpectationBatched == NULL:
with gil:
raise FunctionNotFoundError("function custatevecComputeExpectationBatched is not found")
return (<custatevecStatus_t (*)(custatevecHandle_t, const void*, cudaDataType_t, const uint32_t, const uint32_t, custatevecIndex_t, double2*, const void*, cudaDataType_t, custatevecMatrixLayout_t, const uint32_t, const int32_t*, const uint32_t, custatevecComputeType_t, void*, size_t) nogil>__custatevecComputeExpectationBatched)(
handle, batchedSv, svDataType, nIndexBits, nSVs, svStride, expectationValues, matrices, matrixDataType, layout, nMatrices, basisBits, nBasisBits, computeType, extraWorkspace, extraWorkspaceSizeInBytes)


cdef custatevecStatus_t _custatevecSubSVMigratorCreate(custatevecHandle_t handle, custatevecSubSVMigratorDescriptor_t* migrator, void* deviceSlots, cudaDataType_t svDataType, int nDeviceSlots, int nLocalIndexBits) except* nogil:
global __custatevecSubSVMigratorCreate
_check_or_init_custatevec()
Expand Down Expand Up @@ -1599,3 +1579,23 @@ cdef custatevecStatus_t _custatevecSubSVMigratorMigrate(custatevecHandle_t handl
raise FunctionNotFoundError("function custatevecSubSVMigratorMigrate is not found")
return (<custatevecStatus_t (*)(custatevecHandle_t, custatevecSubSVMigratorDescriptor_t, int, const void*, void*, custatevecIndex_t, custatevecIndex_t) nogil>__custatevecSubSVMigratorMigrate)(
handle, migrator, deviceSlotIndex, srcSubSV, dstSubSV, begin, end)


cdef custatevecStatus_t _custatevecComputeExpectationBatchedGetWorkspaceSize(custatevecHandle_t handle, cudaDataType_t svDataType, const uint32_t nIndexBits, const uint32_t nSVs, const custatevecIndex_t svStride, const void* matrices, cudaDataType_t matrixDataType, custatevecMatrixLayout_t layout, const uint32_t nMatrices, const uint32_t nBasisBits, custatevecComputeType_t computeType, size_t* extraWorkspaceSizeInBytes) except* nogil:
global __custatevecComputeExpectationBatchedGetWorkspaceSize
_check_or_init_custatevec()
if __custatevecComputeExpectationBatchedGetWorkspaceSize == NULL:
with gil:
raise FunctionNotFoundError("function custatevecComputeExpectationBatchedGetWorkspaceSize is not found")
return (<custatevecStatus_t (*)(custatevecHandle_t, cudaDataType_t, const uint32_t, const uint32_t, const custatevecIndex_t, const void*, cudaDataType_t, custatevecMatrixLayout_t, const uint32_t, const uint32_t, custatevecComputeType_t, size_t*) nogil>__custatevecComputeExpectationBatchedGetWorkspaceSize)(
handle, svDataType, nIndexBits, nSVs, svStride, matrices, matrixDataType, layout, nMatrices, nBasisBits, computeType, extraWorkspaceSizeInBytes)


cdef custatevecStatus_t _custatevecComputeExpectationBatched(custatevecHandle_t handle, const void* batchedSv, cudaDataType_t svDataType, const uint32_t nIndexBits, const uint32_t nSVs, custatevecIndex_t svStride, double2* expectationValues, const void* matrices, cudaDataType_t matrixDataType, custatevecMatrixLayout_t layout, const uint32_t nMatrices, const int32_t* basisBits, const uint32_t nBasisBits, custatevecComputeType_t computeType, void* extraWorkspace, size_t extraWorkspaceSizeInBytes) except* nogil:
global __custatevecComputeExpectationBatched
_check_or_init_custatevec()
if __custatevecComputeExpectationBatched == NULL:
with gil:
raise FunctionNotFoundError("function custatevecComputeExpectationBatched is not found")
return (<custatevecStatus_t (*)(custatevecHandle_t, const void*, cudaDataType_t, const uint32_t, const uint32_t, custatevecIndex_t, double2*, const void*, cudaDataType_t, custatevecMatrixLayout_t, const uint32_t, const int32_t*, const uint32_t, custatevecComputeType_t, void*, size_t) nogil>__custatevecComputeExpectationBatched)(
handle, batchedSv, svDataType, nIndexBits, nSVs, svStride, expectationValues, matrices, matrixDataType, layout, nMatrices, basisBits, nBasisBits, computeType, extraWorkspace, extraWorkspaceSizeInBytes)
4 changes: 2 additions & 2 deletions python/cuquantum/custatevec/custatevec.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ cpdef abs2sum_array_batched(intptr_t handle, intptr_t batched_sv, int sv_data_ty
cpdef size_t collapse_by_bit_string_batched_get_workspace_size(intptr_t handle, uint32_t n_svs, bit_strings, norms) except? 0
cpdef collapse_by_bit_string_batched(intptr_t handle, intptr_t batched_sv, int sv_data_type, uint32_t n_index_bits, uint32_t n_svs, int64_t sv_stride, bit_strings, bit_ordering, uint32_t bit_string_len, norms, intptr_t extra_workspace, size_t extra_workspace_size_in_bytes)
cpdef measure_batched(intptr_t handle, intptr_t batched_sv, int sv_data_type, uint32_t n_index_bits, uint32_t n_svs, int64_t sv_stride, intptr_t bit_strings, bit_ordering, uint32_t bit_string_len, randnums, int collapse)
cpdef size_t compute_expectation_batched_get_workspace_size(intptr_t handle, int sv_data_type, uint32_t n_index_bits, uint32_t n_svs, int64_t sv_stride, intptr_t matrices, int matrix_data_type, int layout, uint32_t n_matrices, uint32_t n_basis_bits, int compute_type) except? 0
cpdef compute_expectation_batched(intptr_t handle, intptr_t batched_sv, int sv_data_type, uint32_t n_index_bits, uint32_t n_svs, int64_t sv_stride, intptr_t expectation_values, intptr_t matrices, int matrix_data_type, int layout, uint32_t n_matrices, basis_bits, uint32_t n_basis_bits, int compute_type, intptr_t extra_workspace, size_t extra_workspace_size_in_bytes)
cpdef intptr_t sub_sv_migrator_create(intptr_t handle, intptr_t device_slots, int sv_data_type, int n_device_slots, int n_local_index_bits) except? 0
cpdef sub_sv_migrator_destroy(intptr_t handle, intptr_t migrator)
cpdef sub_sv_migrator_migrate(intptr_t handle, intptr_t migrator, int device_slot_ind_ex, intptr_t src_sub_sv, intptr_t dst_sub_sv, int64_t begin, int64_t end)
cpdef size_t compute_expectation_batched_get_workspace_size(intptr_t handle, int sv_data_type, uint32_t n_index_bits, uint32_t n_svs, int64_t sv_stride, intptr_t matrices, int matrix_data_type, int layout, uint32_t n_matrices, uint32_t n_basis_bits, int compute_type) except? 0
cpdef compute_expectation_batched(intptr_t handle, intptr_t batched_sv, int sv_data_type, uint32_t n_index_bits, uint32_t n_svs, int64_t sv_stride, intptr_t expectation_values, intptr_t matrices, int matrix_data_type, int layout, uint32_t n_matrices, basis_bits, uint32_t n_basis_bits, int compute_type, intptr_t extra_workspace, size_t extra_workspace_size_in_bytes)
Loading

0 comments on commit db47013

Please sign in to comment.