|
5 | 5 |
|
6 | 6 | import numpy as np |
7 | 7 | from common.helper_cuda import checkCudaErrors |
| 8 | +from cuda import pathfinder |
8 | 9 | from cuda.bindings import driver as cuda |
9 | 10 | from cuda.bindings import nvrtc |
10 | 11 | from cuda.bindings import runtime as cudart |
@@ -44,16 +45,16 @@ def pytest_skipif_compute_capability_too_low(devID, required_cc_major_minor): |
44 | 45 |
|
45 | 46 | class KernelHelper: |
46 | 47 | def __init__(self, code, devID): |
47 | | - prog = checkCudaErrors(nvrtc.nvrtcCreateProgram(str.encode(code), b"sourceCode.cu", 0, None, None)) |
| 48 | + include_dirs = [] |
| 49 | + for libname in ("cudart", "cccl"): |
| 50 | + hdr_dir = pathfinder.find_nvidia_header_directory(libname) |
| 51 | + if hdr_dir is None: |
| 52 | + import pytest |
| 53 | + |
| 54 | + pytest.skip(f'pathfinder.find_nvidia_header_directory("{libname}") returned None') |
| 55 | + include_dirs.append(hdr_dir) |
48 | 56 |
|
49 | | - cuda_home = get_cuda_home() |
50 | | - assert cuda_home is not None |
51 | | - cuda_include = os.path.join(cuda_home, "include") |
52 | | - assert os.path.isdir(cuda_include) |
53 | | - include_dirs = [cuda_include] |
54 | | - cccl_include = os.path.join(cuda_include, "cccl") |
55 | | - if os.path.isdir(cccl_include): |
56 | | - include_dirs.insert(0, cccl_include) |
| 57 | + prog = checkCudaErrors(nvrtc.nvrtcCreateProgram(str.encode(code), b"sourceCode.cu", 0, None, None)) |
57 | 58 |
|
58 | 59 | # Initialize CUDA |
59 | 60 | checkCudaErrors(cudart.cudaFree(0)) |
|
0 commit comments