xai-org/x-algorithm · error · ValueError

Unknown GPU architecture: {arch_str}

Error message

Unknown GPU architecture: {arch_str}

What it means

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.

Source

Thrown at phoenix/xrex/utils/gpu.py:42

    GB200 = 5
    GB300 = 6


def string_to_gpu_arch(arch_str: str) -> GpuArch:
    arch_str = arch_str.upper()
    if "H100" in arch_str or not arch_str:
        return GpuArch.H100
    if "H200" in arch_str:
        return GpuArch.H200
    if "A100" in arch_str:
        return GpuArch.A100
    if "GB200" in arch_str:
        return GpuArch.GB200
    if "GB300" in arch_str:
        return GpuArch.GB300
    if "CPU" in arch_str:
        return GpuArch.CPU
    raise ValueError(f"Unknown GPU architecture: {arch_str}")


def _check_cuda_errors(status):
    if status != 0:
        raise RuntimeError(f"CUDA error: {status}")


@cache
def gpu_arch():
    arch_env = os.getenv("MACHINE_TYPE", "").strip()
    if arch_env:
        return string_to_gpu_arch(arch_env)

    try:
        cuda_lib = None
        legal_driver_paths = [
            "/usr/lib/aarch64-linux-gnu/libcuda.so",
            "/usr/lib/x86_64-linux-gnu/libcuda.so",

View on GitHub (pinned to 24c60942c5)

Solutions

  1. Set MACHINE_TYPE to a recognized string containing a known token (A100/H100/H200/B200/GB200/GB300/CPU)
  2. Clear MACHINE_TYPE so detection falls through to CUDA device-name probing
  3. If the hardware is genuinely new, add its token to string_to_gpu_arch and GpuArch

Example fix

# before
os.environ['MACHINE_TYPE'] = 'my-custom-box'
# after
os.environ['MACHINE_TYPE'] = ''  # let CUDA probing detect H100
Defensive patterns

Strategy: validation

Validate before calling

KNOWN = ('A100','H100','H200','B200','GB200','GB300','CPU')
mt = os.getenv('MACHINE_TYPE','')
if mt and not any(k in mt for k in KNOWN):
    os.environ.pop('MACHINE_TYPE')  # fall back to CUDA probing

Type guard

def machine_type_recognized(s: str) -> bool:
    return any(k in s for k in ('A100','H100','H200','B200','GB200','GB300','CPU'))

Prevention

When it happens

Trigger: 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.

Common situations: Running on newer hardware not yet in the mapping (e.g. B100); typos in MACHINE_TYPE; scheduler templates with custom machine names.

Related errors


AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28). Data as JSON: /api/errors/3e5cc434c221db9c. Report an issue: GitHub.