diff --git a/cuda_core/cuda/core/__init__.py b/cuda_core/cuda/core/__init__.py index cec6e8d981..715a9d9166 100644 --- a/cuda_core/cuda/core/__init__.py +++ b/cuda_core/cuda/core/__init__.py @@ -2,9 +2,4 @@ # # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE -from cuda.core._device import Device -from cuda.core._event import EventOptions -from cuda.core._launcher import LaunchConfig, launch -from cuda.core._program import Program -from cuda.core._stream import Stream, StreamOptions from cuda.core._version import __version__ diff --git a/cuda_core/cuda/core/experimental/__init__.pxd b/cuda_core/cuda/core/experimental/__init__.pxd new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cuda_core/cuda/core/experimental/__init__.py b/cuda_core/cuda/core/experimental/__init__.py new file mode 100644 index 0000000000..9b978398da --- /dev/null +++ b/cuda_core/cuda/core/experimental/__init__.py @@ -0,0 +1,9 @@ +# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED. +# +# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE + +from cuda.core.experimental._device import Device +from cuda.core.experimental._event import EventOptions +from cuda.core.experimental._launcher import LaunchConfig, launch +from cuda.core.experimental._program import Program +from cuda.core.experimental._stream import Stream, StreamOptions diff --git a/cuda_core/cuda/core/_context.py b/cuda_core/cuda/core/experimental/_context.py similarity index 91% rename from cuda_core/cuda/core/_context.py rename to cuda_core/cuda/core/experimental/_context.py index 5d0f5adf82..216953abac 100644 --- a/cuda_core/cuda/core/_context.py +++ b/cuda_core/cuda/core/experimental/_context.py @@ -5,7 +5,7 @@ from dataclasses import dataclass from cuda import cuda, cudart -from cuda.core._utils import handle_return +from cuda.core.experimental._utils import handle_return @dataclass diff --git a/cuda_core/cuda/core/_device.py b/cuda_core/cuda/core/experimental/_device.py similarity index 94% rename from cuda_core/cuda/core/_device.py rename to cuda_core/cuda/core/experimental/_device.py index 1268da32c1..65d5fe9bc8 100644 --- a/cuda_core/cuda/core/_device.py +++ b/cuda_core/cuda/core/experimental/_device.py @@ -7,11 +7,11 @@ import warnings from cuda import cuda, cudart -from cuda.core._utils import handle_return, ComputeCapability, CUDAError, \ +from cuda.core.experimental._utils import handle_return, ComputeCapability, CUDAError, \ precondition -from cuda.core._context import Context, ContextOptions -from cuda.core._memory import _DefaultAsyncMempool, Buffer, MemoryResource -from cuda.core._stream import default_stream, Stream, StreamOptions +from cuda.core.experimental._context import Context, ContextOptions +from cuda.core.experimental._memory import _DefaultAsyncMempool, Buffer, MemoryResource +from cuda.core.experimental._stream import default_stream, Stream, StreamOptions _tls = threading.local() @@ -125,7 +125,7 @@ def set_current(self, ctx: Context=None) -> Union[Context, None]: Entry point of this object. Users always start a code by calling this method, e.g. - >>> from cuda.core import Device + >>> from cuda.core.experimental import Device >>> dev0 = Device(0) >>> dev0.set_current() >>> # ... do work on device 0 ... diff --git a/cuda_core/cuda/core/_dlpack.pxd b/cuda_core/cuda/core/experimental/_dlpack.pxd similarity index 100% rename from cuda_core/cuda/core/_dlpack.pxd rename to cuda_core/cuda/core/experimental/_dlpack.pxd diff --git a/cuda_core/cuda/core/_dlpack.pyx b/cuda_core/cuda/core/experimental/_dlpack.pyx similarity index 100% rename from cuda_core/cuda/core/_dlpack.pyx rename to cuda_core/cuda/core/experimental/_dlpack.pyx diff --git a/cuda_core/cuda/core/_event.py b/cuda_core/cuda/core/experimental/_event.py similarity index 94% rename from cuda_core/cuda/core/_event.py rename to cuda_core/cuda/core/experimental/_event.py index 5fbacae1dd..3c85d9fe36 100644 --- a/cuda_core/cuda/core/_event.py +++ b/cuda_core/cuda/core/experimental/_event.py @@ -6,9 +6,9 @@ from typing import Optional from cuda import cuda -from cuda.core._utils import check_or_create_options -from cuda.core._utils import CUDAError -from cuda.core._utils import handle_return +from cuda.core.experimental._utils import check_or_create_options +from cuda.core.experimental._utils import CUDAError +from cuda.core.experimental._utils import handle_return @dataclass diff --git a/cuda_core/cuda/core/_kernel_arg_handler.pyx b/cuda_core/cuda/core/experimental/_kernel_arg_handler.pyx similarity index 99% rename from cuda_core/cuda/core/_kernel_arg_handler.pyx rename to cuda_core/cuda/core/experimental/_kernel_arg_handler.pyx index f2d392a83c..15846282eb 100644 --- a/cuda_core/cuda/core/_kernel_arg_handler.pyx +++ b/cuda_core/cuda/core/experimental/_kernel_arg_handler.pyx @@ -15,7 +15,7 @@ import ctypes import numpy -from cuda.core._memory import Buffer +from cuda.core.experimental._memory import Buffer ctypedef cpp_complex.complex[float] cpp_single_complex diff --git a/cuda_core/cuda/core/_launcher.py b/cuda_core/cuda/core/experimental/_launcher.py similarity index 90% rename from cuda_core/cuda/core/_launcher.py rename to cuda_core/cuda/core/experimental/_launcher.py index 03d7fc0873..614fabcf1b 100644 --- a/cuda_core/cuda/core/_launcher.py +++ b/cuda_core/cuda/core/experimental/_launcher.py @@ -8,11 +8,11 @@ import numpy as np from cuda import cuda, cudart -from cuda.core._kernel_arg_handler import ParamHolder -from cuda.core._memory import Buffer -from cuda.core._module import Kernel -from cuda.core._stream import Stream -from cuda.core._utils import CUDAError, check_or_create_options, handle_return +from cuda.core.experimental._kernel_arg_handler import ParamHolder +from cuda.core.experimental._memory import Buffer +from cuda.core.experimental._module import Kernel +from cuda.core.experimental._stream import Stream +from cuda.core.experimental._utils import CUDAError, check_or_create_options, handle_return @dataclass diff --git a/cuda_core/cuda/core/_memory.py b/cuda_core/cuda/core/experimental/_memory.py similarity index 97% rename from cuda_core/cuda/core/_memory.py rename to cuda_core/cuda/core/experimental/_memory.py index 0d5dd0d16d..4ef2cbc3d1 100644 --- a/cuda_core/cuda/core/_memory.py +++ b/cuda_core/cuda/core/experimental/_memory.py @@ -9,9 +9,9 @@ import warnings from cuda import cuda -from cuda.core._dlpack import DLDeviceType, make_py_capsule -from cuda.core._stream import default_stream -from cuda.core._utils import handle_return +from cuda.core.experimental._dlpack import DLDeviceType, make_py_capsule +from cuda.core.experimental._stream import default_stream +from cuda.core.experimental._utils import handle_return PyCapsule = TypeVar("PyCapsule") diff --git a/cuda_core/cuda/core/_memoryview.pyx b/cuda_core/cuda/core/experimental/_memoryview.pyx similarity index 99% rename from cuda_core/cuda/core/_memoryview.pyx rename to cuda_core/cuda/core/experimental/_memoryview.pyx index 8f7cc9480b..1f46734436 100644 --- a/cuda_core/cuda/core/_memoryview.pyx +++ b/cuda_core/cuda/core/experimental/_memoryview.pyx @@ -12,7 +12,7 @@ from typing import Any, Optional from cuda import cuda import numpy -from cuda.core._utils import handle_return +from cuda.core.experimental._utils import handle_return # TODO(leofang): support NumPy structured dtypes diff --git a/cuda_core/cuda/core/_module.py b/cuda_core/cuda/core/experimental/_module.py similarity index 97% rename from cuda_core/cuda/core/_module.py rename to cuda_core/cuda/core/experimental/_module.py index 9892636397..a179faf826 100644 --- a/cuda_core/cuda/core/_module.py +++ b/cuda_core/cuda/core/experimental/_module.py @@ -3,7 +3,7 @@ # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE from cuda import cuda, cudart -from cuda.core._utils import handle_return +from cuda.core.experimental._utils import handle_return _backend = { diff --git a/cuda_core/cuda/core/_program.py b/cuda_core/cuda/core/experimental/_program.py similarity index 96% rename from cuda_core/cuda/core/_program.py rename to cuda_core/cuda/core/experimental/_program.py index 0c0f02d779..b6271544b1 100644 --- a/cuda_core/cuda/core/_program.py +++ b/cuda_core/cuda/core/experimental/_program.py @@ -3,8 +3,8 @@ # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE from cuda import nvrtc -from cuda.core._utils import handle_return -from cuda.core._module import ObjectCode +from cuda.core.experimental._utils import handle_return +from cuda.core.experimental._module import ObjectCode class Program: diff --git a/cuda_core/cuda/core/_stream.py b/cuda_core/cuda/core/experimental/_stream.py similarity index 95% rename from cuda_core/cuda/core/_stream.py rename to cuda_core/cuda/core/experimental/_stream.py index e815f9a82f..95f8ec501a 100644 --- a/cuda_core/cuda/core/_stream.py +++ b/cuda_core/cuda/core/experimental/_stream.py @@ -9,13 +9,13 @@ from typing import Optional, Tuple, TYPE_CHECKING, Union if TYPE_CHECKING: - from cuda.core._device import Device + from cuda.core.experimental._device import Device from cuda import cuda, cudart -from cuda.core._context import Context -from cuda.core._event import Event, EventOptions -from cuda.core._utils import check_or_create_options -from cuda.core._utils import get_device_from_ctx -from cuda.core._utils import handle_return +from cuda.core.experimental._context import Context +from cuda.core.experimental._event import Event, EventOptions +from cuda.core.experimental._utils import check_or_create_options +from cuda.core.experimental._utils import get_device_from_ctx +from cuda.core.experimental._utils import handle_return @dataclass @@ -181,7 +181,7 @@ def device(self) -> Device: # Note that Stream.device.context might not necessarily agree with # Stream.context, in cases where a different CUDA context is set # current after a stream was created. - from cuda.core._device import Device # avoid circular import + from cuda.core.experimental._device import Device # avoid circular import if self._device_id is None: # Get the stream context first if self._ctx_handle is None: diff --git a/cuda_core/cuda/core/_utils.py b/cuda_core/cuda/core/experimental/_utils.py similarity index 100% rename from cuda_core/cuda/core/_utils.py rename to cuda_core/cuda/core/experimental/_utils.py diff --git a/cuda_core/cuda/core/dlpack.h b/cuda_core/cuda/core/experimental/dlpack.h similarity index 100% rename from cuda_core/cuda/core/dlpack.h rename to cuda_core/cuda/core/experimental/dlpack.h diff --git a/cuda_core/cuda/core/utils.py b/cuda_core/cuda/core/experimental/utils.py similarity index 65% rename from cuda_core/cuda/core/utils.py rename to cuda_core/cuda/core/experimental/utils.py index 3debe1dfad..74f41e4d35 100644 --- a/cuda_core/cuda/core/utils.py +++ b/cuda_core/cuda/core/experimental/utils.py @@ -2,4 +2,4 @@ # # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE -from cuda.core._memoryview import StridedMemoryView, viewable +from cuda.core.experimental._memoryview import StridedMemoryView, viewable diff --git a/cuda_core/docs/source/api.rst b/cuda_core/docs/source/api.rst index 1f4b8a69aa..756ed77617 100644 --- a/cuda_core/docs/source/api.rst +++ b/cuda_core/docs/source/api.rst @@ -1,7 +1,7 @@ -.. module:: cuda.core +.. module:: cuda.core.experimental -``cuda.core`` API Reference -=========================== +``cuda.core.experimental`` API Reference +======================================== CUDA runtime ------------ diff --git a/cuda_core/examples/saxpy.py b/cuda_core/examples/saxpy.py index 7d296deba1..37ad493300 100644 --- a/cuda_core/examples/saxpy.py +++ b/cuda_core/examples/saxpy.py @@ -4,9 +4,9 @@ import sys -from cuda.core import Device -from cuda.core import LaunchConfig, launch -from cuda.core import Program +from cuda.core.experimental import Device +from cuda.core.experimental import LaunchConfig, launch +from cuda.core.experimental import Program import cupy as cp diff --git a/cuda_core/examples/vector_add.py b/cuda_core/examples/vector_add.py index 8248ad3b0d..baee409aac 100644 --- a/cuda_core/examples/vector_add.py +++ b/cuda_core/examples/vector_add.py @@ -2,9 +2,9 @@ # # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE -from cuda.core import Device -from cuda.core import LaunchConfig, launch -from cuda.core import Program +from cuda.core.experimental import Device +from cuda.core.experimental import LaunchConfig, launch +from cuda.core.experimental import Program import cupy as cp diff --git a/cuda_core/pyproject.toml b/cuda_core/pyproject.toml index cf1e5b4e96..2b497245c4 100644 --- a/cuda_core/pyproject.toml +++ b/cuda_core/pyproject.toml @@ -46,8 +46,8 @@ dependencies = [ ] -[tool.setuptools] -packages = ["cuda", "cuda.core"] +[tool.setuptools.packages.find] +include = ["cuda.core*"] [tool.setuptools.dynamic] diff --git a/cuda_core/setup.py b/cuda_core/setup.py index 862d38d372..8d20f2c944 100644 --- a/cuda_core/setup.py +++ b/cuda_core/setup.py @@ -5,24 +5,24 @@ import os from Cython.Build import cythonize -from setuptools import setup, Extension, find_packages +from setuptools import setup, Extension from setuptools.command.build_ext import build_ext as _build_ext ext_modules = ( Extension( - "cuda.core._dlpack", - sources=["cuda/core/_dlpack.pyx"], + "cuda.core.experimental._dlpack", + sources=["cuda/core/experimental/_dlpack.pyx"], language="c++", ), Extension( - "cuda.core._memoryview", - sources=["cuda/core/_memoryview.pyx"], + "cuda.core.experimental._memoryview", + sources=["cuda/core/experimental/_memoryview.pyx"], language="c++", ), Extension( - "cuda.core._kernel_arg_handler", - sources=["cuda/core/_kernel_arg_handler.pyx"], + "cuda.core.experimental._kernel_arg_handler", + sources=["cuda/core/experimental/_kernel_arg_handler.pyx"], language="c++", ), ) @@ -39,11 +39,6 @@ def build_extensions(self): ext_modules=cythonize(ext_modules, verbose=True, language_level=3, compiler_directives={'embedsignature': True}), - packages=find_packages(include=['cuda.core', 'cuda.core.*']), - package_data=dict.fromkeys( - find_packages(include=["cuda.core.*"]), - ["*.pxd", "*.pyx", "*.py"], - ), cmdclass = {'build_ext': build_ext,}, zip_safe=False, )