From 17497e86964dd487b5707fed986e7645f89f3e08 Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Fri, 14 Jan 2022 20:56:32 -0800 Subject: [PATCH 1/4] sync with internal repo (commit b3e9805f) --- python/README.md | 18 +++++++- python/cuquantum/__init__.py | 1 + python/cuquantum/_version.py | 2 + python/setup.py | 67 ++++++++++++++++++++++++------ samples/custatevec/Makefile | 7 +++- samples/cutensornet/CMakeLists.txt | 10 ++++- samples/cutensornet/Makefile | 10 ++++- 7 files changed, 97 insertions(+), 18 deletions(-) create mode 100644 python/cuquantum/_version.py diff --git a/python/README.md b/python/README.md index a8a3bcd..f692933 100644 --- a/python/README.md +++ b/python/README.md @@ -2,7 +2,7 @@ ## Documentation -Please visit the [NVIDIA cuQuantum SDK documentation](https://docs.nvidia.com/cuda/cuquantum/). +Please visit the [NVIDIA cuQuantum Python documentation](https://docs.nvidia.com/cuda/cuquantum/python). ## Building @@ -22,7 +22,19 @@ If you already have a Conda environment set up, it is the easiest to install cuQ ``` conda install -c conda-forge cuquantum-python ``` -The Conda solver will address all dependencies for you. +The Conda solver will install all required dependencies for you. + +### Install cuQuantum Python wheel through `pip` + +Alternatively, assuming you already have a Python environment set up (it doesn't matter if it's a Conda env or not), +you can also install cuQuantum Python this way: + +``` +pip install cuquantum-python +``` +The `pip` solver will install both cuTENSOR and cuQuantum for you. + +Note: To properly install the wheels the environment variable `CUQUANTUM_ROOT` must not be set. ### Install cuQuantum Python from source @@ -57,6 +69,8 @@ Runtime dependencies of the cuQuantum Python package include: If you install everything from conda-forge, the dependencies are taken care for you (except for the driver). +If you install the pip wheels, cuTENSOR and cuQuantum are installed for you. + If you build cuQuantum Python from source, please make sure the paths to the cuQuantum and cuTENSOR libraries are added to your `LD_LIBRARY_PATH` environment variable. diff --git a/python/cuquantum/__init__.py b/python/cuquantum/__init__.py index fefd8fc..82750fa 100644 --- a/python/cuquantum/__init__.py +++ b/python/cuquantum/__init__.py @@ -4,6 +4,7 @@ contract, contract_path, einsum, einsum_path, Network, NetworkOptions, OptimizerInfo, OptimizerOptions, PathFinderOptions, ReconfigOptions, SlicerOptions) from cuquantum.utils import ComputeType, cudaDataType, libraryPropertyType +from cuquantum._version import __version__ # We patch all enum values so that they have the correct docstrings diff --git a/python/cuquantum/_version.py b/python/cuquantum/_version.py new file mode 100644 index 0000000..262d033 --- /dev/null +++ b/python/cuquantum/_version.py @@ -0,0 +1,2 @@ +# TODO: find a better approach to sync the version string with the C libs +__version__ = '.'.join(['0.1.0', '1']) # the last digit is for cuQuantum Python only diff --git a/python/setup.py b/python/setup.py index 3b067d9..edfc7cc 100644 --- a/python/setup.py +++ b/python/setup.py @@ -7,6 +7,12 @@ from Cython.Build import cythonize +# Get __version__ variable +source_root = os.path.abspath(os.path.dirname(__file__)) +with open(os.path.join(source_root, 'cuquantum', '_version.py')) as f: + exec(f.read()) + + # search order: # 1. installed "cuquantum" package # 2. env var @@ -14,9 +20,11 @@ path = os.path.join(path, 'cuquantum') if os.path.isdir(path): cuquantum_root = path + using_cuquantum_wheel = True break else: cuquantum_root = os.environ.get('CUQUANTUM_ROOT') + using_cuquantum_wheel = False # We allow setting CUSTATEVEC_ROOT and CUTENSORNET_ROOT separately for the ease @@ -24,6 +32,7 @@ # or conda, or set CUQUANTUM_ROOT to the existing installation. try: custatevec_root = os.environ['CUSTATEVEC_ROOT'] + using_cuquantum_wheel = False except KeyError as e: if cuquantum_root is None: raise RuntimeError('cuStateVec is not found, please install "cuquantum" ' @@ -32,6 +41,7 @@ custatevec_root = cuquantum_root try: cutensornet_root = os.environ['CUTENSORNET_ROOT'] + using_cuquantum_wheel = False except KeyError as e: if cuquantum_root is None: raise RuntimeError('cuTensorNet is not found, please install "cuquantum" ' @@ -47,9 +57,11 @@ path = os.path.join(path, 'cutensor') if os.path.isdir(path): cutensor_root = path + assert using_cuquantum_wheel # if this raises, the env is corrupted break else: cutensor_root = os.environ.get('CUTENSOR_ROOT') + assert not using_cuquantum_wheel if cutensor_root is None: raise RuntimeError('cuTENSOR is not found, please install "cutensor" ' 'or set $CUTENSOR_ROOT') @@ -73,10 +85,12 @@ ] ignore_cuquantum_dep = bool(os.environ.get('CUQUANTUM_IGNORE_SOLVER', False)) if not ignore_cuquantum_dep: - setup_requires.append('cuquantum==0.0.1.*') - setup_requires.append('cutensor>=1.4.*') - install_requires.append('cuquantum==0.0.1.*') - install_requires.append('cutensor>=1.4.*') + 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 + ver = '.'.join(__version__.split('.')[:3]) # remove the Python patch number + setup_requires.append('cuquantum=='+ver+'.*') + install_requires.append('cuquantum=='+ver+'.*') def check_cuda_version(): @@ -110,12 +124,40 @@ def check_cuda_version(): raise RuntimeError(f"Unsupported CUDA version: {cuda_ver}") -print() -print("****************************************************************") +def prepare_libs_and_rpaths(): + global cusv_lib_dir, cutn_lib_dir + # we include both lib64 and lib to accommodate all possible sources + cusv_lib_dir = [os.path.join(custatevec_root, 'lib64'), + os.path.join(custatevec_root, 'lib')] + cutn_lib_dir = [os.path.join(cutensornet_root, 'lib64'), + os.path.join(cutensornet_root, 'lib'), + os.path.join(cutensor_root, 'lib', cutensor_ver)] + + global cusv_lib, cutn_lib, extra_linker_flags + if using_cuquantum_wheel: + cusv_lib = [':libcustatevec.so.0'] + cutn_lib = [':libcutensornet.so.0', ':libcutensor.so.1'] + # The rpaths must be adjusted given the following full-wheel installation: + # cuquantum-python: site-packages/cuquantum/{custatevec, cutensornet}/ [=$ORIGIN] + # cusv & cutn: site-packages/cuquantum/lib/ + # cutensor: site-packages/cutensor/lib/CUDA_VER/ + ldflag = "-Wl,--disable-new-dtags," + ldflag += "-rpath,$ORIGIN/../lib," + ldflag += f"-rpath,$ORIGIN/../../cutensor/lib/{cutensor_ver}" + extra_linker_flags = [ldflag] + else: + cusv_lib = ['custatevec'] + cutn_lib = ['cutensornet', 'cutensor'] + extra_linker_flags = [] + + +prepare_libs_and_rpaths() +print("\n****************************************************************") print("CUDA version:", cuda_ver) print("CUDA path:", cuda_path) print("cuStateVec path:", custatevec_root) print("cuTensorNet path:", cutensornet_root) +print("cuTENSOR path:", cutensor_root) print("****************************************************************\n") @@ -124,8 +166,9 @@ def check_cuda_version(): sources=["cuquantum/custatevec/custatevec.pyx"], include_dirs=[os.path.join(cuda_path, 'include'), os.path.join(custatevec_root, 'include')], - library_dirs=[os.path.join(custatevec_root, 'lib64')], - libraries=['custatevec'], + library_dirs=cusv_lib_dir, + libraries=cusv_lib, + extra_link_args=extra_linker_flags, ) @@ -134,15 +177,15 @@ def check_cuda_version(): sources=["cuquantum/cutensornet/cutensornet.pyx"], include_dirs=[os.path.join(cuda_path, 'include'), os.path.join(cutensornet_root, 'include')], - library_dirs=[os.path.join(cutensornet_root, 'lib64'), - os.path.join(cutensor_root, 'lib', cutensor_ver)], - libraries=['cutensornet', 'cutensor'], + library_dirs=cutn_lib_dir, + libraries=cutn_lib, + extra_link_args=extra_linker_flags, ) setup( name="cuquantum-python", - version='0.1.0.0', # the last digit is dedicated to cuQuantum Python + version=__version__, description="Python APIs for cuQuantum", url="https://github.com/NVIDIA/cuQuantum", author="NVIDIA Corporation", diff --git a/samples/custatevec/Makefile b/samples/custatevec/Makefile index 40ca7d5..b97f3e1 100644 --- a/samples/custatevec/Makefile +++ b/samples/custatevec/Makefile @@ -32,7 +32,12 @@ CUSTATEVEC_ROOT ?= ${CUDA_TOOLKIT} INC := -I$(CUSTATEVEC_ROOT)/include LIBS := -L$(CUSTATEVEC_ROOT)/lib64 -lcudart -lcustatevec -CXX_FLAGS= -std=c++11 $(INC) $(LIBS) +ARCH_FLAGS_SM70 = -gencode arch=compute_70,code=sm_70 +ARCH_FLAGS_SM75 = -gencode arch=compute_75,code=sm_75 +ARCH_FLAGS_SM80 = -gencode arch=compute_80,code=sm_80 -gencode arch=compute_80,code=compute_80 +ARCH_FLAGS = $(ARCH_FLAGS_SM70) $(ARCH_FLAGS_SM75) $(ARCH_FLAGS_SM80) + +CXX_FLAGS= -std=c++11 $(INC) $(LIBS) $(ARCH_FLAGS) all: nvcc gate_application.cu -o gate_application ${CXX_FLAGS} diff --git a/samples/cutensornet/CMakeLists.txt b/samples/cutensornet/CMakeLists.txt index 0ea8036..1a36966 100644 --- a/samples/cutensornet/CMakeLists.txt +++ b/samples/cutensornet/CMakeLists.txt @@ -87,8 +87,8 @@ if(NOT TARGET cutensor) set(CUTENSOR_LIBRARY_NAME "libcutensor.so") endif() set_target_properties(cutensor PROPERTIES - IMPORTED_LOCATION "${CUTENSOR_ROOT}/lib/${CUTENSOR_LIBRARY_NAME}" - IMPORTED_IMPLIB "${CUTENSOR_ROOT}/lib/${CUTENSOR_LIBRARY_DEF}" + IMPORTED_LOCATION "${CUTENSOR_ROOT}/lib/11/${CUTENSOR_LIBRARY_NAME}" + IMPORTED_IMPLIB "${CUTENSOR_ROOT}/lib/11/${CUTENSOR_LIBRARY_DEF}" INTERFACE_INCLUDE_DIRECTORIES "${CUTENSOR_ROOT}/include") endif() @@ -129,6 +129,12 @@ set(CMAKE_CUDA_STANDARD 11) set(CMAKE_CUDA_STANDARD_REQUIRED ON) set(CMAKE_CUDA_EXTENSIONS OFF) +set(CMAKE_CUDA_FLAGS_ARCH_SM70 "-gencode arch=compute_70,code=sm_70") +set(CMAKE_CUDA_FLAGS_ARCH_SM75 "-gencode arch=compute_75,code=sm_75") +set(CMAKE_CUDA_FLAGS_ARCH_SM80 "-gencode arch=compute_80,code=sm_80 -gencode arch=compute_80,code=compute_80") +set(CMAKE_CUDA_FLAGS_ARCH "${CMAKE_CUDA_FLAGS_ARCH_SM70} ${CMAKE_CUDA_FLAGS_ARCH_SM75} ${CMAKE_CUDA_FLAGS_ARCH_SM80}") +set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} ${CMAKE_CUDA_FLAGS_ARCH}") + # ########################################## # cuTENSOR_example target # ########################################## diff --git a/samples/cutensornet/Makefile b/samples/cutensornet/Makefile index 9390b06..e11c09c 100644 --- a/samples/cutensornet/Makefile +++ b/samples/cutensornet/Makefile @@ -1,4 +1,12 @@ -CXX_FLAGS=-std=c++11 -I${CUTENSORNET_ROOT}/include -L${CUTENSORNET_ROOT}/lib64 -L${CUTENSORNET_ROOT}/lib -lcutensornet -lcudart -lstdc++ +ARCH_FLAGS_SM70 = -gencode arch=compute_70,code=sm_70 +ARCH_FLAGS_SM75 = -gencode arch=compute_75,code=sm_75 +ARCH_FLAGS_SM80 = -gencode arch=compute_80,code=sm_80 -gencode arch=compute_80,code=compute_80 +ARCH_FLAGS = $(ARCH_FLAGS_SM70) $(ARCH_FLAGS_SM75) $(ARCH_FLAGS_SM80) +INCLUDE_DIRS = -I${CUTENSORNET_ROOT}/include -I${CUTENSOR_ROOT}/include +LIBRARY_DIRS = -L${CUTENSORNET_ROOT}/lib64 -L${CUTENSORNET_ROOT}/lib -L${CUTENSOR_ROOT}/lib/11 +LINKER_FLAGS = -lcutensornet -lcutensor -lcudart -lstdc++ + +CXX_FLAGS=-std=c++11 $(INCLUDE_DIRS) $(LIBRARY_DIRS) $(LINKER_FLAGS) $(ARCH_FLAGS) all: nvcc tensornet_example.cu -o tensornet_example ${CXX_FLAGS} From de62577b74527535cdbceb8cd0be53319aa645ee Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Sat, 5 Feb 2022 00:21:33 -0800 Subject: [PATCH 2/4] add cuQuantum SDK logo and conda-forge links --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index b14d72b..10d2e39 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,14 @@ +
+ # Welcome to the cuQuantum repository! This public repository contains two sets of files related to the [NVIDIA cuQuantum SDK](https://developer.nvidia.com/cuquantum-sdk): - `samples`: All C/C++ sample codes for the cuQuantum SDK. - `python`: The open-sourced cuQuantum Python project. + - Available for download on + - conda-forge: `cuquantum` [![Conda Version](https://img.shields.io/conda/vn/conda-forge/cuquantum.svg)](https://anaconda.org/conda-forge/cuquantum), `cuquantum-python` [![Conda Version](https://img.shields.io/conda/vn/conda-forge/cuquantum-python.svg)](https://anaconda.org/conda-forge/cuquantum-python) + - PyPI: *coming soon!* Other components of the cuQuantum SDK can be accessed following the instruction given in the documentation. From 08ff1d63ba004e3362a6b8af93e5f64b902a69b4 Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Tue, 8 Mar 2022 22:03:05 -0800 Subject: [PATCH 3/4] sync with internal repo (commit 46b9ffa6) --- python/setup.py | 8 +- .../cutensornet_tests/test_cutensornet.py | 4 +- samples/custatevec/CMakeLists.txt | 129 +++++++---- samples/custatevec/Makefile | 40 ++-- samples/cutensornet/CMakeLists.txt | 216 ++++++++---------- samples/cutensornet/Makefile | 76 +++++- 6 files changed, 269 insertions(+), 204 deletions(-) diff --git a/python/setup.py b/python/setup.py index edfc7cc..2b59615 100644 --- a/python/setup.py +++ b/python/setup.py @@ -127,10 +127,10 @@ def check_cuda_version(): def prepare_libs_and_rpaths(): global cusv_lib_dir, cutn_lib_dir # we include both lib64 and lib to accommodate all possible sources - cusv_lib_dir = [os.path.join(custatevec_root, 'lib64'), - os.path.join(custatevec_root, 'lib')] - cutn_lib_dir = [os.path.join(cutensornet_root, 'lib64'), - os.path.join(cutensornet_root, 'lib'), + cusv_lib_dir = [os.path.join(custatevec_root, 'lib'), + os.path.join(custatevec_root, 'lib64')] + cutn_lib_dir = [os.path.join(cutensornet_root, 'lib'), + os.path.join(cutensornet_root, 'lib64'), os.path.join(cutensor_root, 'lib', cutensor_ver)] global cusv_lib, cutn_lib, extra_linker_flags diff --git a/python/tests/cuquantum_tests/cutensornet_tests/test_cutensornet.py b/python/tests/cuquantum_tests/cutensornet_tests/test_cutensornet.py index 1c536f4..3a707dc 100644 --- a/python/tests/cuquantum_tests/cutensornet_tests/test_cutensornet.py +++ b/python/tests/cuquantum_tests/cutensornet_tests/test_cutensornet.py @@ -105,8 +105,10 @@ def test_get_version(self): assert ver == cutensornet.VERSION def test_get_cudart_version(self): + # CUDA runtime is statically linked, so we can't compare + # with the "runtime" version ver = cutensornet.get_cudart_version() - assert ver == cupy.cuda.runtime.runtimeGetVersion() + assert isinstance(ver, int) class TestHandle: diff --git a/samples/custatevec/CMakeLists.txt b/samples/custatevec/CMakeLists.txt index 32b6e0f..ba01afe 100644 --- a/samples/custatevec/CMakeLists.txt +++ b/samples/custatevec/CMakeLists.txt @@ -1,6 +1,6 @@ -# -# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # +# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -13,7 +13,7 @@ # - Neither the name(s) of the copyright holder(s) nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. -# +# # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -24,13 +24,10 @@ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ---[ Check cmake version. cmake_minimum_required(VERSION 3.13.0 FATAL_ERROR) -if(CMAKE_VERSION VERSION_GREATER 3.18) - cmake_policy(SET CMP0104 OLD) - set(CUDA_ARCHITECTURES FALSE) -endif() # ---[ Project specification. project(custatevec_example LANGUAGES C CXX CUDA) @@ -38,30 +35,51 @@ project(custatevec_example LANGUAGES C CXX CUDA) include(GNUInstallDirs) # ########################################## -# cuStateVec_example build mode +# custatevec_example build mode # ########################################## -if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - message(STATUS "Setting build type to 'Debug' as none was specified.") - set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build." FORCE) - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "" "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Debug' as none was specified.") + set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build.") + set_property( + CACHE + CMAKE_BUILD_TYPE + PROPERTY + STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" + ) else() - message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") + message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") endif() # ########################################## -# cuStateVec_example dependencies +# custatevec_example check-env utilities # ########################################## -if (NOT CUSTATEVEC_ROOT) - set(CUSTATEVEC_ROOT ${CUDA_TOOLKIT_ROOT_DIR}) -endif() +function(set_with_fallback VARIABLE FALLBACK) + if (NOT DEFINED ${VARIABLE} OR ${VARIABLE} STREQUAL "") + set(${VARIABLE} $ENV{${VARIABLE}} CACHE INTERNAL ${VARIABLE}) + if (${VARIABLE} STREQUAL "") + if (NOT ${FALLBACK} STREQUAL "") + set(${VARIABLE} $ENV{${FALLBACK}} CACHE INTERNAL ${VARIABLE}) + endif () + endif () + endif () +endfunction() -include_directories(${CUSTATEVEC_ROOT}/include) -link_directories(${CUSTATEVEC_ROOT}/lib64) +# ########################################## +# custatevec_example dependencies +# ########################################## + +set_with_fallback(CUSTATEVEC_ROOT CUQUANTUM_ROOT) + +if (CUSTATEVEC_ROOT STREQUAL "") + message(FATAL_ERROR "Please set the environment variables CUSTATEVEC_ROOT or CUQUANTUM_ROOT to the path of the cuQuantum installation.") +endif () + +message(STATUS "Using CUSTATEVEC_ROOT = ${CUSTATEVEC_ROOT}") # ########################################## -# cuStateVec_example building flags +# custatevec_example global flags # ########################################## # Global CXX flags/options @@ -75,39 +93,54 @@ set(CMAKE_CUDA_STANDARD 11) set(CMAKE_CUDA_STANDARD_REQUIRED ON) set(CMAKE_CUDA_EXTENSIONS OFF) -set(CMAKE_CUDA_FLAGS_ARCH_SM60 "-gencode arch=compute_60,code=sm_60") -set(CMAKE_CUDA_FLAGS_ARCH_SM70 "-gencode arch=compute_70,code=sm_70") -set(CMAKE_CUDA_FLAGS_ARCH_SM75 "-gencode arch=compute_75,code=sm_75") -set(CMAKE_CUDA_FLAGS_ARCH_SM80 "-gencode arch=compute_80,code=sm_80 -gencode arch=compute_80,code=compute_80") -set(CMAKE_CUDA_FLAGS_ARCH "${CMAKE_CUDA_FLAGS_ARCH_SM60} ${CMAKE_CUDA_FLAGS_ARCH_SM70} ${CMAKE_CUDA_FLAGS_ARCH_SM75} ${CMAKE_CUDA_FLAGS_ARCH_SM80}") -set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} ${CMAKE_CUDA_FLAGS_ARCH}") - # ########################################## -# cuStateVec_example target +# custatevec_example utility function # ########################################## function(add_custatevec_example GROUP_TARGET EXAMPLE_NAME EXAMPLE_SOURCES) - list(GET EXAMPLE_SOURCES 0 EXAMPLE_MAIN_SOURCE) - get_filename_component(EXAMPLE_TARGET ${EXAMPLE_MAIN_SOURCE} NAME_WE) - add_executable(${EXAMPLE_TARGET} ${EXAMPLE_SOURCES}) - target_include_directories(${EXAMPLE_TARGET} - PUBLIC - ${CUDA_INCLUDE_DIRS} - ${CUSTATEVEC_ROOT}/include - ) - target_link_libraries(${EXAMPLE_TARGET} - PUBLIC custatevec cudart cublas cublasLt - ) - # Install example - install( - TARGETS ${EXAMPLE_TARGET} - RUNTIME - DESTINATION ${CUSTATEVEC_EXAMPLE_BINARY_INSTALL_DIR} - PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ - ) - add_dependencies(${GROUP_TARGET} ${EXAMPLE_TARGET}) + list(GET EXAMPLE_SOURCES 0 EXAMPLE_MAIN_SOURCE) + get_filename_component(EXAMPLE_TARGET ${EXAMPLE_MAIN_SOURCE} NAME_WE) + add_executable(${EXAMPLE_TARGET} ${EXAMPLE_SOURCES}) + target_include_directories( + ${EXAMPLE_TARGET} + PUBLIC + ${CUDA_INCLUDE_DIRS} + ${CUSTATEVEC_ROOT}/include + ) + target_link_directories( + ${EXAMPLE_TARGET} + PUBLIC + ${CUSTATEVEC_ROOT}/lib + ${CUSTATEVEC_ROOT}/lib64 + ) + target_link_libraries( + ${EXAMPLE_TARGET} + PUBLIC + custatevec + cudart + cublas + cublasLt + ) + set_target_properties( + ${EXAMPLE_TARGET} + PROPERTIES + CUDA_ARCHITECTURES + "70;75;80" + ) + # Install example + install( + TARGETS ${EXAMPLE_TARGET} + RUNTIME + DESTINATION ${CUSTATEVEC_EXAMPLE_BINARY_INSTALL_DIR} + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ + ) + add_dependencies(${GROUP_TARGET} ${EXAMPLE_TARGET}) endfunction() +# ########################################## +# custatevec_example add all targets +# ########################################## + add_custom_target(custatevec_examples) add_custatevec_example(custatevec_examples "cuStateVec.example.gate_application" gate_application.cu) diff --git a/samples/custatevec/Makefile b/samples/custatevec/Makefile index b97f3e1..2c1684b 100644 --- a/samples/custatevec/Makefile +++ b/samples/custatevec/Makefile @@ -1,7 +1,7 @@ -# -# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# -# +# +# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: @@ -16,7 +16,7 @@ # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT @@ -24,22 +24,24 @@ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -CUDA_TOOLKIT := $(shell dirname $$(command -v nvcc))/.. -CUSTATEVEC_ROOT ?= ${CUDA_TOOLKIT} +SHELL := /bin/bash +CUDA_TOOLKIT := $(shell realpath $$(dirname $$(command -v nvcc))/..) +CUSTATEVEC_ROOT ?= ${CUQUANTUM_ROOT} -INC := -I$(CUSTATEVEC_ROOT)/include -LIBS := -L$(CUSTATEVEC_ROOT)/lib64 -lcudart -lcustatevec +INCLUDE_DIRS := -I$(CUSTATEVEC_ROOT)/include +LIBRARY_DIRS := -L$(CUSTATEVEC_ROOT)/lib64 -L$(CUSTATEVEC_ROOT)/lib +LINKER_FLAGS := -lcudart -lcustatevec ARCH_FLAGS_SM70 = -gencode arch=compute_70,code=sm_70 ARCH_FLAGS_SM75 = -gencode arch=compute_75,code=sm_75 ARCH_FLAGS_SM80 = -gencode arch=compute_80,code=sm_80 -gencode arch=compute_80,code=compute_80 -ARCH_FLAGS = $(ARCH_FLAGS_SM70) $(ARCH_FLAGS_SM75) $(ARCH_FLAGS_SM80) +ARCH_FLAGS = $(ARCH_FLAGS_SM70) $(ARCH_FLAGS_SM75) $(ARCH_FLAGS_SM80) -CXX_FLAGS= -std=c++11 $(INC) $(LIBS) $(ARCH_FLAGS) +CXX_FLAGS = -std=c++11 $(INCLUDE_DIRS) $(LIBRARY_DIRS) $(ARCH_FLAGS) $(LINKER_FLAGS) -all: +all: check-env nvcc gate_application.cu -o gate_application ${CXX_FLAGS} nvcc permutation_matrix.cu -o permutation_matrix ${CXX_FLAGS} nvcc diagonal_matrix.cu -o diagonal_matrix ${CXX_FLAGS} @@ -52,6 +54,18 @@ all: nvcc accessor_get.cu -o accessor_get ${CXX_FLAGS} nvcc accessor_set.cu -o accessor_set ${CXX_FLAGS} +check-env: + @ echo "" && \ + echo "CUDA_TOOLKIT=${CUDA_TOOLKIT}"; \ + echo "CUSTATEVEC_ROOT=${CUSTATEVEC_ROOT}"; \ + echo ""; \ + if [[ -z "${CUSTATEVEC_ROOT}" ]]; \ + then \ + echo "" && \ + echo "Neither CUSTATEVEC_ROOT nor CUQUANTUM_ROOT is set." && \ + exit 1; \ + fi + clean: rm -f gate_application \ permutation_matrix \ diff --git a/samples/cutensornet/CMakeLists.txt b/samples/cutensornet/CMakeLists.txt index 1a36966..86c6927 100644 --- a/samples/cutensornet/CMakeLists.txt +++ b/samples/cutensornet/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # # Redistribution and use in source and binary forms, with or without @@ -25,98 +25,68 @@ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# # ---[ Check cmake version. -cmake_minimum_required(VERSION 3.12.0 FATAL_ERROR) - -include(GNUInstallDirs) +cmake_minimum_required(VERSION 3.13.0 FATAL_ERROR) -# ---[ Project specIFication. +# ---[ Project specification. project(cutensornet_example LANGUAGES C CXX CUDA) +include(GNUInstallDirs) + # ########################################## -# cuTENSOR_example build mode +# cutensornet_example build mode # ########################################## -if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - message(STATUS "Setting build type to 'Debug' as none was specified.") - set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build." FORCE) - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "" "Debug" "Release" "MinSizeRel" "RelWithDebInfo") -else() - message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") -endif() +if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Debug' as none was specified.") + set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build.") + set_property( + CACHE + CMAKE_BUILD_TYPE + PROPERTY + STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" + ) +else () + message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") +endif () # ########################################## -# cuTENSOR_example dependencies +# custatevec_example check-env utilities # ########################################## -find_package(CUDA 10.1 REQUIRED) -include_directories("${CUDA_INCLUDE_DIRS}") - -if(NOT DEFINED ENV{CUTENSOR_ROOT} AND NOT DEFINED CUTENSOR_ROOT) - message(FATAL_ERROR "CUTENSOR_ROOT not set!") -else() - if(DEFINED ENV{CUTENSOR_ROOT}) - set(CUTENSOR_ROOT "$ENV{CUTENSOR_ROOT}") - endif() - message("-- Looking for cuTENSOR in ${CUTENSOR_ROOT}") - if(NOT EXISTS ${CUTENSOR_ROOT}) - message(FATAL_ERROR "Cannot find CUTENSOR_ROOT") - endif() -endif() - -if(NOT DEFINED ENV{CUTENSORNET_ROOT} AND NOT DEFINED CUTENSORNET_ROOT) - message(FATAL_ERROR "CUTENSORNET_ROOT not set!") -else() - if(DEFINED ENV{CUTENSORNET_ROOT}) - set(CUTENSORNET_ROOT "$ENV{CUTENSORNET_ROOT}") - endif() - message("-- Looking for cuTENSORNet in ${CUTENSORNET_ROOT}") - if(NOT EXISTS ${CUTENSORNET_ROOT}) - message(FATAL_ERROR "Cannot find CUTENSORNET_ROOT") - endif() -endif() - -if(NOT TARGET cutensor) - add_library(cutensor SHARED IMPORTED) - if(WIN32) - set(CUTENSOR_LIBRARY_NAME "cutensor.dll") - set(CUTENSOR_LIBRARY_DEF "cutensor.lib") - else() - set(CUTENSOR_LIBRARY_NAME "libcutensor.so") - endif() - set_target_properties(cutensor PROPERTIES - IMPORTED_LOCATION "${CUTENSOR_ROOT}/lib/11/${CUTENSOR_LIBRARY_NAME}" - IMPORTED_IMPLIB "${CUTENSOR_ROOT}/lib/11/${CUTENSOR_LIBRARY_DEF}" - INTERFACE_INCLUDE_DIRECTORIES "${CUTENSOR_ROOT}/include") -endif() - -if(NOT TARGET cutensornet) - add_library(cutensornet SHARED IMPORTED) - if(WIN32) - set(CUTENSORNET_LIBRARY_NAME "cutensornet.dll") - set(CUTENSORNET_LIBRARY_DEF "cutensornet.lib") - else() - set(CUTENSORNET_LIBRARY_NAME "libcutensornet.so") - endif() - set_target_properties(cutensornet PROPERTIES - IMPORTED_LOCATION "${CUTENSORNET_ROOT}/lib/${CUTENSORNET_LIBRARY_NAME}" - IMPORTED_IMPLIB "${CUTENSORNET_ROOT}/lib/${CUTENSORNET_LIBRARY_DEF}" - INTERFACE_INCLUDE_DIRECTORIES "${CUTENSORNET_ROOT}/include") -endif() - -# Installation directories -if(NOT DEFINED CUTENSORNET_EXAMPLE_BINARY_INSTALL_DIR) - message(WARNING "CUTENSORNET_EXAMPLE_BINARY_INSTALL_DIR not set, setting to cutensornet_example/bin") - set(CUTENSORNET_EXAMPLE_BINARY_INSTALL_DIR "cutensornet_example/bin") -endif() +function(set_with_fallback VARIABLE FALLBACK) + if (NOT DEFINED ${VARIABLE} OR ${VARIABLE} STREQUAL "") + set(${VARIABLE} $ENV{${VARIABLE}} CACHE INTERNAL ${VARIABLE}) + if (${VARIABLE} STREQUAL "") + if (NOT ${FALLBACK} STREQUAL "") + set(${VARIABLE} $ENV{${FALLBACK}} CACHE INTERNAL ${VARIABLE}) + endif () + endif () + endif () +endfunction() # ########################################## -# cuTENSOR_example building flags +# cutensornet_example dependencies # ########################################## -# Global CXX/CUDA flags +set_with_fallback(CUTENSOR_ROOT NONE) + +if (CUTENSOR_ROOT STREQUAL "") + message(FATAL_ERROR "Please set the environment variables CUTENSOR_ROOT to the path of the cuTENSOR installation.") +endif () + +set_with_fallback(CUTENSORNET_ROOT CUQUANTUM_ROOT) + +if (CUTENSORNET_ROOT STREQUAL "") + message(FATAL_ERROR "Please set the environment variables CUTENSORNET_ROOT or CUQUANTUM_ROOT to the path of the cuQuantum installation.") +endif () + +message(STATUS "Using CUTENSORNET_ROOT = ${CUTENSORNET_ROOT}") + +# ########################################## +# cutensornet_example global flags +# ########################################## # Global CXX flags/options set(CMAKE_CXX_STANDARD 11) @@ -129,64 +99,58 @@ set(CMAKE_CUDA_STANDARD 11) set(CMAKE_CUDA_STANDARD_REQUIRED ON) set(CMAKE_CUDA_EXTENSIONS OFF) -set(CMAKE_CUDA_FLAGS_ARCH_SM70 "-gencode arch=compute_70,code=sm_70") -set(CMAKE_CUDA_FLAGS_ARCH_SM75 "-gencode arch=compute_75,code=sm_75") -set(CMAKE_CUDA_FLAGS_ARCH_SM80 "-gencode arch=compute_80,code=sm_80 -gencode arch=compute_80,code=compute_80") -set(CMAKE_CUDA_FLAGS_ARCH "${CMAKE_CUDA_FLAGS_ARCH_SM70} ${CMAKE_CUDA_FLAGS_ARCH_SM75} ${CMAKE_CUDA_FLAGS_ARCH_SM80}") -set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} ${CMAKE_CUDA_FLAGS_ARCH}") - # ########################################## -# cuTENSOR_example target +# cutensornet_example utility function # ########################################## function(add_cutensornet_example GROUP_TARGET EXAMPLE_NAME EXAMPLE_SOURCES) - list(GET EXAMPLE_SOURCES 0 EXAMPLE_MAIN_SOURCE) - get_filename_component(EXAMPLE_TARGET ${EXAMPLE_MAIN_SOURCE} NAME_WE) - add_executable(${EXAMPLE_TARGET} ${EXAMPLE_SOURCES}) - target_include_directories(${EXAMPLE_TARGET} - PUBLIC - ${CUDA_INCLUDE_DIRS} - ${CUTENSOR_ROOT}/include - ${CUTENSORNET_ROOT}/include - ) - target_link_libraries(${EXAMPLE_TARGET} - PUBLIC - cutensornet - cutensor - cudart - cublasLt - ) - set_target_properties(${EXAMPLE_TARGET} PROPERTIES + list(GET EXAMPLE_SOURCES 0 EXAMPLE_MAIN_SOURCE) + get_filename_component(EXAMPLE_TARGET ${EXAMPLE_MAIN_SOURCE} NAME_WE) + add_executable(${EXAMPLE_TARGET} ${EXAMPLE_SOURCES}) + target_include_directories( + ${EXAMPLE_TARGET} + PUBLIC + ${CUDA_INCLUDE_DIRS} + ${CUTENSOR_ROOT}/include + ${CUTENSORNET_ROOT}/include + ) + target_link_directories( + ${EXAMPLE_TARGET} + PUBLIC + ${CUTENSOR_ROOT}/lib/11 + ${CUTENSORNET_ROOT}/lib + ${CUTENSORNET_ROOT}/lib64 + ) + target_link_libraries( + ${EXAMPLE_TARGET} + PUBLIC + cutensornet + cutensor + cudart + cublasLt + ) + set_target_properties( + ${EXAMPLE_TARGET} + PROPERTIES POSITION_INDEPENDENT_CODE ON CUDA_SEPARABLE_COMPILATION ON - ) - - # Install example - install( - TARGETS ${EXAMPLE_TARGET} - RUNTIME - DESTINATION ${CUTENSORNET_EXAMPLE_BINARY_INSTALL_DIR} - PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ - ) - - add_dependencies(${GROUP_TARGET} ${EXAMPLE_TARGET}) + CUDA_ARCHITECTURES + "70;75;80" + ) + # Install example + install( + TARGETS ${EXAMPLE_TARGET} + RUNTIME + DESTINATION ${CUTENSORNET_EXAMPLE_BINARY_INSTALL_DIR} + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ + ) + add_dependencies(${GROUP_TARGET} ${EXAMPLE_TARGET}) endfunction() -add_custom_target(cutensornet_examples) - -add_cutensornet_example(cutensornet_examples "cuTENSORNet.example.tensornet" tensornet_example.cu) - # ########################################## -# cuTENSOR_example directories +# cutensornet_example add all targets # ########################################## -# By default put binaries in build/bin (pre-install) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) - -# ########################################## -# Install examples -# ########################################## +add_custom_target(cutensornet_examples) -IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - SET(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR} CACHE PATH "" FORCE) -ENDIF() +add_cutensornet_example(cutensornet_examples "cuTENSORNet.example.tensornet" tensornet_example.cu) diff --git a/samples/cutensornet/Makefile b/samples/cutensornet/Makefile index e11c09c..3c09497 100644 --- a/samples/cutensornet/Makefile +++ b/samples/cutensornet/Makefile @@ -1,15 +1,67 @@ -ARCH_FLAGS_SM70 = -gencode arch=compute_70,code=sm_70 -ARCH_FLAGS_SM75 = -gencode arch=compute_75,code=sm_75 -ARCH_FLAGS_SM80 = -gencode arch=compute_80,code=sm_80 -gencode arch=compute_80,code=compute_80 -ARCH_FLAGS = $(ARCH_FLAGS_SM70) $(ARCH_FLAGS_SM75) $(ARCH_FLAGS_SM80) -INCLUDE_DIRS = -I${CUTENSORNET_ROOT}/include -I${CUTENSOR_ROOT}/include -LIBRARY_DIRS = -L${CUTENSORNET_ROOT}/lib64 -L${CUTENSORNET_ROOT}/lib -L${CUTENSOR_ROOT}/lib/11 -LINKER_FLAGS = -lcutensornet -lcutensor -lcudart -lstdc++ - -CXX_FLAGS=-std=c++11 $(INCLUDE_DIRS) $(LIBRARY_DIRS) $(LINKER_FLAGS) $(ARCH_FLAGS) - -all: - nvcc tensornet_example.cu -o tensornet_example ${CXX_FLAGS} +# +# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# - Neither the name(s) of the copyright holder(s) nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +SHELL := /bin/bash +CUDA_TOOLKIT := $(shell realpath $$(dirname $$(command -v nvcc))/..) +CUTENSORNET_ROOT ?= ${CUQUANTUM_ROOT} + +INCLUDE_DIRS := -I${CUTENSORNET_ROOT}/include -I${CUTENSOR_ROOT}/include +LIBRARY_DIRS := -L${CUTENSORNET_ROOT}/lib -L${CUTENSORNET_ROOT}/lib64 -L${CUTENSOR_ROOT}/lib/11 +LINKER_FLAGS := -lcutensornet -lcutensor -lcudart -lstdc++ + +ARCH_FLAGS_SM70 = -gencode arch=compute_70,code=sm_70 +ARCH_FLAGS_SM75 = -gencode arch=compute_75,code=sm_75 +ARCH_FLAGS_SM80 = -gencode arch=compute_80,code=sm_80 -gencode arch=compute_80,code=compute_80 +ARCH_FLAGS = $(ARCH_FLAGS_SM70) $(ARCH_FLAGS_SM75) $(ARCH_FLAGS_SM80) + +CXX_FLAGS =-std=c++11 $(INCLUDE_DIRS) $(LIBRARY_DIRS) $(LINKER_FLAGS) $(ARCH_FLAGS) + +all: check-env + nvcc tensornet_example.cu -o tensornet_example ${CXX_FLAGS} + +check-env: + @ echo "" && \ + echo "CUDA_TOOLKIT=${CUDA_TOOLKIT}"; \ + echo "CUTENSOR_ROOT=${CUTENSOR_ROOT}"; \ + echo "CUTENSORNET_ROOT=${CUTENSORNET_ROOT}"; \ + echo ""; \ + if [[ -z "${CUTENSOR_ROOT}" ]]; \ + then \ + echo "" && \ + echo "CUTENSOR_ROOT is not set." && \ + exit 1; \ + fi; \ + if [[ -z "${CUTENSORNET_ROOT}" ]]; \ + then \ + echo "" && \ + echo "Neither CUTENSORNET_ROOT nor CUQUANTUM_ROOT is set." && \ + exit 1; \ + fi clean: rm -f tensornet_example tensornet_example.o From d65a6d04b533468d67d099c61c44e8445b0a3c37 Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Wed, 9 Mar 2022 21:16:32 -0800 Subject: [PATCH 4/4] tentatively remove the pip instruction to be consistent --- python/README.md | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/python/README.md b/python/README.md index f692933..68eb2b7 100644 --- a/python/README.md +++ b/python/README.md @@ -24,18 +24,6 @@ conda install -c conda-forge cuquantum-python ``` The Conda solver will install all required dependencies for you. -### Install cuQuantum Python wheel through `pip` - -Alternatively, assuming you already have a Python environment set up (it doesn't matter if it's a Conda env or not), -you can also install cuQuantum Python this way: - -``` -pip install cuquantum-python -``` -The `pip` solver will install both cuTENSOR and cuQuantum for you. - -Note: To properly install the wheels the environment variable `CUQUANTUM_ROOT` must not be set. - ### Install cuQuantum Python from source To compile and install cuQuantum Python from source, please follow the steps below: