From acef07f1951add0ce76efeabd2363632f97b86ca Mon Sep 17 00:00:00 2001 From: ksimpson Date: Tue, 29 Oct 2024 15:36:34 -0700 Subject: [PATCH] resolve ruff errors --- cuda_core/cuda/core/__init__.py | 2 +- cuda_core/cuda/core/experimental/__init__.py | 10 +++++----- cuda_core/cuda/core/experimental/_context.py | 3 +-- cuda_core/cuda/core/experimental/_device.py | 3 +-- cuda_core/cuda/core/experimental/_launcher.py | 4 +--- cuda_core/cuda/core/experimental/_memory.py | 1 - cuda_core/cuda/core/experimental/_module.py | 2 +- cuda_core/cuda/core/experimental/_utils.py | 8 +++++--- cuda_core/cuda/core/experimental/utils.py | 1 - cuda_core/tests/example_tests/test_basic_examples.py | 1 - cuda_core/tests/example_tests/utils.py | 1 - 11 files changed, 15 insertions(+), 21 deletions(-) diff --git a/cuda_core/cuda/core/__init__.py b/cuda_core/cuda/core/__init__.py index 715a9d91..2d525167 100644 --- a/cuda_core/cuda/core/__init__.py +++ b/cuda_core/cuda/core/__init__.py @@ -2,4 +2,4 @@ # # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE -from cuda.core._version import __version__ +from cuda.core._version import __version__ as __version__ diff --git a/cuda_core/cuda/core/experimental/__init__.py b/cuda_core/cuda/core/experimental/__init__.py index 9b978398..554fa990 100644 --- a/cuda_core/cuda/core/experimental/__init__.py +++ b/cuda_core/cuda/core/experimental/__init__.py @@ -2,8 +2,8 @@ # # 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 +from cuda.core.experimental._device import Device as Device +from cuda.core.experimental._event import EventOptions as EventOptions +from cuda.core.experimental._launcher import LaunchConfig as LaunchConfig, launch as launch +from cuda.core.experimental._program import Program as Program +from cuda.core.experimental._stream import Stream as Stream, StreamOptions as StreamOptions diff --git a/cuda_core/cuda/core/experimental/_context.py b/cuda_core/cuda/core/experimental/_context.py index 216953ab..3ea389b9 100644 --- a/cuda_core/cuda/core/experimental/_context.py +++ b/cuda_core/cuda/core/experimental/_context.py @@ -4,8 +4,7 @@ from dataclasses import dataclass -from cuda import cuda, cudart -from cuda.core.experimental._utils import handle_return +from cuda import cuda @dataclass diff --git a/cuda_core/cuda/core/experimental/_device.py b/cuda_core/cuda/core/experimental/_device.py index 65d5fe9b..b1433ef0 100644 --- a/cuda_core/cuda/core/experimental/_device.py +++ b/cuda_core/cuda/core/experimental/_device.py @@ -3,8 +3,7 @@ # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE import threading -from typing import Optional, Union -import warnings +from typing import Union from cuda import cuda, cudart from cuda.core.experimental._utils import handle_return, ComputeCapability, CUDAError, \ diff --git a/cuda_core/cuda/core/experimental/_launcher.py b/cuda_core/cuda/core/experimental/_launcher.py index 4b9533cb..1655da4e 100644 --- a/cuda_core/cuda/core/experimental/_launcher.py +++ b/cuda_core/cuda/core/experimental/_launcher.py @@ -6,11 +6,9 @@ import importlib.metadata from typing import Optional, Union -import numpy as np -from cuda import cuda, cudart +from cuda import cuda 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 diff --git a/cuda_core/cuda/core/experimental/_memory.py b/cuda_core/cuda/core/experimental/_memory.py index 4ef2cbc3..6207d861 100644 --- a/cuda_core/cuda/core/experimental/_memory.py +++ b/cuda_core/cuda/core/experimental/_memory.py @@ -6,7 +6,6 @@ import abc from typing import Optional, Tuple, TypeVar -import warnings from cuda import cuda from cuda.core.experimental._dlpack import DLDeviceType, make_py_capsule diff --git a/cuda_core/cuda/core/experimental/_module.py b/cuda_core/cuda/core/experimental/_module.py index 60d4db97..4eacea1c 100644 --- a/cuda_core/cuda/core/experimental/_module.py +++ b/cuda_core/cuda/core/experimental/_module.py @@ -4,7 +4,7 @@ import importlib.metadata -from cuda import cuda, cudart +from cuda import cuda from cuda.core.experimental._utils import handle_return diff --git a/cuda_core/cuda/core/experimental/_utils.py b/cuda_core/cuda/core/experimental/_utils.py index 68571ebc..eea2ede1 100644 --- a/cuda_core/cuda/core/experimental/_utils.py +++ b/cuda_core/cuda/core/experimental/_utils.py @@ -7,12 +7,14 @@ from typing import Callable, Dict from cuda import cuda, cudart, nvrtc +from cuda.core.experimental._device import Device +class CUDAError(Exception): + pass -class CUDAError(Exception): pass - -class NVRTCError(CUDAError): pass +class NVRTCError(CUDAError): + pass ComputeCapability = namedtuple("ComputeCapability", ("major", "minor")) diff --git a/cuda_core/cuda/core/experimental/utils.py b/cuda_core/cuda/core/experimental/utils.py index 74f41e4d..0717b41a 100644 --- a/cuda_core/cuda/core/experimental/utils.py +++ b/cuda_core/cuda/core/experimental/utils.py @@ -2,4 +2,3 @@ # # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE -from cuda.core.experimental._memoryview import StridedMemoryView, viewable diff --git a/cuda_core/tests/example_tests/test_basic_examples.py b/cuda_core/tests/example_tests/test_basic_examples.py index e490892d..75eecde6 100644 --- a/cuda_core/tests/example_tests/test_basic_examples.py +++ b/cuda_core/tests/example_tests/test_basic_examples.py @@ -21,5 +21,4 @@ ) class TestExamples: def test_example(self, example): - filename = os.path.basename(example) run_example(samples_path, example) diff --git a/cuda_core/tests/example_tests/utils.py b/cuda_core/tests/example_tests/utils.py index 5f4e14b0..23a3018c 100644 --- a/cuda_core/tests/example_tests/utils.py +++ b/cuda_core/tests/example_tests/utils.py @@ -6,7 +6,6 @@ # this software and related documentation outside the terms of the EULA # is strictly prohibited. -from cuda import cuda import gc import os import sys