From 797f7dcca0098956b4fe0e7af1164f1ee8ba6022 Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Wed, 11 Sep 2024 03:55:11 +0000 Subject: [PATCH 01/14] move everything under cuda to cuda/bindings --- cuda/{ => bindings}/__init__.pxd | 0 cuda/{ => bindings}/__init__.py | 0 cuda/{ => bindings}/_cuda/__init__.py | 0 cuda/{ => bindings}/_cuda/ccuda.pxd.in | 0 cuda/{ => bindings}/_cuda/ccuda.pyx.in | 0 cuda/{ => bindings}/_cuda/cnvrtc.pxd.in | 0 cuda/{ => bindings}/_cuda/cnvrtc.pyx.in | 0 cuda/{ => bindings}/_cuda/loader.cpp | 0 cuda/{ => bindings}/_cuda/loader.h | 0 cuda/{ => bindings}/_cuda/loader.pxd | 0 cuda/{ => bindings}/_lib/__init__.py | 0 cuda/{ => bindings}/_lib/ccudart/__init__.py | 0 cuda/{ => bindings}/_lib/ccudart/ccudart.pxd.in | 0 cuda/{ => bindings}/_lib/ccudart/ccudart.pyx.in | 0 cuda/{ => bindings}/_lib/ccudart/utils.pxd.in | 0 cuda/{ => bindings}/_lib/ccudart/utils.pyx.in | 0 cuda/{ => bindings}/_lib/dlfcn.pxd | 0 cuda/{ => bindings}/_lib/param_packer.cpp | 0 cuda/{ => bindings}/_lib/param_packer.h | 0 cuda/{ => bindings}/_lib/param_packer.pxd | 0 cuda/{ => bindings}/_lib/utils.pxd.in | 0 cuda/{ => bindings}/_lib/utils.pyx.in | 0 cuda/{ => bindings}/_version.py | 0 cuda/{ => bindings}/benchmarks/__init__.py | 0 cuda/{ => bindings}/benchmarks/kernels.py | 0 cuda/{ => bindings}/benchmarks/perf_test_utils.py | 0 cuda/{ => bindings}/benchmarks/test_cupy.py | 0 cuda/{ => bindings}/benchmarks/test_launch_latency.py | 0 cuda/{ => bindings}/benchmarks/test_numba.py | 0 cuda/{ => bindings}/benchmarks/test_pointer_attributes.py | 0 cuda/{ => bindings}/ccuda.pxd.in | 0 cuda/{ => bindings}/ccuda.pyx.in | 0 cuda/{ => bindings}/ccudart.pxd.in | 0 cuda/{ => bindings}/ccudart.pyx.in | 0 cuda/{ => bindings}/cnvrtc.pxd.in | 0 cuda/{ => bindings}/cnvrtc.pyx.in | 0 cuda/{ => bindings}/cuda.pxd.in | 0 cuda/{ => bindings}/cuda.pyx.in | 0 cuda/{ => bindings}/cudart.pxd.in | 0 cuda/{ => bindings}/cudart.pyx.in | 0 cuda/{ => bindings}/nvrtc.pxd.in | 0 cuda/{ => bindings}/nvrtc.pyx.in | 0 cuda/{ => bindings}/tests/__init__.py | 0 cuda/{ => bindings}/tests/test_ccuda.pyx | 0 cuda/{ => bindings}/tests/test_ccudart.pyx | 0 cuda/{ => bindings}/tests/test_cuda.py | 0 cuda/{ => bindings}/tests/test_cudart.py | 0 cuda/{ => bindings}/tests/test_cython.py | 0 cuda/{ => bindings}/tests/test_interoperability.py | 0 cuda/{ => bindings}/tests/test_interoperability_cython.pyx | 0 cuda/{ => bindings}/tests/test_kernelParams.py | 0 cuda/{ => bindings}/tests/test_nvrtc.py | 0 52 files changed, 0 insertions(+), 0 deletions(-) rename cuda/{ => bindings}/__init__.pxd (100%) rename cuda/{ => bindings}/__init__.py (100%) rename cuda/{ => bindings}/_cuda/__init__.py (100%) rename cuda/{ => bindings}/_cuda/ccuda.pxd.in (100%) rename cuda/{ => bindings}/_cuda/ccuda.pyx.in (100%) rename cuda/{ => bindings}/_cuda/cnvrtc.pxd.in (100%) rename cuda/{ => bindings}/_cuda/cnvrtc.pyx.in (100%) rename cuda/{ => bindings}/_cuda/loader.cpp (100%) rename cuda/{ => bindings}/_cuda/loader.h (100%) rename cuda/{ => bindings}/_cuda/loader.pxd (100%) rename cuda/{ => bindings}/_lib/__init__.py (100%) rename cuda/{ => bindings}/_lib/ccudart/__init__.py (100%) rename cuda/{ => bindings}/_lib/ccudart/ccudart.pxd.in (100%) rename cuda/{ => bindings}/_lib/ccudart/ccudart.pyx.in (100%) rename cuda/{ => bindings}/_lib/ccudart/utils.pxd.in (100%) rename cuda/{ => bindings}/_lib/ccudart/utils.pyx.in (100%) rename cuda/{ => bindings}/_lib/dlfcn.pxd (100%) rename cuda/{ => bindings}/_lib/param_packer.cpp (100%) rename cuda/{ => bindings}/_lib/param_packer.h (100%) rename cuda/{ => bindings}/_lib/param_packer.pxd (100%) rename cuda/{ => bindings}/_lib/utils.pxd.in (100%) rename cuda/{ => bindings}/_lib/utils.pyx.in (100%) rename cuda/{ => bindings}/_version.py (100%) rename cuda/{ => bindings}/benchmarks/__init__.py (100%) rename cuda/{ => bindings}/benchmarks/kernels.py (100%) rename cuda/{ => bindings}/benchmarks/perf_test_utils.py (100%) rename cuda/{ => bindings}/benchmarks/test_cupy.py (100%) rename cuda/{ => bindings}/benchmarks/test_launch_latency.py (100%) rename cuda/{ => bindings}/benchmarks/test_numba.py (100%) rename cuda/{ => bindings}/benchmarks/test_pointer_attributes.py (100%) rename cuda/{ => bindings}/ccuda.pxd.in (100%) rename cuda/{ => bindings}/ccuda.pyx.in (100%) rename cuda/{ => bindings}/ccudart.pxd.in (100%) rename cuda/{ => bindings}/ccudart.pyx.in (100%) rename cuda/{ => bindings}/cnvrtc.pxd.in (100%) rename cuda/{ => bindings}/cnvrtc.pyx.in (100%) rename cuda/{ => bindings}/cuda.pxd.in (100%) rename cuda/{ => bindings}/cuda.pyx.in (100%) rename cuda/{ => bindings}/cudart.pxd.in (100%) rename cuda/{ => bindings}/cudart.pyx.in (100%) rename cuda/{ => bindings}/nvrtc.pxd.in (100%) rename cuda/{ => bindings}/nvrtc.pyx.in (100%) rename cuda/{ => bindings}/tests/__init__.py (100%) rename cuda/{ => bindings}/tests/test_ccuda.pyx (100%) rename cuda/{ => bindings}/tests/test_ccudart.pyx (100%) rename cuda/{ => bindings}/tests/test_cuda.py (100%) rename cuda/{ => bindings}/tests/test_cudart.py (100%) rename cuda/{ => bindings}/tests/test_cython.py (100%) rename cuda/{ => bindings}/tests/test_interoperability.py (100%) rename cuda/{ => bindings}/tests/test_interoperability_cython.pyx (100%) rename cuda/{ => bindings}/tests/test_kernelParams.py (100%) rename cuda/{ => bindings}/tests/test_nvrtc.py (100%) diff --git a/cuda/__init__.pxd b/cuda/bindings/__init__.pxd similarity index 100% rename from cuda/__init__.pxd rename to cuda/bindings/__init__.pxd diff --git a/cuda/__init__.py b/cuda/bindings/__init__.py similarity index 100% rename from cuda/__init__.py rename to cuda/bindings/__init__.py diff --git a/cuda/_cuda/__init__.py b/cuda/bindings/_cuda/__init__.py similarity index 100% rename from cuda/_cuda/__init__.py rename to cuda/bindings/_cuda/__init__.py diff --git a/cuda/_cuda/ccuda.pxd.in b/cuda/bindings/_cuda/ccuda.pxd.in similarity index 100% rename from cuda/_cuda/ccuda.pxd.in rename to cuda/bindings/_cuda/ccuda.pxd.in diff --git a/cuda/_cuda/ccuda.pyx.in b/cuda/bindings/_cuda/ccuda.pyx.in similarity index 100% rename from cuda/_cuda/ccuda.pyx.in rename to cuda/bindings/_cuda/ccuda.pyx.in diff --git a/cuda/_cuda/cnvrtc.pxd.in b/cuda/bindings/_cuda/cnvrtc.pxd.in similarity index 100% rename from cuda/_cuda/cnvrtc.pxd.in rename to cuda/bindings/_cuda/cnvrtc.pxd.in diff --git a/cuda/_cuda/cnvrtc.pyx.in b/cuda/bindings/_cuda/cnvrtc.pyx.in similarity index 100% rename from cuda/_cuda/cnvrtc.pyx.in rename to cuda/bindings/_cuda/cnvrtc.pyx.in diff --git a/cuda/_cuda/loader.cpp b/cuda/bindings/_cuda/loader.cpp similarity index 100% rename from cuda/_cuda/loader.cpp rename to cuda/bindings/_cuda/loader.cpp diff --git a/cuda/_cuda/loader.h b/cuda/bindings/_cuda/loader.h similarity index 100% rename from cuda/_cuda/loader.h rename to cuda/bindings/_cuda/loader.h diff --git a/cuda/_cuda/loader.pxd b/cuda/bindings/_cuda/loader.pxd similarity index 100% rename from cuda/_cuda/loader.pxd rename to cuda/bindings/_cuda/loader.pxd diff --git a/cuda/_lib/__init__.py b/cuda/bindings/_lib/__init__.py similarity index 100% rename from cuda/_lib/__init__.py rename to cuda/bindings/_lib/__init__.py diff --git a/cuda/_lib/ccudart/__init__.py b/cuda/bindings/_lib/ccudart/__init__.py similarity index 100% rename from cuda/_lib/ccudart/__init__.py rename to cuda/bindings/_lib/ccudart/__init__.py diff --git a/cuda/_lib/ccudart/ccudart.pxd.in b/cuda/bindings/_lib/ccudart/ccudart.pxd.in similarity index 100% rename from cuda/_lib/ccudart/ccudart.pxd.in rename to cuda/bindings/_lib/ccudart/ccudart.pxd.in diff --git a/cuda/_lib/ccudart/ccudart.pyx.in b/cuda/bindings/_lib/ccudart/ccudart.pyx.in similarity index 100% rename from cuda/_lib/ccudart/ccudart.pyx.in rename to cuda/bindings/_lib/ccudart/ccudart.pyx.in diff --git a/cuda/_lib/ccudart/utils.pxd.in b/cuda/bindings/_lib/ccudart/utils.pxd.in similarity index 100% rename from cuda/_lib/ccudart/utils.pxd.in rename to cuda/bindings/_lib/ccudart/utils.pxd.in diff --git a/cuda/_lib/ccudart/utils.pyx.in b/cuda/bindings/_lib/ccudart/utils.pyx.in similarity index 100% rename from cuda/_lib/ccudart/utils.pyx.in rename to cuda/bindings/_lib/ccudart/utils.pyx.in diff --git a/cuda/_lib/dlfcn.pxd b/cuda/bindings/_lib/dlfcn.pxd similarity index 100% rename from cuda/_lib/dlfcn.pxd rename to cuda/bindings/_lib/dlfcn.pxd diff --git a/cuda/_lib/param_packer.cpp b/cuda/bindings/_lib/param_packer.cpp similarity index 100% rename from cuda/_lib/param_packer.cpp rename to cuda/bindings/_lib/param_packer.cpp diff --git a/cuda/_lib/param_packer.h b/cuda/bindings/_lib/param_packer.h similarity index 100% rename from cuda/_lib/param_packer.h rename to cuda/bindings/_lib/param_packer.h diff --git a/cuda/_lib/param_packer.pxd b/cuda/bindings/_lib/param_packer.pxd similarity index 100% rename from cuda/_lib/param_packer.pxd rename to cuda/bindings/_lib/param_packer.pxd diff --git a/cuda/_lib/utils.pxd.in b/cuda/bindings/_lib/utils.pxd.in similarity index 100% rename from cuda/_lib/utils.pxd.in rename to cuda/bindings/_lib/utils.pxd.in diff --git a/cuda/_lib/utils.pyx.in b/cuda/bindings/_lib/utils.pyx.in similarity index 100% rename from cuda/_lib/utils.pyx.in rename to cuda/bindings/_lib/utils.pyx.in diff --git a/cuda/_version.py b/cuda/bindings/_version.py similarity index 100% rename from cuda/_version.py rename to cuda/bindings/_version.py diff --git a/cuda/benchmarks/__init__.py b/cuda/bindings/benchmarks/__init__.py similarity index 100% rename from cuda/benchmarks/__init__.py rename to cuda/bindings/benchmarks/__init__.py diff --git a/cuda/benchmarks/kernels.py b/cuda/bindings/benchmarks/kernels.py similarity index 100% rename from cuda/benchmarks/kernels.py rename to cuda/bindings/benchmarks/kernels.py diff --git a/cuda/benchmarks/perf_test_utils.py b/cuda/bindings/benchmarks/perf_test_utils.py similarity index 100% rename from cuda/benchmarks/perf_test_utils.py rename to cuda/bindings/benchmarks/perf_test_utils.py diff --git a/cuda/benchmarks/test_cupy.py b/cuda/bindings/benchmarks/test_cupy.py similarity index 100% rename from cuda/benchmarks/test_cupy.py rename to cuda/bindings/benchmarks/test_cupy.py diff --git a/cuda/benchmarks/test_launch_latency.py b/cuda/bindings/benchmarks/test_launch_latency.py similarity index 100% rename from cuda/benchmarks/test_launch_latency.py rename to cuda/bindings/benchmarks/test_launch_latency.py diff --git a/cuda/benchmarks/test_numba.py b/cuda/bindings/benchmarks/test_numba.py similarity index 100% rename from cuda/benchmarks/test_numba.py rename to cuda/bindings/benchmarks/test_numba.py diff --git a/cuda/benchmarks/test_pointer_attributes.py b/cuda/bindings/benchmarks/test_pointer_attributes.py similarity index 100% rename from cuda/benchmarks/test_pointer_attributes.py rename to cuda/bindings/benchmarks/test_pointer_attributes.py diff --git a/cuda/ccuda.pxd.in b/cuda/bindings/ccuda.pxd.in similarity index 100% rename from cuda/ccuda.pxd.in rename to cuda/bindings/ccuda.pxd.in diff --git a/cuda/ccuda.pyx.in b/cuda/bindings/ccuda.pyx.in similarity index 100% rename from cuda/ccuda.pyx.in rename to cuda/bindings/ccuda.pyx.in diff --git a/cuda/ccudart.pxd.in b/cuda/bindings/ccudart.pxd.in similarity index 100% rename from cuda/ccudart.pxd.in rename to cuda/bindings/ccudart.pxd.in diff --git a/cuda/ccudart.pyx.in b/cuda/bindings/ccudart.pyx.in similarity index 100% rename from cuda/ccudart.pyx.in rename to cuda/bindings/ccudart.pyx.in diff --git a/cuda/cnvrtc.pxd.in b/cuda/bindings/cnvrtc.pxd.in similarity index 100% rename from cuda/cnvrtc.pxd.in rename to cuda/bindings/cnvrtc.pxd.in diff --git a/cuda/cnvrtc.pyx.in b/cuda/bindings/cnvrtc.pyx.in similarity index 100% rename from cuda/cnvrtc.pyx.in rename to cuda/bindings/cnvrtc.pyx.in diff --git a/cuda/cuda.pxd.in b/cuda/bindings/cuda.pxd.in similarity index 100% rename from cuda/cuda.pxd.in rename to cuda/bindings/cuda.pxd.in diff --git a/cuda/cuda.pyx.in b/cuda/bindings/cuda.pyx.in similarity index 100% rename from cuda/cuda.pyx.in rename to cuda/bindings/cuda.pyx.in diff --git a/cuda/cudart.pxd.in b/cuda/bindings/cudart.pxd.in similarity index 100% rename from cuda/cudart.pxd.in rename to cuda/bindings/cudart.pxd.in diff --git a/cuda/cudart.pyx.in b/cuda/bindings/cudart.pyx.in similarity index 100% rename from cuda/cudart.pyx.in rename to cuda/bindings/cudart.pyx.in diff --git a/cuda/nvrtc.pxd.in b/cuda/bindings/nvrtc.pxd.in similarity index 100% rename from cuda/nvrtc.pxd.in rename to cuda/bindings/nvrtc.pxd.in diff --git a/cuda/nvrtc.pyx.in b/cuda/bindings/nvrtc.pyx.in similarity index 100% rename from cuda/nvrtc.pyx.in rename to cuda/bindings/nvrtc.pyx.in diff --git a/cuda/tests/__init__.py b/cuda/bindings/tests/__init__.py similarity index 100% rename from cuda/tests/__init__.py rename to cuda/bindings/tests/__init__.py diff --git a/cuda/tests/test_ccuda.pyx b/cuda/bindings/tests/test_ccuda.pyx similarity index 100% rename from cuda/tests/test_ccuda.pyx rename to cuda/bindings/tests/test_ccuda.pyx diff --git a/cuda/tests/test_ccudart.pyx b/cuda/bindings/tests/test_ccudart.pyx similarity index 100% rename from cuda/tests/test_ccudart.pyx rename to cuda/bindings/tests/test_ccudart.pyx diff --git a/cuda/tests/test_cuda.py b/cuda/bindings/tests/test_cuda.py similarity index 100% rename from cuda/tests/test_cuda.py rename to cuda/bindings/tests/test_cuda.py diff --git a/cuda/tests/test_cudart.py b/cuda/bindings/tests/test_cudart.py similarity index 100% rename from cuda/tests/test_cudart.py rename to cuda/bindings/tests/test_cudart.py diff --git a/cuda/tests/test_cython.py b/cuda/bindings/tests/test_cython.py similarity index 100% rename from cuda/tests/test_cython.py rename to cuda/bindings/tests/test_cython.py diff --git a/cuda/tests/test_interoperability.py b/cuda/bindings/tests/test_interoperability.py similarity index 100% rename from cuda/tests/test_interoperability.py rename to cuda/bindings/tests/test_interoperability.py diff --git a/cuda/tests/test_interoperability_cython.pyx b/cuda/bindings/tests/test_interoperability_cython.pyx similarity index 100% rename from cuda/tests/test_interoperability_cython.pyx rename to cuda/bindings/tests/test_interoperability_cython.pyx diff --git a/cuda/tests/test_kernelParams.py b/cuda/bindings/tests/test_kernelParams.py similarity index 100% rename from cuda/tests/test_kernelParams.py rename to cuda/bindings/tests/test_kernelParams.py diff --git a/cuda/tests/test_nvrtc.py b/cuda/bindings/tests/test_nvrtc.py similarity index 100% rename from cuda/tests/test_nvrtc.py rename to cuda/bindings/tests/test_nvrtc.py From 320b3005810173016f07a228f24635d4405c7158 Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Wed, 11 Sep 2024 04:26:04 +0000 Subject: [PATCH 02/14] rename Python & Cython modules --- cuda/bindings/{ccuda.pxd.in => cydriver.pxd.in} | 0 cuda/bindings/{ccuda.pyx.in => cydriver.pyx.in} | 0 cuda/bindings/{cnvrtc.pxd.in => cynvrtc.pxd.in} | 0 cuda/bindings/{cnvrtc.pyx.in => cynvrtc.pyx.in} | 0 cuda/bindings/{ccudart.pxd.in => cyruntime.pxd.in} | 0 cuda/bindings/{ccudart.pyx.in => cyruntime.pyx.in} | 0 cuda/bindings/{cuda.pxd.in => driver.pxd.in} | 0 cuda/bindings/{cuda.pyx.in => driver.pyx.in} | 0 cuda/bindings/{cudart.pxd.in => runtime.pxd.in} | 0 cuda/bindings/{cudart.pyx.in => runtime.pyx.in} | 0 10 files changed, 0 insertions(+), 0 deletions(-) rename cuda/bindings/{ccuda.pxd.in => cydriver.pxd.in} (100%) rename cuda/bindings/{ccuda.pyx.in => cydriver.pyx.in} (100%) rename cuda/bindings/{cnvrtc.pxd.in => cynvrtc.pxd.in} (100%) rename cuda/bindings/{cnvrtc.pyx.in => cynvrtc.pyx.in} (100%) rename cuda/bindings/{ccudart.pxd.in => cyruntime.pxd.in} (100%) rename cuda/bindings/{ccudart.pyx.in => cyruntime.pyx.in} (100%) rename cuda/bindings/{cuda.pxd.in => driver.pxd.in} (100%) rename cuda/bindings/{cuda.pyx.in => driver.pyx.in} (100%) rename cuda/bindings/{cudart.pxd.in => runtime.pxd.in} (100%) rename cuda/bindings/{cudart.pyx.in => runtime.pyx.in} (100%) diff --git a/cuda/bindings/ccuda.pxd.in b/cuda/bindings/cydriver.pxd.in similarity index 100% rename from cuda/bindings/ccuda.pxd.in rename to cuda/bindings/cydriver.pxd.in diff --git a/cuda/bindings/ccuda.pyx.in b/cuda/bindings/cydriver.pyx.in similarity index 100% rename from cuda/bindings/ccuda.pyx.in rename to cuda/bindings/cydriver.pyx.in diff --git a/cuda/bindings/cnvrtc.pxd.in b/cuda/bindings/cynvrtc.pxd.in similarity index 100% rename from cuda/bindings/cnvrtc.pxd.in rename to cuda/bindings/cynvrtc.pxd.in diff --git a/cuda/bindings/cnvrtc.pyx.in b/cuda/bindings/cynvrtc.pyx.in similarity index 100% rename from cuda/bindings/cnvrtc.pyx.in rename to cuda/bindings/cynvrtc.pyx.in diff --git a/cuda/bindings/ccudart.pxd.in b/cuda/bindings/cyruntime.pxd.in similarity index 100% rename from cuda/bindings/ccudart.pxd.in rename to cuda/bindings/cyruntime.pxd.in diff --git a/cuda/bindings/ccudart.pyx.in b/cuda/bindings/cyruntime.pyx.in similarity index 100% rename from cuda/bindings/ccudart.pyx.in rename to cuda/bindings/cyruntime.pyx.in diff --git a/cuda/bindings/cuda.pxd.in b/cuda/bindings/driver.pxd.in similarity index 100% rename from cuda/bindings/cuda.pxd.in rename to cuda/bindings/driver.pxd.in diff --git a/cuda/bindings/cuda.pyx.in b/cuda/bindings/driver.pyx.in similarity index 100% rename from cuda/bindings/cuda.pyx.in rename to cuda/bindings/driver.pyx.in diff --git a/cuda/bindings/cudart.pxd.in b/cuda/bindings/runtime.pxd.in similarity index 100% rename from cuda/bindings/cudart.pxd.in rename to cuda/bindings/runtime.pxd.in diff --git a/cuda/bindings/cudart.pyx.in b/cuda/bindings/runtime.pyx.in similarity index 100% rename from cuda/bindings/cudart.pyx.in rename to cuda/bindings/runtime.pyx.in From 511e7882db0fae3612cf3a5de101b01b86be8fd7 Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Wed, 11 Sep 2024 04:32:25 +0000 Subject: [PATCH 03/14] move all relevant contents to under the namespace package --- cuda/LICENSE | 48 ++++++++++++++ MANIFEST.in => cuda/MANIFEST.in | 0 cuda/README.md | 76 +++++++++++++++++++++++ pyproject.toml => cuda/pyproject.toml | 0 pytest.ini => cuda/pytest.ini | 0 requirements.txt => cuda/requirements.txt | 0 setup.py => cuda/setup.py | 0 7 files changed, 124 insertions(+) create mode 100644 cuda/LICENSE rename MANIFEST.in => cuda/MANIFEST.in (100%) create mode 100644 cuda/README.md rename pyproject.toml => cuda/pyproject.toml (100%) rename pytest.ini => cuda/pytest.ini (100%) rename requirements.txt => cuda/requirements.txt (100%) rename setup.py => cuda/setup.py (100%) diff --git a/cuda/LICENSE b/cuda/LICENSE new file mode 100644 index 00000000000..b7d042fcee3 --- /dev/null +++ b/cuda/LICENSE @@ -0,0 +1,48 @@ +NVIDIA SOFTWARE LICENSE + +This license is a legal agreement between you and NVIDIA Corporation ("NVIDIA") and governs your use of the NVIDIA CUDA Python software and materials provided hereunder ("SOFTWARE"). + +This license can be accepted only by an adult of legal age of majority in the country in which the SOFTWARE is used. If you are under the legal age of majority, you must ask your parent or legal guardian to consent to this license. By taking delivery of the SOFTWARE, you affirm that you have reached the legal age of majority, you accept the terms of this license, and you take legal and financial responsibility for the actions of your permitted users. + +You agree to use the SOFTWARE only for purposes that are permitted by (a) this license, and (b) any applicable law, regulation or generally accepted practices or guidelines in the relevant jurisdictions. + +1. LICENSE. Subject to the terms of this license, NVIDIA grants you a non-exclusive limited license to: (a) install and use the SOFTWARE, and (b) distribute the SOFTWARE subject to the distribution requirements described in this license. NVIDIA reserves all rights, title and interest in and to the SOFTWARE not expressly granted to you under this license. + +2. DISTRIBUTION REQUIREMENTS. These are the distribution requirements for you to exercise the distribution grant: +a. The terms under which you distribute the SOFTWARE must be consistent with the terms of this license, including (without limitation) terms relating to the license grant and license restrictions and protection of NVIDIA's intellectual property rights. +b. You agree to notify NVIDIA in writing of any known or suspected distribution or use of the SOFTWARE not in compliance with the requirements of this license, and to enforce the terms of your agreements with respect to distributed SOFTWARE. + +3. LIMITATIONS. Your license to use the SOFTWARE is restricted as follows: +a. The SOFTWARE is licensed for you to develop applications only for use in systems with NVIDIA GPUs. +b. You may not reverse engineer, decompile or disassemble, or remove copyright or other proprietary notices from any portion of the SOFTWARE or copies of the SOFTWARE. +c. You may not modify or create derivative works of any portion of the SOFTWARE. +d. You may not bypass, disable, or circumvent any technical measure, encryption, security, digital rights management or authentication mechanism in the SOFTWARE. +e. You may not use the SOFTWARE in any manner that would cause it to become subject to an open source software license. As examples, licenses that require as a condition of use, modification, and/or distribution that the SOFTWARE be (i) disclosed or distributed in source code form; (ii) licensed for the purpose of making derivative works; or (iii) redistributable at no charge. +f. Unless you have an agreement with NVIDIA for this purpose, you may not use the SOFTWARE with any system or application where the use or failure of the system or application can reasonably be expected to threaten or result in personal injury, death, or catastrophic loss. Examples include use in avionics, navigation, military, medical, life support or other life critical applications. NVIDIA does not design, test or manufacture the SOFTWARE for these critical uses and NVIDIA shall not be liable to you or any third party, in whole or in part, for any claims or damages arising from such uses. +g. You agree to defend, indemnify and hold harmless NVIDIA and its affiliates, and their respective employees, contractors, agents, officers and directors, from and against any and all claims, damages, obligations, losses, liabilities, costs or debt, fines, restitutions and expenses (including but not limited to attorney's fees and costs incident to establishing the right of indemnification) arising out of or related to use of the SOFTWARE outside of the scope of this Agreement, or not in compliance with its terms. + +4. PRE-RELEASE. SOFTWARE versions identified as alpha, beta, preview, early access or otherwise as pre-release may not be fully functional, may contain errors or design flaws, and may have reduced or different security, privacy, availability, and reliability standards relative to commercial versions of NVIDIA software and materials. You may use a pre-release SOFTWARE version at your own risk, understanding that these versions are not intended for use in production or business-critical systems. + +5. OWNERSHIP. The SOFTWARE and the related intellectual property rights therein are and will remain the sole and exclusive property of NVIDIA or its licensors. The SOFTWARE is copyrighted and protected by the laws of the United States and other countries, and international treaty provisions. NVIDIA may make changes to the SOFTWARE, at any time without notice, but is not obligated to support or update the SOFTWARE. + +6. COMPONENTS UNDER OTHER LICENSES. The SOFTWARE may include NVIDIA or third-party components with separate legal notices or terms as may be described in proprietary notices accompanying the SOFTWARE. If and to the extent there is a conflict between the terms in this license and the license terms associated with a component, the license terms associated with the components control only to the extent necessary to resolve the conflict. + +7. FEEDBACK. You may, but don't have to, provide to NVIDIA any Feedback. "Feedback" means any suggestions, bug fixes, enhancements, modifications, feature requests or other feedback regarding the SOFTWARE. For any Feedback that you voluntarily provide, you hereby grant NVIDIA and its affiliates a perpetual, non-exclusive, worldwide, irrevocable license to use, reproduce, modify, license, sublicense (through multiple tiers of sublicensees), and distribute (through multiple tiers of distributors) the Feedback without the payment of any royalties or fees to you. NVIDIA will use Feedback at its choice. + +8. NO WARRANTIES. THE SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY OF ANY KIND INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, OR FITNESS FOR A PARTICULAR PURPOSE. NVIDIA DOES NOT WARRANT THAT THE SOFTWARE WILL MEET YOUR REQUIREMENTS OR THAT THE OPERATION THEREOF WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ALL ERRORS WILL BE CORRECTED. + +9. LIMITATIONS OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY LAW, NVIDIA AND ITS AFFILIATES SHALL NOT BE LIABLE FOR ANY SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL DAMAGES, OR ANY LOST PROFITS, PROJECT DELAYS, LOSS OF USE, LOSS OF DATA OR LOSS OF GOODWILL, OR THE COSTS OF PROCURING SUBSTITUTE PRODUCTS, ARISING OUT OF OR IN CONNECTION WITH THIS LICENSE OR THE USE OR PERFORMANCE OF THE SOFTWARE, WHETHER SUCH LIABILITY ARISES FROM ANY CLAIM BASED UPON BREACH OF CONTRACT, BREACH OF WARRANTY, TORT (INCLUDING NEGLIGENCE), PRODUCT LIABILITY OR ANY OTHER CAUSE OF ACTION OR THEORY OF LIABILITY, EVEN IF NVIDIA HAS PREVIOUSLY BEEN ADVISED OF, OR COULD REASONABLY HAVE FORESEEN, THE POSSIBILITY OF SUCH DAMAGES. IN NO EVENT WILL NVIDIA'S AND ITS AFFILIATES TOTAL CUMULATIVE LIABILITY UNDER OR ARISING OUT OF THIS LICENSE EXCEED US$10.00. THE NATURE OF THE LIABILITY OR THE NUMBER OF CLAIMS OR SUITS SHALL NOT ENLARGE OR EXTEND THIS LIMIT. + +10. TERMINATION. Your rights under this license will terminate automatically without notice from NVIDIA if you fail to comply with any term and condition of this license or if you commence or participate in any legal proceeding against NVIDIA with respect to the SOFTWARE. NVIDIA may terminate this license with advance written notice to you if NVIDIA decides to no longer provide the SOFTWARE in a country or, in NVIDIA's sole discretion, the continued use of it is no longer commercially viable. Upon any termination of this license, you agree to promptly discontinue use of the SOFTWARE and destroy all copies in your possession or control. Your prior distributions in accordance with this license are not affected by the termination of this license. All provisions of this license will survive termination, except for the license granted to you. + +11. APPLICABLE LAW. This license will be governed in all respects by the laws of the United States and of the State of Delaware as those laws are applied to contracts entered into and performed entirely within Delaware by Delaware residents, without regard to the conflicts of laws principles. The United Nations Convention on Contracts for the International Sale of Goods is specifically disclaimed. You agree to all terms of this Agreement in the English language. The state or federal courts residing in Santa Clara County, California shall have exclusive jurisdiction over any dispute or claim arising out of this license. Notwithstanding this, you agree that NVIDIA shall still be allowed to apply for injunctive remedies or an equivalent type of urgent legal relief in any jurisdiction. + +12. NO ASSIGNMENT. This license and your rights and obligations thereunder may not be assigned by you by any means or operation of law without NVIDIA's permission. Any attempted assignment not approved by NVIDIA in writing shall be void and of no effect. + +13. EXPORT. The SOFTWARE is subject to United States export laws and regulations. You agree that you will not ship, transfer or export the SOFTWARE into any country, or use the SOFTWARE in any manner, prohibited by the United States Bureau of Industry and Security or economic sanctions regulations administered by the U.S. Department of Treasury's Office of Foreign Assets Control (OFAC), or any applicable export laws, restrictions or regulations. These laws include restrictions on destinations, end users and end use. By accepting this license, you confirm that you are not a resident or citizen of any country currently embargoed by the U.S. and that you are not otherwise prohibited from receiving the SOFTWARE. + +14. GOVERNMENT USE. The SOFTWARE has been developed entirely at private expense and is "commercial items" consisting of "commercial computer software" and "commercial computer software documentation" provided with RESTRICTED RIGHTS. Use, duplication or disclosure by the U.S. Government or a U.S. Government subcontractor is subject to the restrictions in this license pursuant to DFARS 227.7202-3(a) or as set forth in subparagraphs (b)(1) and (2) of the Commercial Computer Software - Restricted Rights clause at FAR 52.227-19, as applicable. Contractor/manufacturer is NVIDIA, 2788 San Tomas Expressway, Santa Clara, CA 95051. + +15. ENTIRE AGREEMENT. This license is the final, complete and exclusive agreement between the parties relating to the subject matter of this license and supersedes all prior or contemporaneous understandings and agreements relating to this subject matter, whether oral or written. If any court of competent jurisdiction determines that any provision of this license is illegal, invalid or unenforceable, the remaining provisions will remain in full force and effect. This license may only be modified in a writing signed by an authorized representative of each party. + +(v. May 12, 2021) diff --git a/MANIFEST.in b/cuda/MANIFEST.in similarity index 100% rename from MANIFEST.in rename to cuda/MANIFEST.in diff --git a/cuda/README.md b/cuda/README.md new file mode 100644 index 00000000000..1cbafb562d5 --- /dev/null +++ b/cuda/README.md @@ -0,0 +1,76 @@ +# CUDA-Python + +CUDA Python is a standard set of low-level interfaces, providing full coverage of and access to the CUDA host APIs from Python. Checkout the [Overview](https://nvidia.github.io/cuda-python/overview.html) for the workflow and performance results. + +## Installing + +CUDA Python can be installed from: + +* PYPI +* Conda (nvidia channel) +* Source builds + +There're differences in each of these options that are described further in [Installation](https://nvidia.github.io/cuda-python/install.html) documentation. Each package will guarantee minor version compatibility. + +## Runtime Dependencies + +CUDA Python is supported on all platforms that CUDA is supported. Specific dependencies are as follows: + +* Driver: Linux (450.80.02 or later) Windows (456.38 or later) +* CUDA Toolkit 12.0 to 12.6 + +Only the NVRTC redistributable component is required from the CUDA Toolkit. [CUDA Toolkit Documentation](https://docs.nvidia.com/cuda/index.html) Installation Guides can be used for guidance. Note that the NVRTC component in the Toolkit can be obtained via PYPI, Conda or Local Installer. + +### Supported Python Versions + +CUDA Python follows [NEP 29](https://numpy.org/neps/nep-0029-deprecation_policy.html) for supported Python version guarantee. + +Before dropping support, an issue will be raised to look for feedback. + +Source builds work for multiple Python versions, however pre-build PyPI and Conda packages are only provided for a subset: + +* Python 3.9 to 3.12 + +## Testing + +### Requirements + +Latest dependencies can be found in [requirements.txt](https://github.com/NVIDIA/cuda-python/blob/main/requirements.txt). + +### Unit-tests + +You can run the included tests with: + +``` +python -m pytest +``` + +### Benchmark + +You can run benchmark only tests with: + +``` +python -m pytest --benchmark-only +``` + +### Samples + +You can run the included tests with: + +``` +python -m pytest examples +``` + +## Examples + +CUDA Samples rewriten using CUDA Python are found in `examples`. + +Custom extra included examples: + +- `examples/extra/jit_program_test.py`: Demonstrates the use of the API to compile and + launch a kernel on the device. Includes device memory allocation / + deallocation, transfers between host and device, creation and usage of + streams, and context management. +- `examples/extra/numba_emm_plugin.py`: Implements a Numba External Memory Management + plugin, showing that this CUDA Python Driver API can coexist with other + wrappers of the driver API. diff --git a/pyproject.toml b/cuda/pyproject.toml similarity index 100% rename from pyproject.toml rename to cuda/pyproject.toml diff --git a/pytest.ini b/cuda/pytest.ini similarity index 100% rename from pytest.ini rename to cuda/pytest.ini diff --git a/requirements.txt b/cuda/requirements.txt similarity index 100% rename from requirements.txt rename to cuda/requirements.txt diff --git a/setup.py b/cuda/setup.py similarity index 100% rename from setup.py rename to cuda/setup.py From 7681498009dbd401ec407c4e3856b06a9979498d Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Wed, 11 Sep 2024 04:49:57 +0000 Subject: [PATCH 04/14] add redirection layers with build-/run- time warnings --- cuda/bindings/ccuda.pxd | 7 +++++++ cuda/bindings/ccuda.pyx | 8 ++++++++ cuda/bindings/ccudart.pxd | 7 +++++++ cuda/bindings/ccudart.pyx | 7 +++++++ cuda/bindings/cnvrtc.pxd | 7 +++++++ cuda/bindings/cnvrtc.pyx | 8 ++++++++ cuda/bindings/cuda.pxd | 7 +++++++ cuda/bindings/cuda.pyx | 14 ++++++++++++++ cuda/bindings/cudart.pxd | 7 +++++++ cuda/bindings/cudart.pyx | 14 ++++++++++++++ 10 files changed, 86 insertions(+) create mode 100644 cuda/bindings/ccuda.pxd create mode 100644 cuda/bindings/ccuda.pyx create mode 100644 cuda/bindings/ccudart.pxd create mode 100644 cuda/bindings/ccudart.pyx create mode 100644 cuda/bindings/cnvrtc.pxd create mode 100644 cuda/bindings/cnvrtc.pyx create mode 100644 cuda/bindings/cuda.pxd create mode 100644 cuda/bindings/cuda.pyx create mode 100644 cuda/bindings/cudart.pxd create mode 100644 cuda/bindings/cudart.pyx diff --git a/cuda/bindings/ccuda.pxd b/cuda/bindings/ccuda.pxd new file mode 100644 index 00000000000..090a02be274 --- /dev/null +++ b/cuda/bindings/ccuda.pxd @@ -0,0 +1,7 @@ +from .cydriver cimport * + +cdef extern from *: + """ + #pragma message ( "The cuda.ccuda module is deprecated and will be removed in a future release, " + "please switch to use the cuda.bindings.cydriver module instead." ) + """ diff --git a/cuda/bindings/ccuda.pyx b/cuda/bindings/ccuda.pyx new file mode 100644 index 00000000000..7dec5bb2b37 --- /dev/null +++ b/cuda/bindings/ccuda.pyx @@ -0,0 +1,8 @@ +from .cydriver cimport * + + +cdef extern from *: + """ + #pragma message ( "The cuda.ccuda module is deprecated and will be removed in a future release, " + "please switch to use the cuda.bindings.cydriver module instead." ) + """ diff --git a/cuda/bindings/ccudart.pxd b/cuda/bindings/ccudart.pxd new file mode 100644 index 00000000000..0a1c8aa9a88 --- /dev/null +++ b/cuda/bindings/ccudart.pxd @@ -0,0 +1,7 @@ +from .cyruntime cimport * + +cdef extern from *: + """ + #pragma message ( "The cuda.ccudart module is deprecated and will be removed in a future release, " + "please switch to use the cuda.bindings.cyruntime module instead." ) + """ diff --git a/cuda/bindings/ccudart.pyx b/cuda/bindings/ccudart.pyx new file mode 100644 index 00000000000..0a1c8aa9a88 --- /dev/null +++ b/cuda/bindings/ccudart.pyx @@ -0,0 +1,7 @@ +from .cyruntime cimport * + +cdef extern from *: + """ + #pragma message ( "The cuda.ccudart module is deprecated and will be removed in a future release, " + "please switch to use the cuda.bindings.cyruntime module instead." ) + """ diff --git a/cuda/bindings/cnvrtc.pxd b/cuda/bindings/cnvrtc.pxd new file mode 100644 index 00000000000..1366a5aa9c4 --- /dev/null +++ b/cuda/bindings/cnvrtc.pxd @@ -0,0 +1,7 @@ +from .cynvrtc cimport * + +cdef extern from *: + """ + #pragma message ( "The cuda.cnvrtc module is deprecated and will be removed in a future release, " + "please switch to use the cuda.bindings.cynvrtc module instead." ) + """ diff --git a/cuda/bindings/cnvrtc.pyx b/cuda/bindings/cnvrtc.pyx new file mode 100644 index 00000000000..2be3c160c6e --- /dev/null +++ b/cuda/bindings/cnvrtc.pyx @@ -0,0 +1,8 @@ +from .cynvrtc cimport * + + +cdef extern from *: + """ + #pragma message ( "The cuda.cnvrtc module is deprecated and will be removed in a future release, " + "please switch to use the cuda.bindings.cynvrtc module instead." ) + """ diff --git a/cuda/bindings/cuda.pxd b/cuda/bindings/cuda.pxd new file mode 100644 index 00000000000..f84eb95c514 --- /dev/null +++ b/cuda/bindings/cuda.pxd @@ -0,0 +1,7 @@ +from .driver cimport * + +cdef extern from *: + """ + #pragma message ( "The cuda.cuda module is deprecated and will be removed in a future release, " + "please switch to use the cuda.bindings.driver module instead." ) + """ diff --git a/cuda/bindings/cuda.pyx b/cuda/bindings/cuda.pyx new file mode 100644 index 00000000000..dec449525a0 --- /dev/null +++ b/cuda/bindings/cuda.pyx @@ -0,0 +1,14 @@ +from .driver import * + +import warnings + + +cdef extern from *: + """ + #pragma message ( "The cuda.cuda module is deprecated and will be removed in a future release, " + "please switch to use the cuda.bindings.driver module instead." ) + """ + + +warnings.warn("The cuda.cuda module is deprecated and will be removed in a future release, " + "please switch to use the cuda.bindings.driver module instead.", DeprecationWarning, stacklevel=2) diff --git a/cuda/bindings/cudart.pxd b/cuda/bindings/cudart.pxd new file mode 100644 index 00000000000..e1359131d10 --- /dev/null +++ b/cuda/bindings/cudart.pxd @@ -0,0 +1,7 @@ +from .runtime cimport * + +cdef extern from *: + """ + #pragma message ( "The cuda.cudart module is deprecated and will be removed in a future release, " + "please switch to use the cuda.bindings.runtime module instead." ) + """ diff --git a/cuda/bindings/cudart.pyx b/cuda/bindings/cudart.pyx new file mode 100644 index 00000000000..66100fd6087 --- /dev/null +++ b/cuda/bindings/cudart.pyx @@ -0,0 +1,14 @@ +from .runtime import * + +import warnings + + +cdef extern from *: + """ + #pragma message ( "The cuda.cudart module is deprecated and will be removed in a future release, " + "please switch to use the cuda.bindings.runtime module instead." ) + """ + + +warnings.warn("The cuda.cudart module is deprecated and will be removed in a future release, " + "please switch to use the cuda.bindings.runtime module instead.", DeprecationWarning, stacklevel=2) From b4a43cbb9addb673e7eacb90b2bfdbf76744872d Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Wed, 11 Sep 2024 04:55:20 +0000 Subject: [PATCH 05/14] update cimport paths --- cuda/bindings/cydriver.pyx.in | 2 +- cuda/bindings/cynvrtc.pyx.in | 2 +- cuda/bindings/cyruntime.pyx.in | 6 +++--- cuda/bindings/driver.pxd.in | 4 ++-- cuda/bindings/nvrtc.pxd.in | 4 ++-- cuda/bindings/runtime.pxd.in | 6 +++--- cuda/bindings/runtime.pyx.in | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cuda/bindings/cydriver.pyx.in b/cuda/bindings/cydriver.pyx.in index 48c06b5b279..d20d0773d75 100644 --- a/cuda/bindings/cydriver.pyx.in +++ b/cuda/bindings/cydriver.pyx.in @@ -5,7 +5,7 @@ # this software. Any use, reproduction, disclosure, or distribution of # this software and related documentation outside the terms of the EULA # is strictly prohibited. -cimport cuda._cuda.ccuda as ccuda +cimport cuda.bindings._cuda.ccuda as ccuda {{if 'cuGetErrorString' in found_functions}} diff --git a/cuda/bindings/cynvrtc.pyx.in b/cuda/bindings/cynvrtc.pyx.in index 9781b65fd8f..875e7ce9f32 100644 --- a/cuda/bindings/cynvrtc.pyx.in +++ b/cuda/bindings/cynvrtc.pyx.in @@ -5,7 +5,7 @@ # this software. Any use, reproduction, disclosure, or distribution of # this software and related documentation outside the terms of the EULA # is strictly prohibited. -cimport cuda._cuda.cnvrtc as cnvrtc +cimport cuda.bindings._cuda.cnvrtc as cnvrtc {{if 'nvrtcGetErrorString' in found_functions}} diff --git a/cuda/bindings/cyruntime.pyx.in b/cuda/bindings/cyruntime.pyx.in index 85acc7713de..98e5476e874 100644 --- a/cuda/bindings/cyruntime.pyx.in +++ b/cuda/bindings/cyruntime.pyx.in @@ -8,9 +8,9 @@ # cython: show_performance_hints=False -cimport cuda._cuda.ccuda as ccuda -from cuda._lib.ccudart.ccudart cimport * -from cuda._lib.ccudart.utils cimport * +cimport cuda.bindings._cuda.ccuda as ccuda +from cuda.bindings._lib.ccudart.ccudart cimport * +from cuda.bindings._lib.ccudart.utils cimport * from libc.stdlib cimport malloc, free, calloc from libc cimport string from libcpp cimport bool diff --git a/cuda/bindings/driver.pxd.in b/cuda/bindings/driver.pxd.in index 265b6dd3cd1..a5283d11291 100644 --- a/cuda/bindings/driver.pxd.in +++ b/cuda/bindings/driver.pxd.in @@ -5,8 +5,8 @@ # this software. Any use, reproduction, disclosure, or distribution of # this software and related documentation outside the terms of the EULA # is strictly prohibited. -cimport cuda.ccuda as ccuda -cimport cuda._lib.utils as utils +cimport cuda.bindings.cydriver as ccuda +cimport cuda.bindings._lib.utils as utils {{if 'CUcontext' in found_types}} diff --git a/cuda/bindings/nvrtc.pxd.in b/cuda/bindings/nvrtc.pxd.in index 10731987b8b..33b77e87ad0 100644 --- a/cuda/bindings/nvrtc.pxd.in +++ b/cuda/bindings/nvrtc.pxd.in @@ -5,8 +5,8 @@ # this software. Any use, reproduction, disclosure, or distribution of # this software and related documentation outside the terms of the EULA # is strictly prohibited. -cimport cuda.cnvrtc as cnvrtc -cimport cuda._lib.utils as utils +cimport cuda.bindings.cynvrtc as cnvrtc +cimport cuda.bindings._lib.utils as utils {{if 'nvrtcProgram' in found_types}} diff --git a/cuda/bindings/runtime.pxd.in b/cuda/bindings/runtime.pxd.in index 9db3286ad18..1155e64cb0b 100644 --- a/cuda/bindings/runtime.pxd.in +++ b/cuda/bindings/runtime.pxd.in @@ -5,9 +5,9 @@ # this software. Any use, reproduction, disclosure, or distribution of # this software and related documentation outside the terms of the EULA # is strictly prohibited. -cimport cuda.ccudart as ccudart -cimport cuda._lib.utils as utils -cimport cuda.cuda as cuda +cimport cuda.bindings.cycudart as ccudart +cimport cuda.bindings._lib.utils as utils +cimport cuda.bindings.driver as cuda {{if 'cudaArray_t' in found_types}} diff --git a/cuda/bindings/runtime.pyx.in b/cuda/bindings/runtime.pyx.in index 5b868d98666..c58817bf8f6 100644 --- a/cuda/bindings/runtime.pyx.in +++ b/cuda/bindings/runtime.pyx.in @@ -17,7 +17,7 @@ from libc.limits cimport CHAR_MIN from libcpp.vector cimport vector from cpython.buffer cimport PyObject_CheckBuffer, PyObject_GetBuffer, PyBuffer_Release, PyBUF_SIMPLE, PyBUF_ANY_CONTIGUOUS from cpython.bytes cimport PyBytes_FromStringAndSize -import cuda.cuda +import cuda.bindings.driver ctypedef unsigned long long signed_char_ptr ctypedef unsigned long long unsigned_char_ptr From c4a59f13c99841decc95c60d67e3e738c812f60b Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Wed, 11 Sep 2024 06:22:44 +0000 Subject: [PATCH 06/14] more fixes to layout/import --- cuda/{ => cuda}/bindings/__init__.pxd | 0 cuda/{ => cuda}/bindings/__init__.py | 0 cuda/{ => cuda}/bindings/_cuda/__init__.py | 0 cuda/{ => cuda}/bindings/_cuda/ccuda.pxd.in | 2 +- cuda/{ => cuda}/bindings/_cuda/ccuda.pyx.in | 4 ++-- cuda/{ => cuda}/bindings/_cuda/cnvrtc.pxd.in | 2 +- cuda/{ => cuda}/bindings/_cuda/cnvrtc.pyx.in | 2 +- cuda/{ => cuda}/bindings/_cuda/loader.cpp | 0 cuda/{ => cuda}/bindings/_cuda/loader.h | 0 cuda/{ => cuda}/bindings/_cuda/loader.pxd | 0 cuda/{ => cuda}/bindings/_lib/__init__.py | 0 cuda/{ => cuda}/bindings/_lib/ccudart/__init__.py | 0 .../bindings/_lib/ccudart/ccudart.pxd.in | 4 ++-- .../bindings/_lib/ccudart/ccudart.pyx.in | 8 ++++---- cuda/{ => cuda}/bindings/_lib/ccudart/utils.pxd.in | 4 ++-- cuda/{ => cuda}/bindings/_lib/ccudart/utils.pyx.in | 4 ++-- cuda/{ => cuda}/bindings/_lib/dlfcn.pxd | 0 cuda/{ => cuda}/bindings/_lib/param_packer.cpp | 0 cuda/{ => cuda}/bindings/_lib/param_packer.h | 0 cuda/{ => cuda}/bindings/_lib/param_packer.pxd | 0 cuda/{ => cuda}/bindings/_lib/utils.pxd.in | 4 ++-- cuda/{ => cuda}/bindings/_lib/utils.pyx.in | 6 +++--- cuda/{ => cuda}/bindings/_version.py | 0 cuda/{ => cuda}/bindings/benchmarks/__init__.py | 0 cuda/{ => cuda}/bindings/benchmarks/kernels.py | 0 .../bindings/benchmarks/perf_test_utils.py | 0 cuda/{ => cuda}/bindings/benchmarks/test_cupy.py | 0 .../bindings/benchmarks/test_launch_latency.py | 0 cuda/{ => cuda}/bindings/benchmarks/test_numba.py | 0 .../bindings/benchmarks/test_pointer_attributes.py | 0 cuda/{ => cuda}/bindings/cydriver.pxd.in | 0 cuda/{ => cuda}/bindings/cydriver.pyx.in | 0 cuda/{ => cuda}/bindings/cynvrtc.pxd.in | 0 cuda/{ => cuda}/bindings/cynvrtc.pyx.in | 0 cuda/{ => cuda}/bindings/cyruntime.pxd.in | 0 cuda/{ => cuda}/bindings/cyruntime.pyx.in | 0 cuda/{ => cuda}/bindings/driver.pxd.in | 0 cuda/{ => cuda}/bindings/driver.pyx.in | 0 cuda/{ => cuda}/bindings/nvrtc.pxd.in | 0 cuda/{ => cuda}/bindings/nvrtc.pyx.in | 0 cuda/{ => cuda}/bindings/runtime.pxd.in | 2 +- cuda/{ => cuda}/bindings/runtime.pyx.in | 0 cuda/{ => cuda}/bindings/tests/__init__.py | 0 cuda/{ => cuda}/bindings/tests/test_ccuda.pyx | 0 cuda/{ => cuda}/bindings/tests/test_ccudart.pyx | 0 cuda/{ => cuda}/bindings/tests/test_cuda.py | 0 cuda/{ => cuda}/bindings/tests/test_cudart.py | 0 cuda/{ => cuda}/bindings/tests/test_cython.py | 0 .../bindings/tests/test_interoperability.py | 0 .../tests/test_interoperability_cython.pyx | 0 .../{ => cuda}/bindings/tests/test_kernelParams.py | 0 cuda/{ => cuda}/bindings/tests/test_nvrtc.py | 0 cuda/{bindings => cuda}/ccuda.pxd | 4 ++-- cuda/{bindings => cuda}/ccuda.pyx | 4 ++-- cuda/{bindings => cuda}/ccudart.pxd | 4 ++-- cuda/{bindings => cuda}/ccudart.pyx | 4 ++-- cuda/{bindings => cuda}/cnvrtc.pxd | 4 ++-- cuda/{bindings => cuda}/cnvrtc.pyx | 4 ++-- cuda/{bindings => cuda}/cuda.pxd | 4 ++-- cuda/{bindings => cuda}/cuda.pyx | 4 ++-- cuda/{bindings => cuda}/cudart.pxd | 4 ++-- cuda/{bindings => cuda}/cudart.pyx | 4 ++-- cuda/cuda/nvrtc.pxd | 7 +++++++ cuda/cuda/nvrtc.pyx | 14 ++++++++++++++ 64 files changed, 62 insertions(+), 41 deletions(-) rename cuda/{ => cuda}/bindings/__init__.pxd (100%) rename cuda/{ => cuda}/bindings/__init__.py (100%) rename cuda/{ => cuda}/bindings/_cuda/__init__.py (100%) rename cuda/{ => cuda}/bindings/_cuda/ccuda.pxd.in (99%) rename cuda/{ => cuda}/bindings/_cuda/ccuda.pyx.in (99%) rename cuda/{ => cuda}/bindings/_cuda/cnvrtc.pxd.in (99%) rename cuda/{ => cuda}/bindings/_cuda/cnvrtc.pyx.in (99%) rename cuda/{ => cuda}/bindings/_cuda/loader.cpp (100%) rename cuda/{ => cuda}/bindings/_cuda/loader.h (100%) rename cuda/{ => cuda}/bindings/_cuda/loader.pxd (100%) rename cuda/{ => cuda}/bindings/_lib/__init__.py (100%) rename cuda/{ => cuda}/bindings/_lib/ccudart/__init__.py (100%) rename cuda/{ => cuda}/bindings/_lib/ccudart/ccudart.pxd.in (99%) rename cuda/{ => cuda}/bindings/_lib/ccudart/ccudart.pyx.in (99%) rename cuda/{ => cuda}/bindings/_lib/ccudart/utils.pxd.in (99%) rename cuda/{ => cuda}/bindings/_lib/ccudart/utils.pyx.in (99%) rename cuda/{ => cuda}/bindings/_lib/dlfcn.pxd (100%) rename cuda/{ => cuda}/bindings/_lib/param_packer.cpp (100%) rename cuda/{ => cuda}/bindings/_lib/param_packer.h (100%) rename cuda/{ => cuda}/bindings/_lib/param_packer.pxd (100%) rename cuda/{ => cuda}/bindings/_lib/utils.pxd.in (97%) rename cuda/{ => cuda}/bindings/_lib/utils.pyx.in (99%) rename cuda/{ => cuda}/bindings/_version.py (100%) rename cuda/{ => cuda}/bindings/benchmarks/__init__.py (100%) rename cuda/{ => cuda}/bindings/benchmarks/kernels.py (100%) rename cuda/{ => cuda}/bindings/benchmarks/perf_test_utils.py (100%) rename cuda/{ => cuda}/bindings/benchmarks/test_cupy.py (100%) rename cuda/{ => cuda}/bindings/benchmarks/test_launch_latency.py (100%) rename cuda/{ => cuda}/bindings/benchmarks/test_numba.py (100%) rename cuda/{ => cuda}/bindings/benchmarks/test_pointer_attributes.py (100%) rename cuda/{ => cuda}/bindings/cydriver.pxd.in (100%) rename cuda/{ => cuda}/bindings/cydriver.pyx.in (100%) rename cuda/{ => cuda}/bindings/cynvrtc.pxd.in (100%) rename cuda/{ => cuda}/bindings/cynvrtc.pyx.in (100%) rename cuda/{ => cuda}/bindings/cyruntime.pxd.in (100%) rename cuda/{ => cuda}/bindings/cyruntime.pyx.in (100%) rename cuda/{ => cuda}/bindings/driver.pxd.in (100%) rename cuda/{ => cuda}/bindings/driver.pyx.in (100%) rename cuda/{ => cuda}/bindings/nvrtc.pxd.in (100%) rename cuda/{ => cuda}/bindings/nvrtc.pyx.in (100%) rename cuda/{ => cuda}/bindings/runtime.pxd.in (99%) rename cuda/{ => cuda}/bindings/runtime.pyx.in (100%) rename cuda/{ => cuda}/bindings/tests/__init__.py (100%) rename cuda/{ => cuda}/bindings/tests/test_ccuda.pyx (100%) rename cuda/{ => cuda}/bindings/tests/test_ccudart.pyx (100%) rename cuda/{ => cuda}/bindings/tests/test_cuda.py (100%) rename cuda/{ => cuda}/bindings/tests/test_cudart.py (100%) rename cuda/{ => cuda}/bindings/tests/test_cython.py (100%) rename cuda/{ => cuda}/bindings/tests/test_interoperability.py (100%) rename cuda/{ => cuda}/bindings/tests/test_interoperability_cython.pyx (100%) rename cuda/{ => cuda}/bindings/tests/test_kernelParams.py (100%) rename cuda/{ => cuda}/bindings/tests/test_nvrtc.py (100%) rename cuda/{bindings => cuda}/ccuda.pxd (71%) rename cuda/{bindings => cuda}/ccuda.pyx (71%) rename cuda/{bindings => cuda}/ccudart.pxd (70%) rename cuda/{bindings => cuda}/ccudart.pyx (70%) rename cuda/{bindings => cuda}/cnvrtc.pxd (70%) rename cuda/{bindings => cuda}/cnvrtc.pyx (71%) rename cuda/{bindings => cuda}/cuda.pxd (71%) rename cuda/{bindings => cuda}/cuda.pyx (84%) rename cuda/{bindings => cuda}/cudart.pxd (70%) rename cuda/{bindings => cuda}/cudart.pyx (84%) create mode 100644 cuda/cuda/nvrtc.pxd create mode 100644 cuda/cuda/nvrtc.pyx diff --git a/cuda/bindings/__init__.pxd b/cuda/cuda/bindings/__init__.pxd similarity index 100% rename from cuda/bindings/__init__.pxd rename to cuda/cuda/bindings/__init__.pxd diff --git a/cuda/bindings/__init__.py b/cuda/cuda/bindings/__init__.py similarity index 100% rename from cuda/bindings/__init__.py rename to cuda/cuda/bindings/__init__.py diff --git a/cuda/bindings/_cuda/__init__.py b/cuda/cuda/bindings/_cuda/__init__.py similarity index 100% rename from cuda/bindings/_cuda/__init__.py rename to cuda/cuda/bindings/_cuda/__init__.py diff --git a/cuda/bindings/_cuda/ccuda.pxd.in b/cuda/cuda/bindings/_cuda/ccuda.pxd.in similarity index 99% rename from cuda/bindings/_cuda/ccuda.pxd.in rename to cuda/cuda/bindings/_cuda/ccuda.pxd.in index 82eba6e206b..21cdb5205ee 100644 --- a/cuda/bindings/_cuda/ccuda.pxd.in +++ b/cuda/cuda/bindings/_cuda/ccuda.pxd.in @@ -5,7 +5,7 @@ # this software. Any use, reproduction, disclosure, or distribution of # this software and related documentation outside the terms of the EULA # is strictly prohibited. -from cuda.ccuda cimport * +from cuda.bindings.cydriver cimport * {{if 'cuGetErrorString' in found_functions}} diff --git a/cuda/bindings/_cuda/ccuda.pyx.in b/cuda/cuda/bindings/_cuda/ccuda.pyx.in similarity index 99% rename from cuda/bindings/_cuda/ccuda.pyx.in rename to cuda/cuda/bindings/_cuda/ccuda.pyx.in index 64a296f1dd2..b2a9a1cc02c 100644 --- a/cuda/bindings/_cuda/ccuda.pyx.in +++ b/cuda/cuda/bindings/_cuda/ccuda.pyx.in @@ -10,11 +10,11 @@ import win32api import struct from pywintypes import error {{else}} -cimport cuda._lib.dlfcn as dlfcn +cimport cuda.bindings._lib.dlfcn as dlfcn {{endif}} import os import sys -cimport cuda._cuda.loader as loader +cimport cuda.bindings._cuda.loader as loader cdef bint __cuPythonInit = False {{if 'cuGetErrorString' in found_functions}}cdef void *__cuGetErrorString = NULL{{endif}} {{if 'cuGetErrorName' in found_functions}}cdef void *__cuGetErrorName = NULL{{endif}} diff --git a/cuda/bindings/_cuda/cnvrtc.pxd.in b/cuda/cuda/bindings/_cuda/cnvrtc.pxd.in similarity index 99% rename from cuda/bindings/_cuda/cnvrtc.pxd.in rename to cuda/cuda/bindings/_cuda/cnvrtc.pxd.in index 4eccbee8513..26d3a6ffeda 100644 --- a/cuda/bindings/_cuda/cnvrtc.pxd.in +++ b/cuda/cuda/bindings/_cuda/cnvrtc.pxd.in @@ -5,7 +5,7 @@ # this software. Any use, reproduction, disclosure, or distribution of # this software and related documentation outside the terms of the EULA # is strictly prohibited. -from cuda.cnvrtc cimport * +from cuda.bindings.cynvrtc cimport * {{if 'nvrtcGetErrorString' in found_functions}} diff --git a/cuda/bindings/_cuda/cnvrtc.pyx.in b/cuda/cuda/bindings/_cuda/cnvrtc.pyx.in similarity index 99% rename from cuda/bindings/_cuda/cnvrtc.pyx.in rename to cuda/cuda/bindings/_cuda/cnvrtc.pyx.in index c6da941717b..bb4b4cdb144 100644 --- a/cuda/bindings/_cuda/cnvrtc.pyx.in +++ b/cuda/cuda/bindings/_cuda/cnvrtc.pyx.in @@ -10,7 +10,7 @@ import win32api import struct from pywintypes import error {{else}} -cimport cuda._lib.dlfcn as dlfcn +cimport cuda.bindings._lib.dlfcn as dlfcn {{endif}} cdef bint __cuPythonInit = False diff --git a/cuda/bindings/_cuda/loader.cpp b/cuda/cuda/bindings/_cuda/loader.cpp similarity index 100% rename from cuda/bindings/_cuda/loader.cpp rename to cuda/cuda/bindings/_cuda/loader.cpp diff --git a/cuda/bindings/_cuda/loader.h b/cuda/cuda/bindings/_cuda/loader.h similarity index 100% rename from cuda/bindings/_cuda/loader.h rename to cuda/cuda/bindings/_cuda/loader.h diff --git a/cuda/bindings/_cuda/loader.pxd b/cuda/cuda/bindings/_cuda/loader.pxd similarity index 100% rename from cuda/bindings/_cuda/loader.pxd rename to cuda/cuda/bindings/_cuda/loader.pxd diff --git a/cuda/bindings/_lib/__init__.py b/cuda/cuda/bindings/_lib/__init__.py similarity index 100% rename from cuda/bindings/_lib/__init__.py rename to cuda/cuda/bindings/_lib/__init__.py diff --git a/cuda/bindings/_lib/ccudart/__init__.py b/cuda/cuda/bindings/_lib/ccudart/__init__.py similarity index 100% rename from cuda/bindings/_lib/ccudart/__init__.py rename to cuda/cuda/bindings/_lib/ccudart/__init__.py diff --git a/cuda/bindings/_lib/ccudart/ccudart.pxd.in b/cuda/cuda/bindings/_lib/ccudart/ccudart.pxd.in similarity index 99% rename from cuda/bindings/_lib/ccudart/ccudart.pxd.in rename to cuda/cuda/bindings/_lib/ccudart/ccudart.pxd.in index 072fa91a41c..392950fe1fb 100644 --- a/cuda/bindings/_lib/ccudart/ccudart.pxd.in +++ b/cuda/cuda/bindings/_lib/ccudart/ccudart.pxd.in @@ -5,8 +5,8 @@ # this software. Any use, reproduction, disclosure, or distribution of # this software and related documentation outside the terms of the EULA # is strictly prohibited. -cimport cuda.ccuda as ccuda -from cuda.ccudart cimport * +cimport cuda.bindings.cydriver as ccuda +from cuda.bindings.cyruntime cimport * from libc.stdlib cimport malloc, free, calloc from libc.string cimport memset, memcpy, strncmp from libcpp cimport bool diff --git a/cuda/bindings/_lib/ccudart/ccudart.pyx.in b/cuda/cuda/bindings/_lib/ccudart/ccudart.pyx.in similarity index 99% rename from cuda/bindings/_lib/ccudart/ccudart.pyx.in rename to cuda/cuda/bindings/_lib/ccudart/ccudart.pyx.in index 25cb36f2008..51e626a2a19 100644 --- a/cuda/bindings/_lib/ccudart/ccudart.pyx.in +++ b/cuda/cuda/bindings/_lib/ccudart/ccudart.pyx.in @@ -5,12 +5,12 @@ # this software. Any use, reproduction, disclosure, or distribution of # this software and related documentation outside the terms of the EULA # is strictly prohibited. -from cuda.ccudart cimport * -from cuda._lib.ccudart.utils cimport * +from cuda.bindings.cyruntime cimport * +from cuda.bindings._lib.ccudart.utils cimport * from libc.stdlib cimport malloc, free, calloc from libc.string cimport memset, memcpy, strncmp from libcpp cimport bool -cimport cuda._cuda.ccuda as ccuda +cimport cuda.bindings._cuda.ccuda as ccuda cdef cudaPythonGlobal m_global = globalGetInstance() @@ -4867,7 +4867,7 @@ cdef cudaError_t _cudaGraphAddNode_v2(cudaGraphNode_t* pGraphNode, cudaGraph_t g {{if True}} {{if 'Windows' != platform.system()}} -cimport cuda._lib.dlfcn as dlfcn +cimport cuda.bindings._lib.dlfcn as dlfcn {{endif}} cdef cudaError_t _getLocalRuntimeVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil: diff --git a/cuda/bindings/_lib/ccudart/utils.pxd.in b/cuda/cuda/bindings/_lib/ccudart/utils.pxd.in similarity index 99% rename from cuda/bindings/_lib/ccudart/utils.pxd.in rename to cuda/cuda/bindings/_lib/ccudart/utils.pxd.in index 7bc552bb3bb..d88b0be6f0b 100644 --- a/cuda/bindings/_lib/ccudart/utils.pxd.in +++ b/cuda/cuda/bindings/_lib/ccudart/utils.pxd.in @@ -5,12 +5,12 @@ # this software. Any use, reproduction, disclosure, or distribution of # this software and related documentation outside the terms of the EULA # is strictly prohibited. -from cuda.ccudart cimport * +from cuda.bindings.cyruntime cimport * from libc.stdlib cimport malloc, free, calloc from libc.string cimport memset, memcpy, strncmp from libcpp cimport bool from libcpp.map cimport map -cimport cuda._cuda.ccuda as ccuda +cimport cuda.bindings._cuda.ccuda as ccuda ctypedef struct cudaAsyncCallbackData_st: cudaAsyncCallback callback diff --git a/cuda/bindings/_lib/ccudart/utils.pyx.in b/cuda/cuda/bindings/_lib/ccudart/utils.pyx.in similarity index 99% rename from cuda/bindings/_lib/ccudart/utils.pyx.in rename to cuda/cuda/bindings/_lib/ccudart/utils.pyx.in index c34c96f1eb6..4b9b144d969 100644 --- a/cuda/bindings/_lib/ccudart/utils.pyx.in +++ b/cuda/cuda/bindings/_lib/ccudart/utils.pyx.in @@ -6,11 +6,11 @@ # this software and related documentation outside the terms of the EULA # is strictly prohibited. import cython -from cuda.ccudart cimport * +from cuda.bindings.cyruntime cimport * from libc.stdlib cimport malloc, free, calloc from libc.string cimport memset, memcpy, strncmp, memcmp from libcpp cimport bool -cimport cuda._cuda.ccuda as ccuda +cimport cuda.bindings._cuda.ccuda as ccuda cdef struct cudaArrayLocalState: ccuda.CUarray array diff --git a/cuda/bindings/_lib/dlfcn.pxd b/cuda/cuda/bindings/_lib/dlfcn.pxd similarity index 100% rename from cuda/bindings/_lib/dlfcn.pxd rename to cuda/cuda/bindings/_lib/dlfcn.pxd diff --git a/cuda/bindings/_lib/param_packer.cpp b/cuda/cuda/bindings/_lib/param_packer.cpp similarity index 100% rename from cuda/bindings/_lib/param_packer.cpp rename to cuda/cuda/bindings/_lib/param_packer.cpp diff --git a/cuda/bindings/_lib/param_packer.h b/cuda/cuda/bindings/_lib/param_packer.h similarity index 100% rename from cuda/bindings/_lib/param_packer.h rename to cuda/cuda/bindings/_lib/param_packer.h diff --git a/cuda/bindings/_lib/param_packer.pxd b/cuda/cuda/bindings/_lib/param_packer.pxd similarity index 100% rename from cuda/bindings/_lib/param_packer.pxd rename to cuda/cuda/bindings/_lib/param_packer.pxd diff --git a/cuda/bindings/_lib/utils.pxd.in b/cuda/cuda/bindings/_lib/utils.pxd.in similarity index 97% rename from cuda/bindings/_lib/utils.pxd.in rename to cuda/cuda/bindings/_lib/utils.pxd.in index 229f6be9610..d3c18430f97 100644 --- a/cuda/bindings/_lib/utils.pxd.in +++ b/cuda/cuda/bindings/_lib/utils.pxd.in @@ -5,8 +5,8 @@ # this software. Any use, reproduction, disclosure, or distribution of # this software and related documentation outside the terms of the EULA # is strictly prohibited. -cimport cuda.cuda as cuda -cimport cuda.ccuda as ccuda +cimport cuda.bindings.driver as cuda +cimport cuda.bindings.cydriver as ccuda from libcpp.vector cimport vector cdef class HelperKernelParams: diff --git a/cuda/bindings/_lib/utils.pyx.in b/cuda/cuda/bindings/_lib/utils.pyx.in similarity index 99% rename from cuda/bindings/_lib/utils.pyx.in rename to cuda/cuda/bindings/_lib/utils.pyx.in index 6f61f90b8db..02efc2cd051 100644 --- a/cuda/bindings/_lib/utils.pyx.in +++ b/cuda/cuda/bindings/_lib/utils.pyx.in @@ -13,9 +13,9 @@ from libc.string cimport memcpy from enum import Enum from typing import List, Tuple import ctypes -cimport cuda.ccuda as ccuda -import cuda.cuda as cuda -cimport cuda._lib.param_packer as param_packer +cimport cuda.bindings.cydriver as ccuda +import cuda.bindings.driver as cuda +cimport cuda.bindings._lib.param_packer as param_packer ctypedef unsigned long long void_ptr diff --git a/cuda/bindings/_version.py b/cuda/cuda/bindings/_version.py similarity index 100% rename from cuda/bindings/_version.py rename to cuda/cuda/bindings/_version.py diff --git a/cuda/bindings/benchmarks/__init__.py b/cuda/cuda/bindings/benchmarks/__init__.py similarity index 100% rename from cuda/bindings/benchmarks/__init__.py rename to cuda/cuda/bindings/benchmarks/__init__.py diff --git a/cuda/bindings/benchmarks/kernels.py b/cuda/cuda/bindings/benchmarks/kernels.py similarity index 100% rename from cuda/bindings/benchmarks/kernels.py rename to cuda/cuda/bindings/benchmarks/kernels.py diff --git a/cuda/bindings/benchmarks/perf_test_utils.py b/cuda/cuda/bindings/benchmarks/perf_test_utils.py similarity index 100% rename from cuda/bindings/benchmarks/perf_test_utils.py rename to cuda/cuda/bindings/benchmarks/perf_test_utils.py diff --git a/cuda/bindings/benchmarks/test_cupy.py b/cuda/cuda/bindings/benchmarks/test_cupy.py similarity index 100% rename from cuda/bindings/benchmarks/test_cupy.py rename to cuda/cuda/bindings/benchmarks/test_cupy.py diff --git a/cuda/bindings/benchmarks/test_launch_latency.py b/cuda/cuda/bindings/benchmarks/test_launch_latency.py similarity index 100% rename from cuda/bindings/benchmarks/test_launch_latency.py rename to cuda/cuda/bindings/benchmarks/test_launch_latency.py diff --git a/cuda/bindings/benchmarks/test_numba.py b/cuda/cuda/bindings/benchmarks/test_numba.py similarity index 100% rename from cuda/bindings/benchmarks/test_numba.py rename to cuda/cuda/bindings/benchmarks/test_numba.py diff --git a/cuda/bindings/benchmarks/test_pointer_attributes.py b/cuda/cuda/bindings/benchmarks/test_pointer_attributes.py similarity index 100% rename from cuda/bindings/benchmarks/test_pointer_attributes.py rename to cuda/cuda/bindings/benchmarks/test_pointer_attributes.py diff --git a/cuda/bindings/cydriver.pxd.in b/cuda/cuda/bindings/cydriver.pxd.in similarity index 100% rename from cuda/bindings/cydriver.pxd.in rename to cuda/cuda/bindings/cydriver.pxd.in diff --git a/cuda/bindings/cydriver.pyx.in b/cuda/cuda/bindings/cydriver.pyx.in similarity index 100% rename from cuda/bindings/cydriver.pyx.in rename to cuda/cuda/bindings/cydriver.pyx.in diff --git a/cuda/bindings/cynvrtc.pxd.in b/cuda/cuda/bindings/cynvrtc.pxd.in similarity index 100% rename from cuda/bindings/cynvrtc.pxd.in rename to cuda/cuda/bindings/cynvrtc.pxd.in diff --git a/cuda/bindings/cynvrtc.pyx.in b/cuda/cuda/bindings/cynvrtc.pyx.in similarity index 100% rename from cuda/bindings/cynvrtc.pyx.in rename to cuda/cuda/bindings/cynvrtc.pyx.in diff --git a/cuda/bindings/cyruntime.pxd.in b/cuda/cuda/bindings/cyruntime.pxd.in similarity index 100% rename from cuda/bindings/cyruntime.pxd.in rename to cuda/cuda/bindings/cyruntime.pxd.in diff --git a/cuda/bindings/cyruntime.pyx.in b/cuda/cuda/bindings/cyruntime.pyx.in similarity index 100% rename from cuda/bindings/cyruntime.pyx.in rename to cuda/cuda/bindings/cyruntime.pyx.in diff --git a/cuda/bindings/driver.pxd.in b/cuda/cuda/bindings/driver.pxd.in similarity index 100% rename from cuda/bindings/driver.pxd.in rename to cuda/cuda/bindings/driver.pxd.in diff --git a/cuda/bindings/driver.pyx.in b/cuda/cuda/bindings/driver.pyx.in similarity index 100% rename from cuda/bindings/driver.pyx.in rename to cuda/cuda/bindings/driver.pyx.in diff --git a/cuda/bindings/nvrtc.pxd.in b/cuda/cuda/bindings/nvrtc.pxd.in similarity index 100% rename from cuda/bindings/nvrtc.pxd.in rename to cuda/cuda/bindings/nvrtc.pxd.in diff --git a/cuda/bindings/nvrtc.pyx.in b/cuda/cuda/bindings/nvrtc.pyx.in similarity index 100% rename from cuda/bindings/nvrtc.pyx.in rename to cuda/cuda/bindings/nvrtc.pyx.in diff --git a/cuda/bindings/runtime.pxd.in b/cuda/cuda/bindings/runtime.pxd.in similarity index 99% rename from cuda/bindings/runtime.pxd.in rename to cuda/cuda/bindings/runtime.pxd.in index 1155e64cb0b..a82708b6409 100644 --- a/cuda/bindings/runtime.pxd.in +++ b/cuda/cuda/bindings/runtime.pxd.in @@ -5,7 +5,7 @@ # this software. Any use, reproduction, disclosure, or distribution of # this software and related documentation outside the terms of the EULA # is strictly prohibited. -cimport cuda.bindings.cycudart as ccudart +cimport cuda.bindings.cyruntime as ccudart cimport cuda.bindings._lib.utils as utils cimport cuda.bindings.driver as cuda diff --git a/cuda/bindings/runtime.pyx.in b/cuda/cuda/bindings/runtime.pyx.in similarity index 100% rename from cuda/bindings/runtime.pyx.in rename to cuda/cuda/bindings/runtime.pyx.in diff --git a/cuda/bindings/tests/__init__.py b/cuda/cuda/bindings/tests/__init__.py similarity index 100% rename from cuda/bindings/tests/__init__.py rename to cuda/cuda/bindings/tests/__init__.py diff --git a/cuda/bindings/tests/test_ccuda.pyx b/cuda/cuda/bindings/tests/test_ccuda.pyx similarity index 100% rename from cuda/bindings/tests/test_ccuda.pyx rename to cuda/cuda/bindings/tests/test_ccuda.pyx diff --git a/cuda/bindings/tests/test_ccudart.pyx b/cuda/cuda/bindings/tests/test_ccudart.pyx similarity index 100% rename from cuda/bindings/tests/test_ccudart.pyx rename to cuda/cuda/bindings/tests/test_ccudart.pyx diff --git a/cuda/bindings/tests/test_cuda.py b/cuda/cuda/bindings/tests/test_cuda.py similarity index 100% rename from cuda/bindings/tests/test_cuda.py rename to cuda/cuda/bindings/tests/test_cuda.py diff --git a/cuda/bindings/tests/test_cudart.py b/cuda/cuda/bindings/tests/test_cudart.py similarity index 100% rename from cuda/bindings/tests/test_cudart.py rename to cuda/cuda/bindings/tests/test_cudart.py diff --git a/cuda/bindings/tests/test_cython.py b/cuda/cuda/bindings/tests/test_cython.py similarity index 100% rename from cuda/bindings/tests/test_cython.py rename to cuda/cuda/bindings/tests/test_cython.py diff --git a/cuda/bindings/tests/test_interoperability.py b/cuda/cuda/bindings/tests/test_interoperability.py similarity index 100% rename from cuda/bindings/tests/test_interoperability.py rename to cuda/cuda/bindings/tests/test_interoperability.py diff --git a/cuda/bindings/tests/test_interoperability_cython.pyx b/cuda/cuda/bindings/tests/test_interoperability_cython.pyx similarity index 100% rename from cuda/bindings/tests/test_interoperability_cython.pyx rename to cuda/cuda/bindings/tests/test_interoperability_cython.pyx diff --git a/cuda/bindings/tests/test_kernelParams.py b/cuda/cuda/bindings/tests/test_kernelParams.py similarity index 100% rename from cuda/bindings/tests/test_kernelParams.py rename to cuda/cuda/bindings/tests/test_kernelParams.py diff --git a/cuda/bindings/tests/test_nvrtc.py b/cuda/cuda/bindings/tests/test_nvrtc.py similarity index 100% rename from cuda/bindings/tests/test_nvrtc.py rename to cuda/cuda/bindings/tests/test_nvrtc.py diff --git a/cuda/bindings/ccuda.pxd b/cuda/cuda/ccuda.pxd similarity index 71% rename from cuda/bindings/ccuda.pxd rename to cuda/cuda/ccuda.pxd index 090a02be274..73f3fc5cb4f 100644 --- a/cuda/bindings/ccuda.pxd +++ b/cuda/cuda/ccuda.pxd @@ -1,7 +1,7 @@ -from .cydriver cimport * +from cuda.bindings.cydriver cimport * cdef extern from *: """ - #pragma message ( "The cuda.ccuda module is deprecated and will be removed in a future release, " + #pragma message ( "The cuda.ccuda module is deprecated and will be removed in a future release, " \ "please switch to use the cuda.bindings.cydriver module instead." ) """ diff --git a/cuda/bindings/ccuda.pyx b/cuda/cuda/ccuda.pyx similarity index 71% rename from cuda/bindings/ccuda.pyx rename to cuda/cuda/ccuda.pyx index 7dec5bb2b37..6f6a0a8f5c8 100644 --- a/cuda/bindings/ccuda.pyx +++ b/cuda/cuda/ccuda.pyx @@ -1,8 +1,8 @@ -from .cydriver cimport * +from cuda.bindings.cydriver cimport * cdef extern from *: """ - #pragma message ( "The cuda.ccuda module is deprecated and will be removed in a future release, " + #pragma message ( "The cuda.ccuda module is deprecated and will be removed in a future release, " \ "please switch to use the cuda.bindings.cydriver module instead." ) """ diff --git a/cuda/bindings/ccudart.pxd b/cuda/cuda/ccudart.pxd similarity index 70% rename from cuda/bindings/ccudart.pxd rename to cuda/cuda/ccudart.pxd index 0a1c8aa9a88..b32eece8149 100644 --- a/cuda/bindings/ccudart.pxd +++ b/cuda/cuda/ccudart.pxd @@ -1,7 +1,7 @@ -from .cyruntime cimport * +from cuda.bindings.cyruntime cimport * cdef extern from *: """ - #pragma message ( "The cuda.ccudart module is deprecated and will be removed in a future release, " + #pragma message ( "The cuda.ccudart module is deprecated and will be removed in a future release, " \ "please switch to use the cuda.bindings.cyruntime module instead." ) """ diff --git a/cuda/bindings/ccudart.pyx b/cuda/cuda/ccudart.pyx similarity index 70% rename from cuda/bindings/ccudart.pyx rename to cuda/cuda/ccudart.pyx index 0a1c8aa9a88..b32eece8149 100644 --- a/cuda/bindings/ccudart.pyx +++ b/cuda/cuda/ccudart.pyx @@ -1,7 +1,7 @@ -from .cyruntime cimport * +from cuda.bindings.cyruntime cimport * cdef extern from *: """ - #pragma message ( "The cuda.ccudart module is deprecated and will be removed in a future release, " + #pragma message ( "The cuda.ccudart module is deprecated and will be removed in a future release, " \ "please switch to use the cuda.bindings.cyruntime module instead." ) """ diff --git a/cuda/bindings/cnvrtc.pxd b/cuda/cuda/cnvrtc.pxd similarity index 70% rename from cuda/bindings/cnvrtc.pxd rename to cuda/cuda/cnvrtc.pxd index 1366a5aa9c4..d4034084e2f 100644 --- a/cuda/bindings/cnvrtc.pxd +++ b/cuda/cuda/cnvrtc.pxd @@ -1,7 +1,7 @@ -from .cynvrtc cimport * +from cuda.bindings.cynvrtc cimport * cdef extern from *: """ - #pragma message ( "The cuda.cnvrtc module is deprecated and will be removed in a future release, " + #pragma message ( "The cuda.cnvrtc module is deprecated and will be removed in a future release, " \ "please switch to use the cuda.bindings.cynvrtc module instead." ) """ diff --git a/cuda/bindings/cnvrtc.pyx b/cuda/cuda/cnvrtc.pyx similarity index 71% rename from cuda/bindings/cnvrtc.pyx rename to cuda/cuda/cnvrtc.pyx index 2be3c160c6e..a84893e0311 100644 --- a/cuda/bindings/cnvrtc.pyx +++ b/cuda/cuda/cnvrtc.pyx @@ -1,8 +1,8 @@ -from .cynvrtc cimport * +from cuda.bindings.cynvrtc cimport * cdef extern from *: """ - #pragma message ( "The cuda.cnvrtc module is deprecated and will be removed in a future release, " + #pragma message ( "The cuda.cnvrtc module is deprecated and will be removed in a future release, " \ "please switch to use the cuda.bindings.cynvrtc module instead." ) """ diff --git a/cuda/bindings/cuda.pxd b/cuda/cuda/cuda.pxd similarity index 71% rename from cuda/bindings/cuda.pxd rename to cuda/cuda/cuda.pxd index f84eb95c514..815e731a973 100644 --- a/cuda/bindings/cuda.pxd +++ b/cuda/cuda/cuda.pxd @@ -1,7 +1,7 @@ -from .driver cimport * +from cuda.bindings.driver cimport * cdef extern from *: """ - #pragma message ( "The cuda.cuda module is deprecated and will be removed in a future release, " + #pragma message ( "The cuda.cuda module is deprecated and will be removed in a future release, " \ "please switch to use the cuda.bindings.driver module instead." ) """ diff --git a/cuda/bindings/cuda.pyx b/cuda/cuda/cuda.pyx similarity index 84% rename from cuda/bindings/cuda.pyx rename to cuda/cuda/cuda.pyx index dec449525a0..f76ff52725e 100644 --- a/cuda/bindings/cuda.pyx +++ b/cuda/cuda/cuda.pyx @@ -1,11 +1,11 @@ -from .driver import * +from cuda.bindings.driver import * import warnings cdef extern from *: """ - #pragma message ( "The cuda.cuda module is deprecated and will be removed in a future release, " + #pragma message ( "The cuda.cuda module is deprecated and will be removed in a future release, " \ "please switch to use the cuda.bindings.driver module instead." ) """ diff --git a/cuda/bindings/cudart.pxd b/cuda/cuda/cudart.pxd similarity index 70% rename from cuda/bindings/cudart.pxd rename to cuda/cuda/cudart.pxd index e1359131d10..6a3d2bab0fc 100644 --- a/cuda/bindings/cudart.pxd +++ b/cuda/cuda/cudart.pxd @@ -1,7 +1,7 @@ -from .runtime cimport * +from cuda.bindings.runtime cimport * cdef extern from *: """ - #pragma message ( "The cuda.cudart module is deprecated and will be removed in a future release, " + #pragma message ( "The cuda.cudart module is deprecated and will be removed in a future release, " \ "please switch to use the cuda.bindings.runtime module instead." ) """ diff --git a/cuda/bindings/cudart.pyx b/cuda/cuda/cudart.pyx similarity index 84% rename from cuda/bindings/cudart.pyx rename to cuda/cuda/cudart.pyx index 66100fd6087..0061ce3e2df 100644 --- a/cuda/bindings/cudart.pyx +++ b/cuda/cuda/cudart.pyx @@ -1,11 +1,11 @@ -from .runtime import * +from cuda.bindings.runtime import * import warnings cdef extern from *: """ - #pragma message ( "The cuda.cudart module is deprecated and will be removed in a future release, " + #pragma message ( "The cuda.cudart module is deprecated and will be removed in a future release, " \ "please switch to use the cuda.bindings.runtime module instead." ) """ diff --git a/cuda/cuda/nvrtc.pxd b/cuda/cuda/nvrtc.pxd new file mode 100644 index 00000000000..b65d1c59e58 --- /dev/null +++ b/cuda/cuda/nvrtc.pxd @@ -0,0 +1,7 @@ +from cuda.bindings.nvrtc cimport * + +cdef extern from *: + """ + #pragma message ( "The cuda.nvrtc module is deprecated and will be removed in a future release, " \ + "please switch to use the cuda.bindings.nvrtc module instead." ) + """ diff --git a/cuda/cuda/nvrtc.pyx b/cuda/cuda/nvrtc.pyx new file mode 100644 index 00000000000..0d711c6fc53 --- /dev/null +++ b/cuda/cuda/nvrtc.pyx @@ -0,0 +1,14 @@ +from cuda.bindings.nvrtc import * + +import warnings + + +cdef extern from *: + """ + #pragma message ( "The cuda.nvrtc module is deprecated and will be removed in a future release, " \ + "please switch to use the cuda.bindings.nvrtc module instead." ) + """ + + +warnings.warn("The cuda.nvrtc module is deprecated and will be removed in a future release, " + "please switch to use the cuda.bindings.nvrtc module instead.", DeprecationWarning, stacklevel=2) From 96f62f20b9fae350cca93d1adf42bbcea9bb70fd Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Wed, 11 Sep 2024 06:23:00 +0000 Subject: [PATCH 07/14] update build system --- cuda/pyproject.toml | 4 ++-- cuda/setup.py | 21 +++++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/cuda/pyproject.toml b/cuda/pyproject.toml index 470fe642408..f4c9c5bc6c1 100644 --- a/cuda/pyproject.toml +++ b/cuda/pyproject.toml @@ -52,7 +52,7 @@ Documentation = "https://nvidia.github.io/cuda-python/" [tool.versioneer] VCS = "git" style = "pep440" -versionfile_source = "cuda/_version.py" -versionfile_build = "cuda/_version.py" +versionfile_source = "cuda/bindings/_version.py" +versionfile_build = "cuda/bindings/_version.py" tag_prefix = "v" parentdir_prefix = "cuda-python-" diff --git a/cuda/setup.py b/cuda/setup.py index 62fec10f13d..fb8ddcc6379 100644 --- a/cuda/setup.py +++ b/cuda/setup.py @@ -136,9 +136,10 @@ def generate_output(infile, local): f.write(pxdcontent) path_list = [os.path.join('cuda'), - os.path.join('cuda', '_cuda'), - os.path.join('cuda', '_lib'), - os.path.join('cuda', '_lib', 'ccudart')] + os.path.join('cuda', 'bindings'), + os.path.join('cuda', 'bindings', '_cuda'), + os.path.join('cuda', 'bindings', '_lib'), + os.path.join('cuda', 'bindings', '_lib', 'ccudart')] input_files = [] for path in path_list: input_files += fetch_input_files(path) @@ -204,14 +205,18 @@ def do_cythonize(sources): sources_list = [ # private - ["cuda/_cuda/*.pyx", "cuda/_cuda/loader.cpp"], + ["cuda/bindings/_cuda/*.pyx", "cuda/bindings/_cuda/loader.cpp"], # utils - ["cuda/_lib/*.pyx", "cuda/_lib/param_packer.cpp"], - ["cuda/_lib/ccudart/*.pyx"], + ["cuda/bindings/_lib/*.pyx", "cuda/bindings/_lib/param_packer.cpp"], + ["cuda/bindings/_lib/ccudart/*.pyx"], # public + ["cuda/bindings/*.pyx"], + # public (deprecated, to be removed) ["cuda/*.pyx"], - # tests - ["cuda/tests/*.pyx"]] + # FIXME + # # tests + # ["cuda/tests/*.pyx"], +] for sources in sources_list: extensions += do_cythonize(sources) From 874ebb41a7d2c5d2ac9fedde2bdb008580365db0 Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Wed, 11 Sep 2024 14:18:01 +0000 Subject: [PATCH 08/14] everything builds now --- cuda/cuda/__init__.pxd | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 cuda/cuda/__init__.pxd diff --git a/cuda/cuda/__init__.pxd b/cuda/cuda/__init__.pxd new file mode 100644 index 00000000000..e69de29bb2d From 56a4ad7c78c184a7bf8087eea9527faf6888f7c1 Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Wed, 11 Sep 2024 19:13:10 +0000 Subject: [PATCH 09/14] now examples run --- cuda/MANIFEST.in | 2 +- cuda/cuda/__init__.py | 0 cuda/cuda/bindings/tests/test_ccuda.pyx | 4 +++- cuda/cuda/bindings/tests/test_ccudart.pyx | 2 ++ .../cuda/bindings/tests/test_interoperability_cython.pyx | 3 +++ cuda/cuda/cnvrtc.pxd | 1 + cuda/cuda/cuda.pxd | 7 ------- cuda/cuda/cuda.pyx | 8 ++++---- cuda/cuda/cudart.pxd | 7 ------- cuda/cuda/cudart.pyx | 8 ++++---- cuda/cuda/nvrtc.pxd | 7 ------- cuda/cuda/nvrtc.pyx | 8 ++++---- cuda/setup.py | 9 ++++----- 13 files changed, 26 insertions(+), 40 deletions(-) create mode 100644 cuda/cuda/__init__.py delete mode 100644 cuda/cuda/cuda.pxd delete mode 100644 cuda/cuda/cudart.pxd delete mode 100644 cuda/cuda/nvrtc.pxd diff --git a/cuda/MANIFEST.in b/cuda/MANIFEST.in index 4e93de45004..11505c5a334 100644 --- a/cuda/MANIFEST.in +++ b/cuda/MANIFEST.in @@ -1 +1 @@ -include cuda/_version.py +recursive-include cuda/ *.pyx *.pxd diff --git a/cuda/cuda/__init__.py b/cuda/cuda/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/cuda/cuda/bindings/tests/test_ccuda.pyx b/cuda/cuda/bindings/tests/test_ccuda.pyx index 9bd08650544..0d90ba90985 100644 --- a/cuda/cuda/bindings/tests/test_ccuda.pyx +++ b/cuda/cuda/bindings/tests/test_ccuda.pyx @@ -9,6 +9,8 @@ from libc.string cimport ( memset, memcmp ) +# TODO: update to new module once the old ones are removed, we use the +# tests to cover backward compatibility. cimport cuda.ccuda as ccuda def test_ccuda_memcpy(): @@ -53,4 +55,4 @@ def test_ccuda_memcpy(): err = ccuda.cuMemFree(dptr) assert(err == 0) err = ccuda.cuCtxDestroy(ctx) - assert(err == 0) \ No newline at end of file + assert(err == 0) diff --git a/cuda/cuda/bindings/tests/test_ccudart.pyx b/cuda/cuda/bindings/tests/test_ccudart.pyx index a871fa6f6a4..b228661c8db 100644 --- a/cuda/cuda/bindings/tests/test_ccudart.pyx +++ b/cuda/cuda/bindings/tests/test_ccudart.pyx @@ -9,6 +9,8 @@ from libc.string cimport ( memset, memcmp ) +# TODO: update to new module once the old ones are removed, we use the +# tests to cover backward compatibility. cimport cuda.ccudart as ccudart def test_ccudart_memcpy(): diff --git a/cuda/cuda/bindings/tests/test_interoperability_cython.pyx b/cuda/cuda/bindings/tests/test_interoperability_cython.pyx index 96b50ce5bb0..5c58e8eae33 100644 --- a/cuda/cuda/bindings/tests/test_interoperability_cython.pyx +++ b/cuda/cuda/bindings/tests/test_interoperability_cython.pyx @@ -5,6 +5,9 @@ # this software. Any use, reproduction, disclosure, or distribution of # this software and related documentation outside the terms of the EULA # is strictly prohibited. + +# TODO: update to new module once the old ones are removed, we use the +# tests to cover backward compatibility. import pytest import cuda.cuda as cuda import cuda.cudart as cudart diff --git a/cuda/cuda/cnvrtc.pxd b/cuda/cuda/cnvrtc.pxd index d4034084e2f..a84893e0311 100644 --- a/cuda/cuda/cnvrtc.pxd +++ b/cuda/cuda/cnvrtc.pxd @@ -1,5 +1,6 @@ from cuda.bindings.cynvrtc cimport * + cdef extern from *: """ #pragma message ( "The cuda.cnvrtc module is deprecated and will be removed in a future release, " \ diff --git a/cuda/cuda/cuda.pxd b/cuda/cuda/cuda.pxd deleted file mode 100644 index 815e731a973..00000000000 --- a/cuda/cuda/cuda.pxd +++ /dev/null @@ -1,7 +0,0 @@ -from cuda.bindings.driver cimport * - -cdef extern from *: - """ - #pragma message ( "The cuda.cuda module is deprecated and will be removed in a future release, " \ - "please switch to use the cuda.bindings.driver module instead." ) - """ diff --git a/cuda/cuda/cuda.pyx b/cuda/cuda/cuda.pyx index f76ff52725e..f8b197f7163 100644 --- a/cuda/cuda/cuda.pyx +++ b/cuda/cuda/cuda.pyx @@ -1,6 +1,6 @@ -from cuda.bindings.driver import * +import warnings as _warnings -import warnings +from cuda.bindings.driver import * cdef extern from *: @@ -10,5 +10,5 @@ cdef extern from *: """ -warnings.warn("The cuda.cuda module is deprecated and will be removed in a future release, " - "please switch to use the cuda.bindings.driver module instead.", DeprecationWarning, stacklevel=2) +_warnings.warn("The cuda.cuda module is deprecated and will be removed in a future release, " + "please switch to use the cuda.bindings.driver module instead.", DeprecationWarning, stacklevel=2) diff --git a/cuda/cuda/cudart.pxd b/cuda/cuda/cudart.pxd deleted file mode 100644 index 6a3d2bab0fc..00000000000 --- a/cuda/cuda/cudart.pxd +++ /dev/null @@ -1,7 +0,0 @@ -from cuda.bindings.runtime cimport * - -cdef extern from *: - """ - #pragma message ( "The cuda.cudart module is deprecated and will be removed in a future release, " \ - "please switch to use the cuda.bindings.runtime module instead." ) - """ diff --git a/cuda/cuda/cudart.pyx b/cuda/cuda/cudart.pyx index 0061ce3e2df..8c342df8050 100644 --- a/cuda/cuda/cudart.pyx +++ b/cuda/cuda/cudart.pyx @@ -1,6 +1,6 @@ -from cuda.bindings.runtime import * +import warnings as _warnings -import warnings +from cuda.bindings.runtime import * cdef extern from *: @@ -10,5 +10,5 @@ cdef extern from *: """ -warnings.warn("The cuda.cudart module is deprecated and will be removed in a future release, " - "please switch to use the cuda.bindings.runtime module instead.", DeprecationWarning, stacklevel=2) +_warnings.warn("The cuda.cudart module is deprecated and will be removed in a future release, " + "please switch to use the cuda.bindings.runtime module instead.", DeprecationWarning, stacklevel=2) diff --git a/cuda/cuda/nvrtc.pxd b/cuda/cuda/nvrtc.pxd deleted file mode 100644 index b65d1c59e58..00000000000 --- a/cuda/cuda/nvrtc.pxd +++ /dev/null @@ -1,7 +0,0 @@ -from cuda.bindings.nvrtc cimport * - -cdef extern from *: - """ - #pragma message ( "The cuda.nvrtc module is deprecated and will be removed in a future release, " \ - "please switch to use the cuda.bindings.nvrtc module instead." ) - """ diff --git a/cuda/cuda/nvrtc.pyx b/cuda/cuda/nvrtc.pyx index 0d711c6fc53..4a9e048f272 100644 --- a/cuda/cuda/nvrtc.pyx +++ b/cuda/cuda/nvrtc.pyx @@ -1,6 +1,6 @@ -from cuda.bindings.nvrtc import * +import warnings as _warnings -import warnings +from cuda.bindings.nvrtc import * cdef extern from *: @@ -10,5 +10,5 @@ cdef extern from *: """ -warnings.warn("The cuda.nvrtc module is deprecated and will be removed in a future release, " - "please switch to use the cuda.bindings.nvrtc module instead.", DeprecationWarning, stacklevel=2) +_warnings.warn("The cuda.nvrtc module is deprecated and will be removed in a future release, " + "please switch to use the cuda.bindings.nvrtc module instead.", DeprecationWarning, stacklevel=2) diff --git a/cuda/setup.py b/cuda/setup.py index fb8ddcc6379..8747b72150d 100644 --- a/cuda/setup.py +++ b/cuda/setup.py @@ -213,9 +213,8 @@ def do_cythonize(sources): ["cuda/bindings/*.pyx"], # public (deprecated, to be removed) ["cuda/*.pyx"], - # FIXME - # # tests - # ["cuda/tests/*.pyx"], + # tests + ["cuda/bindings/tests/*.pyx"], ] for sources in sources_list: @@ -246,9 +245,9 @@ def finalize_options(self): setup( version=versioneer.get_version(), ext_modules=extensions, - packages=find_packages(include=["cuda", "cuda.*"]), + packages=find_packages(include=["cuda.*"]), package_data=dict.fromkeys( - find_packages(include=["cuda", "cuda.*"]), + find_packages(include=["cuda.*"]), ["*.pxd", "*.pyx", "*.h", "*.cpp"], ), cmdclass=cmdclass, From c03d77835d69ab1c926e74263c0af13d0421beba Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Wed, 11 Sep 2024 19:27:40 +0000 Subject: [PATCH 10/14] update test module paths --- cuda/cuda/bindings/tests/test_cython.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cuda/cuda/bindings/tests/test_cython.py b/cuda/cuda/bindings/tests/test_cython.py index 4787742f27e..e5577ede339 100644 --- a/cuda/cuda/bindings/tests/test_cython.py +++ b/cuda/cuda/bindings/tests/test_cython.py @@ -22,9 +22,9 @@ def wrapped(*args, **kwargs): return wrapped -cython_test_modules = ["cuda.tests.test_ccuda", - "cuda.tests.test_ccudart", - "cuda.tests.test_interoperability_cython"] +cython_test_modules = ["cuda.bindings.tests.test_ccuda", + "cuda.bindings.tests.test_ccudart", + "cuda.bindings.tests.test_interoperability_cython"] for mod in cython_test_modules: From 7c3491aebdbe388ade53226b4ec177fb243d03e3 Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Wed, 11 Sep 2024 19:35:44 +0000 Subject: [PATCH 11/14] move examples also to under the subpackage --- .../cuda/bindings/examples}/0_Introduction/clock_nvrtc_test.py | 0 .../examples}/0_Introduction/simpleCubemapTexture_test.py | 0 .../cuda/bindings/examples}/0_Introduction/simpleP2P_test.py | 0 .../cuda/bindings/examples}/0_Introduction/simpleZeroCopy_test.py | 0 .../bindings/examples}/0_Introduction/systemWideAtomics_test.py | 0 .../cuda/bindings/examples}/0_Introduction/vectorAddDrv_test.py | 0 .../cuda/bindings/examples}/0_Introduction/vectorAddMMAP_test.py | 0 .../2_Concepts_and_Techniques/streamOrderedAllocation_test.py | 0 .../examples}/3_CUDA_Features/globalToShmemAsyncCopy_test.py | 0 .../bindings/examples}/3_CUDA_Features/simpleCudaGraphs_test.py | 0 .../4_CUDA_Libraries/conjugateGradientMultiBlockCG_test.py | 0 {examples => cuda/cuda/bindings/examples}/__init__.py | 0 {examples => cuda/cuda/bindings/examples}/common/common.py | 0 {examples => cuda/cuda/bindings/examples}/common/helper_cuda.py | 0 {examples => cuda/cuda/bindings/examples}/common/helper_string.py | 0 .../cuda/bindings/examples}/extra/isoFDModelling_test.py | 0 .../cuda/bindings/examples}/extra/jit_program_test.py | 0 .../cuda/bindings/examples}/extra/numba_emm_plugin.py | 0 {examples => cuda/cuda/bindings/examples}/setup.cfg | 0 19 files changed, 0 insertions(+), 0 deletions(-) rename {examples => cuda/cuda/bindings/examples}/0_Introduction/clock_nvrtc_test.py (100%) rename {examples => cuda/cuda/bindings/examples}/0_Introduction/simpleCubemapTexture_test.py (100%) rename {examples => cuda/cuda/bindings/examples}/0_Introduction/simpleP2P_test.py (100%) rename {examples => cuda/cuda/bindings/examples}/0_Introduction/simpleZeroCopy_test.py (100%) rename {examples => cuda/cuda/bindings/examples}/0_Introduction/systemWideAtomics_test.py (100%) rename {examples => cuda/cuda/bindings/examples}/0_Introduction/vectorAddDrv_test.py (100%) rename {examples => cuda/cuda/bindings/examples}/0_Introduction/vectorAddMMAP_test.py (100%) rename {examples => cuda/cuda/bindings/examples}/2_Concepts_and_Techniques/streamOrderedAllocation_test.py (100%) rename {examples => cuda/cuda/bindings/examples}/3_CUDA_Features/globalToShmemAsyncCopy_test.py (100%) rename {examples => cuda/cuda/bindings/examples}/3_CUDA_Features/simpleCudaGraphs_test.py (100%) rename {examples => cuda/cuda/bindings/examples}/4_CUDA_Libraries/conjugateGradientMultiBlockCG_test.py (100%) rename {examples => cuda/cuda/bindings/examples}/__init__.py (100%) rename {examples => cuda/cuda/bindings/examples}/common/common.py (100%) rename {examples => cuda/cuda/bindings/examples}/common/helper_cuda.py (100%) rename {examples => cuda/cuda/bindings/examples}/common/helper_string.py (100%) rename {examples => cuda/cuda/bindings/examples}/extra/isoFDModelling_test.py (100%) rename {examples => cuda/cuda/bindings/examples}/extra/jit_program_test.py (100%) rename {examples => cuda/cuda/bindings/examples}/extra/numba_emm_plugin.py (100%) rename {examples => cuda/cuda/bindings/examples}/setup.cfg (100%) diff --git a/examples/0_Introduction/clock_nvrtc_test.py b/cuda/cuda/bindings/examples/0_Introduction/clock_nvrtc_test.py similarity index 100% rename from examples/0_Introduction/clock_nvrtc_test.py rename to cuda/cuda/bindings/examples/0_Introduction/clock_nvrtc_test.py diff --git a/examples/0_Introduction/simpleCubemapTexture_test.py b/cuda/cuda/bindings/examples/0_Introduction/simpleCubemapTexture_test.py similarity index 100% rename from examples/0_Introduction/simpleCubemapTexture_test.py rename to cuda/cuda/bindings/examples/0_Introduction/simpleCubemapTexture_test.py diff --git a/examples/0_Introduction/simpleP2P_test.py b/cuda/cuda/bindings/examples/0_Introduction/simpleP2P_test.py similarity index 100% rename from examples/0_Introduction/simpleP2P_test.py rename to cuda/cuda/bindings/examples/0_Introduction/simpleP2P_test.py diff --git a/examples/0_Introduction/simpleZeroCopy_test.py b/cuda/cuda/bindings/examples/0_Introduction/simpleZeroCopy_test.py similarity index 100% rename from examples/0_Introduction/simpleZeroCopy_test.py rename to cuda/cuda/bindings/examples/0_Introduction/simpleZeroCopy_test.py diff --git a/examples/0_Introduction/systemWideAtomics_test.py b/cuda/cuda/bindings/examples/0_Introduction/systemWideAtomics_test.py similarity index 100% rename from examples/0_Introduction/systemWideAtomics_test.py rename to cuda/cuda/bindings/examples/0_Introduction/systemWideAtomics_test.py diff --git a/examples/0_Introduction/vectorAddDrv_test.py b/cuda/cuda/bindings/examples/0_Introduction/vectorAddDrv_test.py similarity index 100% rename from examples/0_Introduction/vectorAddDrv_test.py rename to cuda/cuda/bindings/examples/0_Introduction/vectorAddDrv_test.py diff --git a/examples/0_Introduction/vectorAddMMAP_test.py b/cuda/cuda/bindings/examples/0_Introduction/vectorAddMMAP_test.py similarity index 100% rename from examples/0_Introduction/vectorAddMMAP_test.py rename to cuda/cuda/bindings/examples/0_Introduction/vectorAddMMAP_test.py diff --git a/examples/2_Concepts_and_Techniques/streamOrderedAllocation_test.py b/cuda/cuda/bindings/examples/2_Concepts_and_Techniques/streamOrderedAllocation_test.py similarity index 100% rename from examples/2_Concepts_and_Techniques/streamOrderedAllocation_test.py rename to cuda/cuda/bindings/examples/2_Concepts_and_Techniques/streamOrderedAllocation_test.py diff --git a/examples/3_CUDA_Features/globalToShmemAsyncCopy_test.py b/cuda/cuda/bindings/examples/3_CUDA_Features/globalToShmemAsyncCopy_test.py similarity index 100% rename from examples/3_CUDA_Features/globalToShmemAsyncCopy_test.py rename to cuda/cuda/bindings/examples/3_CUDA_Features/globalToShmemAsyncCopy_test.py diff --git a/examples/3_CUDA_Features/simpleCudaGraphs_test.py b/cuda/cuda/bindings/examples/3_CUDA_Features/simpleCudaGraphs_test.py similarity index 100% rename from examples/3_CUDA_Features/simpleCudaGraphs_test.py rename to cuda/cuda/bindings/examples/3_CUDA_Features/simpleCudaGraphs_test.py diff --git a/examples/4_CUDA_Libraries/conjugateGradientMultiBlockCG_test.py b/cuda/cuda/bindings/examples/4_CUDA_Libraries/conjugateGradientMultiBlockCG_test.py similarity index 100% rename from examples/4_CUDA_Libraries/conjugateGradientMultiBlockCG_test.py rename to cuda/cuda/bindings/examples/4_CUDA_Libraries/conjugateGradientMultiBlockCG_test.py diff --git a/examples/__init__.py b/cuda/cuda/bindings/examples/__init__.py similarity index 100% rename from examples/__init__.py rename to cuda/cuda/bindings/examples/__init__.py diff --git a/examples/common/common.py b/cuda/cuda/bindings/examples/common/common.py similarity index 100% rename from examples/common/common.py rename to cuda/cuda/bindings/examples/common/common.py diff --git a/examples/common/helper_cuda.py b/cuda/cuda/bindings/examples/common/helper_cuda.py similarity index 100% rename from examples/common/helper_cuda.py rename to cuda/cuda/bindings/examples/common/helper_cuda.py diff --git a/examples/common/helper_string.py b/cuda/cuda/bindings/examples/common/helper_string.py similarity index 100% rename from examples/common/helper_string.py rename to cuda/cuda/bindings/examples/common/helper_string.py diff --git a/examples/extra/isoFDModelling_test.py b/cuda/cuda/bindings/examples/extra/isoFDModelling_test.py similarity index 100% rename from examples/extra/isoFDModelling_test.py rename to cuda/cuda/bindings/examples/extra/isoFDModelling_test.py diff --git a/examples/extra/jit_program_test.py b/cuda/cuda/bindings/examples/extra/jit_program_test.py similarity index 100% rename from examples/extra/jit_program_test.py rename to cuda/cuda/bindings/examples/extra/jit_program_test.py diff --git a/examples/extra/numba_emm_plugin.py b/cuda/cuda/bindings/examples/extra/numba_emm_plugin.py similarity index 100% rename from examples/extra/numba_emm_plugin.py rename to cuda/cuda/bindings/examples/extra/numba_emm_plugin.py diff --git a/examples/setup.cfg b/cuda/cuda/bindings/examples/setup.cfg similarity index 100% rename from examples/setup.cfg rename to cuda/cuda/bindings/examples/setup.cfg From 60c878359c505ad28c6e9597e9012fb14e9e9e9f Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Wed, 11 Sep 2024 22:43:46 +0000 Subject: [PATCH 12/14] add warning for accessing __version__ --- cuda/cuda/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cuda/cuda/__init__.py b/cuda/cuda/__init__.py index e69de29bb2d..8b302752de4 100644 --- a/cuda/cuda/__init__.py +++ b/cuda/cuda/__init__.py @@ -0,0 +1,10 @@ +def __getattr__(name): + if name == "__version__": + import warnings + warnings.warn("accessing cuda.__version__ is deprecated, " + "please switch to use cuda.bindings.__version__ instead", + DeprecationWarning, stacklevel=2) + from . import bindings + return bindings.__version__ + + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") From c7154e1f43286a30699f36d5ebd7aac8eec294c7 Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Mon, 16 Sep 2024 02:00:39 +0000 Subject: [PATCH 13/14] fix .pxd in root namespace not included; build system minor refactor --- cuda/MANIFEST.in | 1 + cuda/setup.py | 65 +++++++++++++++++++++++++++++------------------- 2 files changed, 41 insertions(+), 25 deletions(-) diff --git a/cuda/MANIFEST.in b/cuda/MANIFEST.in index 11505c5a334..e93cc0bd988 100644 --- a/cuda/MANIFEST.in +++ b/cuda/MANIFEST.in @@ -1 +1,2 @@ recursive-include cuda/ *.pyx *.pxd +exclude cuda/bindings diff --git a/cuda/setup.py b/cuda/setup.py index 8747b72150d..2135ee98f62 100644 --- a/cuda/setup.py +++ b/cuda/setup.py @@ -6,18 +6,21 @@ # this software and related documentation outside the terms of the EULA # is strictly prohibited. -from Cython import Tempita -from Cython.Build import cythonize +import glob import os import platform -from pyclibrary import CParser import sys import sysconfig + +from Cython import Tempita +from Cython.Build import cythonize +from pyclibrary import CParser from setuptools import find_packages, setup from setuptools.extension import Extension from setuptools.command.build_ext import build_ext import versioneer + # ---------------------------------------------------------------------- # Fetch configuration options @@ -116,6 +119,7 @@ def unwrapMembers(found_dict): # ---------------------------------------------------------------------- # Generate + def fetch_input_files(path): return [os.path.join(path, f) for f in os.listdir(path) if f.endswith('.in')] @@ -183,25 +187,36 @@ def generate_output(infile, local): # ---------------------------------------------------------------------- # Cythonize -def do_cythonize(sources): +def prep_extensions(sources): + pattern = sources[0] + files = glob.glob(pattern) + exts = [] + for pyx in files: + mod_name = pyx.replace(".pyx", "").replace(os.sep, ".") + exts.append( + Extension( + mod_name, + sources=[pyx, *sources[1:]], + include_dirs=include_dirs, + library_dirs=library_dirs, + runtime_library_dirs=[], + libraries=[], + language="c++", + extra_compile_args=extra_compile_args, + ) + ) + return exts + + +def do_cythonize(extensions): return cythonize( - [ - Extension( - "*", - sources=sources, - include_dirs=include_dirs, - library_dirs=library_dirs, - runtime_library_dirs=[], - libraries=[], - language="c++", - extra_compile_args=extra_compile_args, - ) - ], - nthreads=nthreads, - compiler_directives=dict( - profile=True, language_level=3, embedsignature=True, binding=True - ), - **extra_cythonize_kwargs) + extensions, + nthreads=nthreads, + compiler_directives=dict( + profile=True, language_level=3, embedsignature=True, binding=True + ), + **extra_cythonize_kwargs) + sources_list = [ # private @@ -218,7 +233,7 @@ def do_cythonize(sources): ] for sources in sources_list: - extensions += do_cythonize(sources) + extensions += prep_extensions(sources) # --------------------------------------------------------------------- # Custom build_ext command @@ -244,11 +259,11 @@ def finalize_options(self): setup( version=versioneer.get_version(), - ext_modules=extensions, - packages=find_packages(include=["cuda.*"]), + ext_modules=do_cythonize(extensions), + packages=find_packages(include=["cuda", "cuda.*"]), package_data=dict.fromkeys( find_packages(include=["cuda.*"]), - ["*.pxd", "*.pyx", "*.h", "*.cpp"], + ["*.pxd", "*.pyx", "*.py", "*.h", "*.cpp"], ), cmdclass=cmdclass, zip_safe=False, From 780592ffc4c18873e12d379cf41d1000a7ad72af Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Mon, 16 Sep 2024 02:09:22 +0000 Subject: [PATCH 14/14] add comments --- cuda/MANIFEST.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cuda/MANIFEST.in b/cuda/MANIFEST.in index e93cc0bd988..ef9def92801 100644 --- a/cuda/MANIFEST.in +++ b/cuda/MANIFEST.in @@ -1,2 +1,4 @@ recursive-include cuda/ *.pyx *.pxd +# at least with setuptools 75.0.0 this folder was added erroneously +# to the payload, causing file copying to the build environment failed exclude cuda/bindings