-
Notifications
You must be signed in to change notification settings - Fork 915
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e8b604
commit 35b7e59
Showing
2 changed files
with
87 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Copyright (c) 2023, NVIDIA CORPORATION. | ||
import subprocess | ||
import sys | ||
|
||
import pytest | ||
|
||
IS_CUDA_11 = False | ||
IS_CUDA_12 = False | ||
try: | ||
from ptxcompiler.patch import safe_get_versions | ||
except ModuleNotFoundError: | ||
from cudf.utils._ptxcompiler import safe_get_versions | ||
|
||
versions = safe_get_versions() | ||
driver_version, runtime_version = versions | ||
|
||
if (11, 0) <= driver_version < (12, 0): | ||
IS_CUDA_11 = True | ||
if (12, 0) <= driver_version < (13, 0): | ||
IS_CUDA_12 = True | ||
|
||
|
||
TEST_BODY = """ | ||
@numba.cuda.jit | ||
def test_kernel(x): | ||
id = numba.cuda.grid(1) | ||
if id < len(x): | ||
x[id] += 1 | ||
s = cudf.Series([1, 2, 3]) | ||
with _CUDFNumbaConfig(): | ||
test_kernel.forall(len(s))(s) | ||
""" | ||
|
||
CUDA_11_TEST = ( | ||
""" | ||
import numba.cuda | ||
import cudf | ||
from cudf.utils._numba import _CUDFNumbaConfig, patch_numba_linker_cuda_11 | ||
patch_numba_linker_cuda_11() | ||
""" | ||
+ TEST_BODY | ||
) | ||
|
||
|
||
CUDA_12_TEST = ( | ||
""" | ||
import numba.cuda | ||
import cudf | ||
from cudf.utils._numba import _CUDFNumbaConfig | ||
from pynvjitlink.patch import patch_numba_linker_cuda_12 | ||
patch_numba_linker_cuda_12() | ||
""" | ||
+ TEST_BODY | ||
) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"test", | ||
[ | ||
pytest.param( | ||
CUDA_11_TEST, | ||
marks=pytest.mark.skipif( | ||
not IS_CUDA_11, | ||
reason="Minor Version Compatibility test for CUDA 11", | ||
), | ||
), | ||
pytest.param( | ||
CUDA_12_TEST, | ||
marks=pytest.mark.skipif( | ||
not IS_CUDA_12, | ||
reason="Minor Version Compatibility test for CUDA 12", | ||
), | ||
), | ||
], | ||
) | ||
def test_numba_mvc(test): | ||
cp = subprocess.run( | ||
[sys.executable, "-c", test], | ||
capture_output=True, | ||
cwd="/", | ||
) | ||
|
||
assert cp.returncode == 0 |
This file was deleted.
Oops, something went wrong.