{"record":{"id":"3e5cc434c221db9c","repo":"xai-org/x-algorithm","slug":"unknown-gpu-architecture-arch-str","errorCode":null,"errorMessage":"Unknown GPU architecture: {arch_str}","messagePattern":"Unknown GPU architecture: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phoenix/xrex/utils/gpu.py","lineNumber":42,"sourceCode":"    GB200 = 5\n    GB300 = 6\n\n\ndef string_to_gpu_arch(arch_str: str) -> GpuArch:\n    arch_str = arch_str.upper()\n    if \"H100\" in arch_str or not arch_str:\n        return GpuArch.H100\n    if \"H200\" in arch_str:\n        return GpuArch.H200\n    if \"A100\" in arch_str:\n        return GpuArch.A100\n    if \"GB200\" in arch_str:\n        return GpuArch.GB200\n    if \"GB300\" in arch_str:\n        return GpuArch.GB300\n    if \"CPU\" in arch_str:\n        return GpuArch.CPU\n    raise ValueError(f\"Unknown GPU architecture: {arch_str}\")\n\n\ndef _check_cuda_errors(status):\n    if status != 0:\n        raise RuntimeError(f\"CUDA error: {status}\")\n\n\n@cache\ndef gpu_arch():\n    arch_env = os.getenv(\"MACHINE_TYPE\", \"\").strip()\n    if arch_env:\n        return string_to_gpu_arch(arch_env)\n\n    try:\n        cuda_lib = None\n        legal_driver_paths = [\n            \"/usr/lib/aarch64-linux-gnu/libcuda.so\",\n            \"/usr/lib/x86_64-linux-gnu/libcuda.so\",","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/phoenix/xrex/utils/gpu.py#L24-L60","documentation":"string_to_gpu_arch maps a machine-type string (e.g. from MACHINE_TYPE) to a GpuArch enum by substring matching (H100, GB200, GB300, CPU, ...). Any string containing none of the known tokens raises ValueError with the offending string.","triggerScenarios":"Setting MACHINE_TYPE to an unrecognized value (e.g. 'g5.xlarge' or 'tpu-v4') such that the substring checks all fail; also hit via gpu_arch() which calls this when MACHINE_TYPE is set.","commonSituations":"Running on newer hardware not yet in the mapping (e.g. B100); typos in MACHINE_TYPE; scheduler templates with custom machine names.","solutions":["Set MACHINE_TYPE to a recognized string containing a known token (A100/H100/H200/B200/GB200/GB300/CPU)","Clear MACHINE_TYPE so detection falls through to CUDA device-name probing","If the hardware is genuinely new, add its token to string_to_gpu_arch and GpuArch"],"exampleFix":"# before\nos.environ['MACHINE_TYPE'] = 'my-custom-box'\n# after\nos.environ['MACHINE_TYPE'] = ''  # let CUDA probing detect H100","handlingStrategy":"validation","validationCode":"KNOWN = ('A100','H100','H200','B200','GB200','GB300','CPU')\nmt = os.getenv('MACHINE_TYPE','')\nif mt and not any(k in mt for k in KNOWN):\n    os.environ.pop('MACHINE_TYPE')  # fall back to CUDA probing","typeGuard":"def machine_type_recognized(s: str) -> bool:\n    return any(k in s for k in ('A100','H100','H200','B200','GB200','GB300','CPU'))","tryCatchPattern":null,"preventionTips":["Set MACHINE_TYPE only to recognized values in job templates","Validate env-driven config at startup","Update the mapping when adopting new hardware"],"tags":["gpu","environment-variable","hardware-detection"],"backgroundTag":"unrecognized-hardware","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}