Skip to content

vllm.utils.hpc

Compatibility wrapper for HPC API changes.

Users of vLLM should always import only these wrappers.

Functions:

  • has_hpc

    Return True if hpc package is available.

has_hpc() cached

Return True if hpc package is available.

Source code in vllm/utils/hpc.py
@functools.cache
def has_hpc() -> bool:
    """Return `True` if hpc package is available."""
    # Use find_spec to check if the module exists without importing it
    # This avoids potential CUDA initialization side effects
    if importlib.util.find_spec("hpc") is None:
        logger.warning_once(
            "HPC attention requires the hpc module to be installed. "
            "Please install it from https://github.com/Tencent/hpc-ops"
        )
        return False
    return True