Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 *


###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/cuda/bindings/_test_helpers/arch_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from contextlib import contextmanager

import pytest
from cuda.bindings import _nvml as nvml
from cuda.bindings import nvml


@contextmanager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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


###############################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from libc.stdint cimport intptr_t

from .cy_nvml cimport *
from .cynvml cimport *


###############################################################################
Expand Down
4 changes: 2 additions & 2 deletions cuda_bindings/tests/nvml/conftest.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/tests/nvml/test_compute_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions cuda_bindings/tests/nvml/test_cuda.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/tests/nvml/test_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/tests/nvml/test_gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cuda_bindings/tests/nvml/test_init.py
Original file line number Diff line number Diff line change
@@ -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():
Expand Down
4 changes: 2 additions & 2 deletions cuda_bindings/tests/nvml/test_nvlink.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
4 changes: 2 additions & 2 deletions cuda_bindings/tests/nvml/test_page_retirement.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/tests/nvml/test_pci.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import contextlib

from cuda.bindings import _nvml as nvml
from cuda.bindings import nvml

from .conftest import unsupported_before

Expand Down
4 changes: 2 additions & 2 deletions cuda_bindings/tests/nvml/test_pynvml.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cuda_bindings/tests/nvml/util.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# 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 functools
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":
Expand Down
2 changes: 1 addition & 1 deletion cuda_core/cuda/core/system/_device.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions cuda_core/cuda/core/system/_nvml_context.pyx
Original file line number Diff line number Diff line change
@@ -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

Expand Down
20 changes: 12 additions & 8 deletions cuda_core/cuda/core/system/_system.pyx
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cuda_core/cuda/core/system/_system_events.pyx
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions cuda_core/cuda/core/system/exceptions.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion cuda_core/tests/system/test_system_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Loading