vllm.v1.executor.ray_utils ¶
FutureWrapper ¶
Bases: Future
A wrapper around Ray output reference to meet the interface of .execute_model(): The top level (core busy loop) expects .result() api to block and return a single output.
If aggregator is provided, the outputs from all workers are aggregated upon the result() call. If not only the first worker's output is returned.
Source code in vllm/v1/executor/ray_utils.py
__init__ ¶
__init__(
refs, aggregator: KVOutputAggregator | None = None
)
result ¶
Source code in vllm/v1/executor/ray_utils.py
RayWorkerWrapper ¶
Bases: WorkerWrapperBase
Ray wrapper for vllm.worker.Worker, allowing Worker to be lazily initialized after Ray sets CUDA_VISIBLE_DEVICES.
Source code in vllm/v1/executor/ray_utils.py
__init__ ¶
Source code in vllm/v1/executor/ray_utils.py
execute_model_ray ¶
execute_model_ray(
execute_model_input: tuple[
SchedulerOutput, GrammarOutput
]
| tuple[
SchedulerOutput, GrammarOutput, IntermediateTensors
],
) -> Union[
ModelRunnerOutput,
tuple[
SchedulerOutput, GrammarOutput, IntermediateTensors
],
]
Source code in vllm/v1/executor/ray_utils.py
get_node_and_gpu_ids ¶
Source code in vllm/v1/executor/ray_utils.py
override_env_vars ¶
setup_device_if_necessary ¶
Source code in vllm/v1/executor/ray_utils.py
_verify_bundles ¶
_verify_bundles(
placement_group: PlacementGroup,
parallel_config: ParallelConfig,
device_str: str,
)
Verify a given placement group has bundles located in the right place.
There are 2 rules. - Warn if all tensor parallel workers cannot fit in a single node. - Fail if driver node is not included in a placement group.
Source code in vllm/v1/executor/ray_utils.py
_wait_until_pg_ready ¶
Wait until a placement group is ready.
It prints the informative log messages if the placement group is not created within time.
Source code in vllm/v1/executor/ray_utils.py
_wait_until_pg_removed ¶
Source code in vllm/v1/executor/ray_utils.py
assert_ray_available ¶
Raise an exception if Ray is not available.
get_num_nodes_in_placement_group ¶
get_num_nodes_in_placement_group() -> int
Source code in vllm/v1/executor/ray_utils.py
get_num_tpu_nodes ¶
get_num_tpu_nodes() -> int
Source code in vllm/v1/executor/ray_utils.py
initialize_ray_cluster ¶
initialize_ray_cluster(
parallel_config: ParallelConfig,
ray_address: str | None = None,
)
Initialize the distributed cluster with Ray.
it will connect to the Ray cluster and create a placement group for the workers, which includes the specification of the resources for each distributed worker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parallel_config | ParallelConfig | The configurations for parallel execution. | required |
ray_address | str | None | The address of the Ray cluster. If None, uses the default Ray cluster address. | None |
Source code in vllm/v1/executor/ray_utils.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | |