Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions python/sglang/srt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import logging
import os
import pickle
import platform
import random
import re
import resource
Expand Down Expand Up @@ -158,6 +159,15 @@ def is_npu() -> bool:
return hasattr(torch, "npu") and torch.npu.is_available()


def is_cpu() -> bool:
machine = platform.machine().lower()
return (
machine in ("x86_64", "amd64", "i386", "i686")
and hasattr(torch, "cpu")
and torch.cpu.is_available()
)


def is_flashinfer_available():
"""
Check whether flashinfer is available.
Expand Down
Loading