From e7b79d12a24ff5e438a4abd65d62b0db1b96e740 Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Fri, 20 May 2022 16:02:52 -0700 Subject: [PATCH] sync with internal repo (commit 457dd8eb) --- LICENSE | 2 +- python/README.md | 4 ++-- python/cuquantum/_version.py | 2 +- python/setup.py | 22 ++++++++++++------- .../custatevec_tests/test_custatevec.py | 6 +++++ .../cutensornet_tests/test_cutensornet.py | 10 ++++++++- 6 files changed, 33 insertions(+), 13 deletions(-) diff --git a/LICENSE b/LICENSE index 70f0f71..ae5630b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. BSD-3-Clause diff --git a/python/README.md b/python/README.md index 9f5cd85..9c8e250 100644 --- a/python/README.md +++ b/python/README.md @@ -12,7 +12,7 @@ Build-time dependencies of the cuQuantum Python package and some versions that are known to work are as follows: * CUDA Toolkit 11.x -* cuQuantum 22.03 +* cuQuantum 22.03+ * cuTENSOR 1.5.0+ * Cython - e.g. 0.29.21 * [packaging](https://packaging.pypa.io/en/latest/) @@ -62,7 +62,7 @@ Runtime dependencies of the cuQuantum Python package include: * An NVIDIA GPU with compute capability 7.0+ * Driver: Linux (450.80.02+) * CUDA Toolkit 11.x -* cuQuantum 22.03 +* cuQuantum 22.03+ * cuTENSOR 1.5.0+ * NumPy v1.17+ * CuPy v9.5.0+ (see [installation guide](https://docs.cupy.dev/en/stable/install.html)) diff --git a/python/cuquantum/_version.py b/python/cuquantum/_version.py index 9defb20..ce971e1 100644 --- a/python/cuquantum/_version.py +++ b/python/cuquantum/_version.py @@ -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__ = '22.03.0' # the last digit is for cuQuantum Python only +__version__ = '22.05.0' # the last digit is for cuQuantum Python only diff --git a/python/setup.py b/python/setup.py index 3345696..9c5e645 100644 --- a/python/setup.py +++ b/python/setup.py @@ -22,7 +22,10 @@ # 22.3 by setuptools, so we must follow the same practice in the constraints; # also, we don't need the Python patch number here cuqnt_py_ver = Version(__version__) -cuqnt_ver_major_minor = f"{cuqnt_py_ver.major}.{cuqnt_py_ver.minor}" +# WAR: restore this line when releasing 22.06, for now we pin at 22.03 to +# enable binary compatibility +#cuqnt_ver_major_minor = f"{cuqnt_py_ver.major}.{cuqnt_py_ver.minor}" +cuqnt_ver_major_minor = '22.3' # search order: @@ -94,17 +97,20 @@ ] install_requires = [ 'numpy', - # 'cupy', # <-- can't be listed here as on PyPI this is the name for source build, not for wheel - # 'torch', # <-- PyTorch is optional; also, it does not live on PyPI... + # 'cupy', # TODO: use "cupy-wheel" once it's stablized, see https://github.com/cupy/cupy/issues/6688 + # 'torch', # <-- PyTorch is optional; also, the PyPI version does not support GPU... 'typing_extensions', ] ignore_cuquantum_dep = bool(os.environ.get('CUQUANTUM_IGNORE_SOLVER', False)) if not ignore_cuquantum_dep: assert using_cuquantum_wheel # if this raises, the env is corrupted - # cuTENSOR version is constrained in the cuquantum package, so we don't - # need to list it - setup_requires.append(f'cuquantum=={cuqnt_ver_major_minor}.*') - install_requires.append(f'cuquantum=={cuqnt_ver_major_minor}.*') + # - cuTENSOR version is constrained in the cuquantum package, so we don't + # need to list it + # - here we assume no API breaking across releases, if there's any we must + # bump the lowest supported version; we can't cap the highest supported + # version as we don't use semantic versioning, unfortunately... + setup_requires.append(f'cuquantum>={cuqnt_ver_major_minor}.*') + install_requires.append(f'cuquantum>={cuqnt_ver_major_minor}.*') def check_cuda_version(): @@ -225,7 +231,7 @@ def prepare_libs_and_rpaths(): "Environment :: GPU :: NVIDIA CUDA :: 11.3", "Environment :: GPU :: NVIDIA CUDA :: 11.4", "Environment :: GPU :: NVIDIA CUDA :: 11.5", - #"Environment :: GPU :: NVIDIA CUDA :: 11.6", # PyPI has not added it yet + "Environment :: GPU :: NVIDIA CUDA :: 11.6", ], ext_modules=cythonize([ custatevec, diff --git a/python/tests/cuquantum_tests/custatevec_tests/test_custatevec.py b/python/tests/cuquantum_tests/custatevec_tests/test_custatevec.py index 5032840..b955390 100644 --- a/python/tests/cuquantum_tests/custatevec_tests/test_custatevec.py +++ b/python/tests/cuquantum_tests/custatevec_tests/test_custatevec.py @@ -4,6 +4,7 @@ import copy import os +import sys import tempfile try: @@ -29,6 +30,11 @@ # ################################################################### +if cffi: + # if the Python binding is not installed in the editable mode (pip install + # -e .), the cffi tests would fail as the modules cannot be imported + sys.path.append(os.getcwd()) + dtype_to_data_type = { numpy.dtype(numpy.complex64): cudaDataType.CUDA_C_32F, numpy.dtype(numpy.complex128): cudaDataType.CUDA_C_64F, diff --git a/python/tests/cuquantum_tests/cutensornet_tests/test_cutensornet.py b/python/tests/cuquantum_tests/cutensornet_tests/test_cutensornet.py index 6ab9640..07edefb 100644 --- a/python/tests/cuquantum_tests/cutensornet_tests/test_cutensornet.py +++ b/python/tests/cuquantum_tests/cutensornet_tests/test_cutensornet.py @@ -6,6 +6,7 @@ from collections import abc import functools import os +import sys import tempfile try: @@ -31,6 +32,11 @@ # ################################################################### +if cffi: + # if the Python binding is not installed in the editable mode (pip install + # -e .), the cffi tests would fail as the modules cannot be imported + sys.path.append(os.getcwd()) + dtype_to_data_type = { numpy.float16: cudaDataType.CUDA_R_16F, numpy.float32: cudaDataType.CUDA_R_32F, @@ -269,8 +275,10 @@ def test_get_version(self): assert ver == cutn.VERSION def test_get_cudart_version(self): + # CUDA runtime is statically linked, so we can't compare + # with the "runtime" version ver = cutn.get_cudart_version() - assert ver == cupy.cuda.runtime.runtimeGetVersion() + assert isinstance(ver, int) class TestHandle: