diff --git a/cuda_bindings/cuda/bindings/_internal/_nvml.pxd b/cuda_bindings/cuda/bindings/_internal/nvml.pxd similarity index 99% rename from cuda_bindings/cuda/bindings/_internal/_nvml.pxd rename to cuda_bindings/cuda/bindings/_internal/nvml.pxd index b04df67558..e62b29b2c8 100644 --- a/cuda_bindings/cuda/bindings/_internal/_nvml.pxd +++ b/cuda_bindings/cuda/bindings/_internal/nvml.pxd @@ -4,7 +4,7 @@ # # This code was automatically generated across versions from 12.9.1 to 13.1.1. Do not modify it directly. -from ..cy_nvml cimport * +from ..cynvml cimport * ############################################################################### diff --git a/cuda_bindings/cuda/bindings/_internal/_nvml_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvml_linux.pyx similarity index 100% rename from cuda_bindings/cuda/bindings/_internal/_nvml_linux.pyx rename to cuda_bindings/cuda/bindings/_internal/nvml_linux.pyx diff --git a/cuda_bindings/cuda/bindings/_internal/_nvml_windows.pyx b/cuda_bindings/cuda/bindings/_internal/nvml_windows.pyx similarity index 100% rename from cuda_bindings/cuda/bindings/_internal/_nvml_windows.pyx rename to cuda_bindings/cuda/bindings/_internal/nvml_windows.pyx diff --git a/cuda_bindings/cuda/bindings/_test_helpers/arch_check.py b/cuda_bindings/cuda/bindings/_test_helpers/arch_check.py index f9666c8a18..e063fd4ff8 100644 --- a/cuda_bindings/cuda/bindings/_test_helpers/arch_check.py +++ b/cuda_bindings/cuda/bindings/_test_helpers/arch_check.py @@ -5,7 +5,7 @@ from contextlib import contextmanager import pytest -from cuda.bindings import _nvml as nvml +from cuda.bindings import nvml @contextmanager diff --git a/cuda_bindings/cuda/bindings/cy_nvml.pxd b/cuda_bindings/cuda/bindings/cynvml.pxd similarity index 100% rename from cuda_bindings/cuda/bindings/cy_nvml.pxd rename to cuda_bindings/cuda/bindings/cynvml.pxd diff --git a/cuda_bindings/cuda/bindings/cy_nvml.pyx b/cuda_bindings/cuda/bindings/cynvml.pyx similarity index 99% rename from cuda_bindings/cuda/bindings/cy_nvml.pyx rename to cuda_bindings/cuda/bindings/cynvml.pyx index 82b4bf88bd..b395a6ac53 100644 --- a/cuda_bindings/cuda/bindings/cy_nvml.pyx +++ b/cuda_bindings/cuda/bindings/cynvml.pyx @@ -4,7 +4,7 @@ # # This code was automatically generated across versions from 12.9.1 to 13.1.1. Do not modify it directly. -from ._internal cimport _nvml as _nvml +from ._internal cimport nvml as _nvml ############################################################################### diff --git a/cuda_bindings/cuda/bindings/_nvml.pxd b/cuda_bindings/cuda/bindings/nvml.pxd similarity index 99% rename from cuda_bindings/cuda/bindings/_nvml.pxd rename to cuda_bindings/cuda/bindings/nvml.pxd index 36ab860e64..6cf00356c8 100644 --- a/cuda_bindings/cuda/bindings/_nvml.pxd +++ b/cuda_bindings/cuda/bindings/nvml.pxd @@ -6,7 +6,7 @@ from libc.stdint cimport intptr_t -from .cy_nvml cimport * +from .cynvml cimport * ############################################################################### diff --git a/cuda_bindings/cuda/bindings/_nvml.pyx b/cuda_bindings/cuda/bindings/nvml.pyx similarity index 100% rename from cuda_bindings/cuda/bindings/_nvml.pyx rename to cuda_bindings/cuda/bindings/nvml.pyx diff --git a/cuda_bindings/tests/nvml/conftest.py b/cuda_bindings/tests/nvml/conftest.py index 3bbbe2cb0a..9b7ef6abd1 100644 --- a/cuda_bindings/tests/nvml/conftest.py +++ b/cuda_bindings/tests/nvml/conftest.py @@ -1,10 +1,10 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE from collections import namedtuple import pytest -from cuda.bindings import _nvml as nvml +from cuda.bindings import nvml from cuda.bindings._test_helpers.arch_check import unsupported_before # noqa: F401 diff --git a/cuda_bindings/tests/nvml/test_compute_mode.py b/cuda_bindings/tests/nvml/test_compute_mode.py index 0e9a67861f..1eb8b08288 100644 --- a/cuda_bindings/tests/nvml/test_compute_mode.py +++ b/cuda_bindings/tests/nvml/test_compute_mode.py @@ -5,7 +5,7 @@ import sys import pytest -from cuda.bindings import _nvml as nvml +from cuda.bindings import nvml from .conftest import unsupported_before diff --git a/cuda_bindings/tests/nvml/test_cuda.py b/cuda_bindings/tests/nvml/test_cuda.py index 7be70a62dc..20ef7ed24e 100644 --- a/cuda_bindings/tests/nvml/test_cuda.py +++ b/cuda_bindings/tests/nvml/test_cuda.py @@ -1,8 +1,8 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE import cuda.bindings.driver as cuda -from cuda.bindings import _nvml as nvml +from cuda.bindings import nvml from .conftest import NVMLInitializer diff --git a/cuda_bindings/tests/nvml/test_device.py b/cuda_bindings/tests/nvml/test_device.py index 96f1777c5f..82030e4408 100644 --- a/cuda_bindings/tests/nvml/test_device.py +++ b/cuda_bindings/tests/nvml/test_device.py @@ -5,7 +5,7 @@ from functools import cache import pytest -from cuda.bindings import _nvml as nvml +from cuda.bindings import nvml from .conftest import unsupported_before diff --git a/cuda_bindings/tests/nvml/test_gpu.py b/cuda_bindings/tests/nvml/test_gpu.py index 6d2c9d2ec7..f692133ce4 100644 --- a/cuda_bindings/tests/nvml/test_gpu.py +++ b/cuda_bindings/tests/nvml/test_gpu.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from cuda.bindings import _nvml as nvml +from cuda.bindings import nvml from . import util from .conftest import unsupported_before diff --git a/cuda_bindings/tests/nvml/test_init.py b/cuda_bindings/tests/nvml/test_init.py index 7970dc380a..8bf95ded0a 100644 --- a/cuda_bindings/tests/nvml/test_init.py +++ b/cuda_bindings/tests/nvml/test_init.py @@ -1,11 +1,11 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE import sys import warnings import pytest -from cuda.bindings import _nvml as nvml +from cuda.bindings import nvml def assert_nvml_is_initialized(): diff --git a/cuda_bindings/tests/nvml/test_nvlink.py b/cuda_bindings/tests/nvml/test_nvlink.py index 99407abc19..d8e782831e 100644 --- a/cuda_bindings/tests/nvml/test_nvlink.py +++ b/cuda_bindings/tests/nvml/test_nvlink.py @@ -1,8 +1,8 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE -from cuda.bindings import _nvml as nvml +from cuda.bindings import nvml def test_nvlink_get_link_count(all_devices): diff --git a/cuda_bindings/tests/nvml/test_page_retirement.py b/cuda_bindings/tests/nvml/test_page_retirement.py index 4aa5260443..2f33c46050 100644 --- a/cuda_bindings/tests/nvml/test_page_retirement.py +++ b/cuda_bindings/tests/nvml/test_page_retirement.py @@ -1,8 +1,8 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE import pytest -from cuda.bindings import _nvml as nvml +from cuda.bindings import nvml from . import util diff --git a/cuda_bindings/tests/nvml/test_pci.py b/cuda_bindings/tests/nvml/test_pci.py index 3e57f0267c..90605783d8 100644 --- a/cuda_bindings/tests/nvml/test_pci.py +++ b/cuda_bindings/tests/nvml/test_pci.py @@ -4,7 +4,7 @@ import contextlib -from cuda.bindings import _nvml as nvml +from cuda.bindings import nvml from .conftest import unsupported_before diff --git a/cuda_bindings/tests/nvml/test_pynvml.py b/cuda_bindings/tests/nvml/test_pynvml.py index 4157bfb772..5a25f66f6f 100644 --- a/cuda_bindings/tests/nvml/test_pynvml.py +++ b/cuda_bindings/tests/nvml/test_pynvml.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE # A set of tests ported from https://github.com/gpuopenanalytics/pynvml/blob/11.5.3/pynvml/tests/test_nvml.py @@ -7,7 +7,7 @@ import time import pytest -from cuda.bindings import _nvml as nvml +from cuda.bindings import nvml from . import util from .conftest import unsupported_before diff --git a/cuda_bindings/tests/nvml/util.py b/cuda_bindings/tests/nvml/util.py index e815231423..545826a2eb 100644 --- a/cuda_bindings/tests/nvml/util.py +++ b/cuda_bindings/tests/nvml/util.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE @@ -6,7 +6,7 @@ import platform from pathlib import Path -from cuda.bindings import _nvml as nvml +from cuda.bindings import nvml current_os = platform.system() if current_os == "VMkernel": diff --git a/cuda_core/cuda/core/system/_device.pyx b/cuda_core/cuda/core/system/_device.pyx index ac633a3fea..f661c4e685 100644 --- a/cuda_core/cuda/core/system/_device.pyx +++ b/cuda_core/cuda/core/system/_device.pyx @@ -8,7 +8,7 @@ from libc.math cimport ceil from multiprocessing import cpu_count from typing import Iterable -from cuda.bindings import _nvml as nvml +from cuda.bindings import nvml from ._nvml_context cimport initialize diff --git a/cuda_core/cuda/core/system/_nvml_context.pyx b/cuda_core/cuda/core/system/_nvml_context.pyx index d6d9c46060..e32ff51835 100644 --- a/cuda_core/cuda/core/system/_nvml_context.pyx +++ b/cuda_core/cuda/core/system/_nvml_context.pyx @@ -1,10 +1,10 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 import threading -from cuda.bindings import _nvml as nvml +from cuda.bindings import nvml from . import exceptions diff --git a/cuda_core/cuda/core/system/_system.pyx b/cuda_core/cuda/core/system/_system.pyx index 3e15420dc8..606c8aed8d 100644 --- a/cuda_core/cuda/core/system/_system.pyx +++ b/cuda_core/cuda/core/system/_system.pyx @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 @@ -19,13 +19,17 @@ else: if CUDA_BINDINGS_NVML_IS_COMPATIBLE: - from cuda.bindings import _nvml as nvml - # TODO: We need to be even more specific than version numbers for development. - # This can be removed once we have a release including everything we need. - for member in ["FieldId", "ClocksEventReasons"]: - if not hasattr(nvml, member): - CUDA_BINDINGS_NVML_IS_COMPATIBLE = False - break + try: + from cuda.bindings import nvml + except ModuleNotFoundError: + CUDA_BINDINGS_NVML_IS_COMPATIBLE = False + else: + # TODO: We need to be even more specific than version numbers for development. + # This can be removed once we have a release including everything we need. + for member in ["FieldId", "ClocksEventReasons"]: + if not hasattr(nvml, member): + CUDA_BINDINGS_NVML_IS_COMPATIBLE = False + break if CUDA_BINDINGS_NVML_IS_COMPATIBLE: from ._nvml_context import initialize diff --git a/cuda_core/cuda/core/system/_system_events.pyx b/cuda_core/cuda/core/system/_system_events.pyx index 8b1a91d7bd..d8a64b619b 100644 --- a/cuda_core/cuda/core/system/_system_events.pyx +++ b/cuda_core/cuda/core/system/_system_events.pyx @@ -1,11 +1,11 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 from libc.stdint cimport intptr_t -from cuda.bindings import _nvml as nvml +from cuda.bindings import nvml from ._nvml_context cimport initialize diff --git a/cuda_core/cuda/core/system/exceptions.py b/cuda_core/cuda/core/system/exceptions.py index 65bcdd27b5..990648e531 100644 --- a/cuda_core/cuda/core/system/exceptions.py +++ b/cuda_core/cuda/core/system/exceptions.py @@ -1,9 +1,9 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 -from cuda.bindings import _nvml as nvml +from cuda.bindings import nvml NvmlError = nvml.NvmlError UninitializedError = nvml.UninitializedError diff --git a/cuda_core/tests/system/test_system_device.py b/cuda_core/tests/system/test_system_device.py index 39eff6176b..7f6996a439 100644 --- a/cuda_core/tests/system/test_system_device.py +++ b/cuda_core/tests/system/test_system_device.py @@ -19,7 +19,7 @@ from cuda.core import system if system.CUDA_BINDINGS_NVML_IS_COMPATIBLE: - from cuda.bindings import _nvml as nvml + from cuda.bindings import nvml from cuda.core.system import DeviceArch, _device