True if a CUDA device is present and the toolkit supports CUDA Graphs. Implies :func:`has_cuda`: ``nvcc.have_cudagraph()`` only checks the toolkit version, so the device guard must be explicit. Gate a test with ``@pytest.mark.skipif(not tvm.testing.env.has_cudagraph(), reason=...)``
()
| 388 | |
| 389 | @functools.cache |
| 390 | def has_cudagraph() -> bool: |
| 391 | """True if a CUDA device is present and the toolkit supports CUDA Graphs. |
| 392 | |
| 393 | Implies :func:`has_cuda`: ``nvcc.have_cudagraph()`` only checks the |
| 394 | toolkit version, so the device guard must be explicit. Gate a test with |
| 395 | ``@pytest.mark.skipif(not tvm.testing.env.has_cudagraph(), reason=...)`` |
| 396 | (add ``@pytest.mark.gpu`` for CI selection). |
| 397 | """ |
| 398 | try: |
| 399 | from tvm.support import nvcc # pylint: disable=import-outside-toplevel |
| 400 | |
| 401 | return has_cuda() and bool(nvcc.have_cudagraph()) |
| 402 | except Exception: # pylint: disable=broad-except |
| 403 | return False |
| 404 | |
| 405 | |
| 406 | # --- toolchain / environment probes ---------------------------------------- |
nothing calls this directly
no test coverage detected
searching dependent graphs…