Coverage for cuda / core / experimental / __init__.py: 100.00%

17 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-03-08 01:07 +0000

1# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 

2# 

3# SPDX-License-Identifier: Apache-2.0 

4 

5""" 

6Backward compatibility stubs for cuda.core.experimental namespace. 

7 

8This module provides forwarding stubs that import from the new cuda.core.* 

9locations and emit deprecation warnings. Users should migrate to importing 

10directly from cuda.core instead of cuda.core.experimental. 

11 

12The experimental namespace will be removed in v1.0.0. 

13 

14""" 

15 

16 

17def _warn_deprecated(): 1a

18 """Emit a deprecation warning for using the experimental namespace. 

19 

20 Note: This warning is only when the experimental module is first imported. 

21 Subsequent accesses to attributes (like utils, Device, etc.) do not trigger 

22 additional warnings since they are already set in the module namespace. 

23 """ 

24 import warnings 1a

25 

26 warnings.warn( 1a

27 "The cuda.core.experimental namespace is deprecated. " 

28 "Please import directly from cuda.core instead. " 

29 "For example, use 'from cuda.core import Device' instead of " 

30 "'from cuda.core.experimental import Device'. " 

31 "The experimental namespace will be removed in v1.0.0.", 

32 DeprecationWarning, 

33 stacklevel=3, 

34 ) 

35 

36 

37# Import from new locations and re-export 

38_warn_deprecated() 1a

39 

40 

41from cuda.core import system, utils 1a

42 

43# Make utils accessible as a submodule for backward compatibility 

44__import__("sys").modules[__spec__.name + ".utils"] = utils 1a

45 

46 

47from cuda.core._device import Device 1a

48from cuda.core._event import Event, EventOptions 1a

49from cuda.core._graph import ( 1a

50 Graph, 

51 GraphBuilder, 

52 GraphCompleteOptions, 

53 GraphDebugPrintOptions, 

54) 

55from cuda.core._launch_config import LaunchConfig 1a

56from cuda.core._launcher import launch 1a

57from cuda.core._layout import _StridedLayout 1a

58from cuda.core._linker import Linker, LinkerOptions 1a

59from cuda.core._memory import ( 1a

60 Buffer, 

61 DeviceMemoryResource, 

62 DeviceMemoryResourceOptions, 

63 GraphMemoryResource, 

64 LegacyPinnedMemoryResource, 

65 ManagedMemoryResource, 

66 ManagedMemoryResourceOptions, 

67 MemoryResource, 

68 PinnedMemoryResource, 

69 PinnedMemoryResourceOptions, 

70 VirtualMemoryResource, 

71 VirtualMemoryResourceOptions, 

72) 

73from cuda.core._module import Kernel, ObjectCode 1a

74from cuda.core._program import Program, ProgramOptions 1a

75from cuda.core._stream import Stream, StreamOptions 1a