vllm v1 源码解析 —— 单机八卡推理

单机八卡,我们按照PP + TP的方式来进行方案说明,使用的是vllm框架,主要命令和函数如下: python single_node_multi_gpu_demo.py --mode pipeline_parallel --tensor-parallel 4 --pipeline-parallel 2 --model facebook/opt-13b def pipeline_parallel_inference(self, model_name: str, tensor_parallel_size: int, pipeline_parallel_size: int): “““流水线并行推理 - 将模型层分布到多个GPU上””” print(f"🚀 启动流水线并行推理 - 模型: {model_name}") print(f" 张量并行: {tensor_parallel_size}, 流水线并行: {pipeline_parallel_size}") ...

September 26, 2025 · 5 min

vllm v1 源码解析 —— Core

一个client建立之后就会建立一个core engine,这些配置会通过QMZ IPC发送给core engine。 Core engine Architecture Worker and Executor MultiprocExecutor在MultiprocExecutor类中,可以清晰的找到三部曲: 1、创建RPC消息队列 # Initialize worker and set up message queues for SchedulerOutputs # and ModelRunnerOutputs max_chunk_bytes = envs.VLLM_MQ_MAX_CHUNK_BYTES_MB * 1024 * 1024 self.rpc_broadcast_mq = MessageQueue(self.world_size, self.world_size, max_chunk_bytes=max_chunk_bytes) scheduler_output_handle = self.rpc_broadcast_mq.export_handle() ...

September 23, 2025 · 2 min