File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
33
4- # To regenerate the dictionary below run:
5- # ../../../../../toolshed/reformat_cuda_enums_as_py.py /usr/local/cuda/include/cuda.h
6- # Replace the dictionary below with the output.
7- # Also update the CUDA Toolkit version number below.
8-
4+ # Fallback copy -- overridden from cuda.bindings below when available.
95# CUDA Toolkit v13.2.0
106DRIVER_CU_RESULT_EXPLANATIONS = {
117 0 : (
356352 ),
357353 999 : "This indicates that an unknown internal error has occurred." ,
358354}
355+
356+ # Prefer the authoritative copy from cuda.bindings when available.
357+ try :
358+ import cuda .bindings ._utils .driver_cu_result_explanations as _authoritative
359+ except ModuleNotFoundError :
360+ pass
361+ else :
362+ DRIVER_CU_RESULT_EXPLANATIONS = _authoritative .DRIVER_CU_RESULT_EXPLANATIONS
Original file line number Diff line number Diff line change 11# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
33
4- # To regenerate the dictionary below run:
5- # ../../../../../toolshed/reformat_cuda_enums_as_py.py /usr/local/cuda/include/driver_types.h
6- # Replace the dictionary below with the output.
7- # Also update the CUDA Toolkit version number below.
8-
4+ # Fallback copy -- overridden from cuda.bindings below when available.
95# CUDA Toolkit v13.2.0
106RUNTIME_CUDA_ERROR_EXPLANATIONS = {
117 0 : (
549545 " This error return is deprecated as of CUDA 4.1."
550546 ),
551547}
548+
549+ # Prefer the authoritative copy from cuda.bindings when available.
550+ try :
551+ import cuda .bindings ._utils .runtime_cuda_error_explanations as _authoritative
552+ except ModuleNotFoundError :
553+ pass
554+ else :
555+ RUNTIME_CUDA_ERROR_EXPLANATIONS = _authoritative .RUNTIME_CUDA_ERROR_EXPLANATIONS
Original file line number Diff line number Diff line change 1111from cuda .core ._utils .clear_error_support import assert_type_str_or_bytes_like , raise_code_path_meant_to_be_unreachable
1212
1313
14+ def test_driver_cu_result_explanations_smoke ():
15+ expl = cuda_utils .DRIVER_CU_RESULT_EXPLANATIONS
16+ for code in (0 , 1 , 2 ):
17+ assert code in expl
18+ assert isinstance (expl [code ], str )
19+
20+
21+ def test_runtime_cuda_error_explanations_smoke ():
22+ expl = cuda_utils .RUNTIME_CUDA_ERROR_EXPLANATIONS
23+ for code in (0 , 1 , 2 ):
24+ assert code in expl
25+ assert isinstance (expl [code ], str )
26+
27+
1428def test_check_driver_error ():
1529 num_unexpected = 0
1630 for error in driver .CUresult :
You can’t perform that action at this time.
0 commit comments