{
  "id": "cuda/cuda-error-invalid-resource-type",
  "signature": "CUDA error: invalid resource type (cudaErrorInvalidResourceType)",
  "signature_zh": "CUDA 错误：无效的资源类型 (cudaErrorInvalidResourceType)",
  "regex": "CUDA error: invalid resource type",
  "domain": "cuda",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "An invalid enum value was passed to a CUDA resource management API (e.g., cudaImportExternalMemory or cudaDestroyExternalSemaphore), often due to a mismatch between host and device pointer types or an out-of-date driver.",
  "root_cause_type": "generic",
  "root_cause_zh": "向 CUDA 资源管理 API（例如 cudaImportExternalMemory 或 cudaDestroyExternalSemaphore）传递了无效的枚举值，通常是由于主机和设备指针类型不匹配或驱动程序过时。",
  "versions": [
    {
      "version": "CUDA 12.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "CUDA 12.4",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "NVIDIA Driver 550.54.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PyTorch 2.3.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "TensorFlow 2.15.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The error is not related to compute capability but to the resource type enum values; recompilation does not fix mismatched enums.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Casting only hides the warning; the underlying invalid value still causes the driver to reject the operation.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Update the NVIDIA driver to the latest version (e.g., 550.54.10 or newer) and ensure the CUDA toolkit version matches the driver: `nvidia-smi | grep 'CUDA Version'; sudo apt-get install --only-upgrade nvidia-driver-550`",
      "success_rate": 0.85,
      "how": "Update the NVIDIA driver to the latest version (e.g., 550.54.10 or newer) and ensure the CUDA toolkit version matches the driver: `nvidia-smi | grep 'CUDA Version'; sudo apt-get install --only-upgrade nvidia-driver-550`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Verify the resource type enum used in the code matches the CUDA API documentation. For example, when using cudaExternalMemoryHandleDesc, ensure the type field is set to a valid value like cudaExternalMemoryHandleTypeOpaqueFd (1).",
      "success_rate": 0.8,
      "how": "Verify the resource type enum used in the code matches the CUDA API documentation. For example, when using cudaExternalMemoryHandleDesc, ensure the type field is set to a valid value like cudaExternalMemoryHandleTypeOpaqueFd (1).",
      "condition": "",
      "sources": []
    },
    {
      "action": "Add a check for driver version compatibility before calling the API: `int driverVersion; cudaDriverGetVersion(&driverVersion); if (driverVersion < 12020) { /* handle older driver */ }`",
      "success_rate": 0.75,
      "how": "Add a check for driver version compatibility before calling the API: `int driverVersion; cudaDriverGetVersion(&driverVersion); if (driverVersion < 12020) { /* handle older driver */ }`",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Update the NVIDIA driver to the latest version (e.g., 550.54.10 or newer) and ensure the CUDA toolkit version matches the driver: `nvidia-smi | grep 'CUDA Version'; sudo apt-get install --only-upgrade nvidia-driver-550`",
    "Verify the resource type enum used in the code matches the CUDA API documentation. For example, when using cudaExternalMemoryHandleDesc, ensure the type field is set to a valid value like cudaExternalMemoryHandleTypeOpaqueFd (1).",
    "Add a check for driver version compatibility before calling the API: `int driverVersion; cudaDriverGetVersion(&driverVersion); if (driverVersion < 12020) { /* handle older driver */ }`"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html",
  "official_doc_section": null,
  "error_code": "cudaErrorInvalidResourceType (801)",
  "verification_tier": "ai_generated",
  "confidence": 0.83,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-09-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}