{"record":{"id":"9501ddedbde008bc","repo":"jax-ml/jax","slug":"cudnn-is-not-detected","errorCode":null,"errorMessage":"cuDNN is not detected.","messagePattern":"cuDNN is not detected\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"jax/_src/cudnn/fused_attention_stablehlo.py","lineNumber":407,"sourceCode":"          )\n\n        # Check patterns with bias, seqlen should be divisible by 2\n        if (is_training and has_bias and (T % 2 != 0 or S % 2 != 0)):\n          raise NotImplementedError(\n              f\"Unsupported sequence length Q {T}, KV {S}.\"\n          )\n\n        if is_packed and  not check_compute_capability(\"9.0\"):\n          raise NotImplementedError(\n            \"Packed layout requires a GPU with at least Hopper architecture.\")\n        if is_mla and (cudnn_version < 91000 or not check_compute_capability(\"9.0\")):\n          raise NotImplementedError(\n            \"mla requires cudnn version >= 9.10 and at least hopper arch.\")\n\ndef check_cudnn_version():\n  # check if cuDNN is installed\n  if cuda_versions is None:\n    raise RuntimeError(\"cuDNN is not detected.\")\n  return cuda_versions.cudnn_get_version()\n\ndef check_compute_capability(capability):\n  if not 'cuda' in xla_bridge.get_backend().platform_version:\n    return False\n  d, *_ = xla_bridge.local_devices(backend=\"gpu\")\n  target = tuple(int(x) for x in capability.split(\".\"))\n  current = tuple(int(x) for x in d.compute_capability.split(\".\"))\n  return current >= target\n\ndef is_cuda_compute_capability_equal(capability):\n  if not 'cuda' in xla_bridge.get_backend().platform_version:\n    return False\n  d, *_ = xla_bridge.local_devices(backend=\"gpu\")\n  target = tuple(int(x) for x in capability.split(\".\"))\n  current = tuple(int(x) for x in d.compute_capability.split(\".\"))\n  return current == target\n","sourceCodeStart":389,"sourceCodeEnd":425,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/cudnn/fused_attention_stablehlo.py#L389-L425","documentation":"Raised by check_cudnn_version when JAX cannot detect a cuDNN installation at all (cuda_versions is None). The cuDNN fused attention feature requires cuDNN; without it the API refuses to run instead of failing deep inside XLA.","triggerScenarios":"Calling jax.nn.dot_product_attention (cuDNN path), paged_attention, or the related tests on a machine where cuDNN is not installed or not discoverable by JAX (CPU-only JAX, missing nvidia-cudnn wheel, broken LD_LIBRARY_PATH).","commonSituations":"Installed jax (CPU) instead of jax[cuda12]/jax_cuda12_plugin; pip CUDA package set without the matching nvidia-cudnn-cu12 wheel; conda environments with cuDNN not on the loader path; slim docker images.","solutions":["Install GPU-enabled JAX with bundled deps: pip install -U 'jax[cuda12]'","If using pip CUDA wheels, add nvidia-cudnn-cu12 and ensure its lib dir is on LD_LIBRARY_PATH (or rely on the jax[cuda12] extra)","Verify detection: python -c 'from jax._src.cudnn.fused_attention_stablehlo import check_cudnn_version; print(check_cudnn_version())'","If running a JAX build that supports a different CUDA version, align CUDA/cuDNN/JAX versions per the JAX installation guide"],"exampleFix":"# before: jax installed CPU-only -> RuntimeError: cuDNN is not detected.\npip install jax\n\n# after\npip install -U \"jax[cuda12]\"","handlingStrategy":"validation","validationCode":"from jax._src.cudnn.fused_attention_stablehlo import check_cudnn_version\ndef require_cudnn():\n    try:\n        return check_cudnn_version()\n    except RuntimeError as e:\n        raise RuntimeError(f\"Install jax[cuda12] with cuDNN: {e}\") from e","typeGuard":null,"tryCatchPattern":"try:\n    check_cudnn_version()\nexcept RuntimeError:\n    # fall back to non-cuDNN attention path\n    out = fallback_attention(q, k, v)","preventionTips":["Install GPU JAX via pip install 'jax[cuda12]' rather than bare jax","Smoke-test cuDNN detection in container entrypoints before long training runs"],"tags":["jax","cudnn","installation","environment","missing-dependency"],"backgroundTag":"missing-library-install","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}