-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bugfix] Fix custom all reduce nvlink check on multi node #4903
Conversation
# test nvlink first, this will filter out most of the cases | ||
# where custom allreduce is not supported | ||
# this checks hardware and driver support for NVLink | ||
full_nvlink = _is_full_nvlink(physical_device_ids) | ||
full_nvlink = _is_full_nvlink(device_ids) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not true. Sometimes, e.g. in the testing code, we manually remove cuda visible devices variables, and the process can see all device ids. However, we only need to check nvlink topology within several gpus, rather than all.
What is your intended usecase? I think no one uses a TP group that crosses machine boundary. The designed use case is to use TP inside a node. |
@youkaichao I want to serve a big model across multi nodes by using tensor parallelism. One node's memory cannot afford a model.
Do you mean custom all reduce feature? If so, we should check if using tp inside a node before nvlink status check. |
I would vote for this. maybe with another |
@youkaichao I revert changes and check |
if len(device_ids) < world_size: | ||
logger.warning( | ||
"Custom allreduce is disabled because this feature is " | ||
"not intended for multi node use case.") | ||
return | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be wrong. We cannot assume CUDA_VISIBLE_DEVICES
is always set. If not set, device_ids
will be all devices (e.g. 8), but we should be able to use custom allreduce with world_size
2 or 4.
@youkaichao Please take a look again. |
# 3 nodes will be like [0,1,2,3,0,1,0,1] | ||
if sorted(physical_device_ids)[-1] + 1 != world_size: | ||
logger.warning( | ||
"Custom allreduce is disabled because this feature is " | ||
"not intended for multi node use case.") | ||
return | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still not safe. It is possible, that one node uses gpu 0, 1
, while the other node uses 2, 3
, and the world size is 4
. In this case, we cannot use custom allreduce. However, this code will not capture it.
If you want to detect whether a tp group spans across a node, |
@youkaichao I think i was not clear about this part code. Your suggestion is good. Thanks for your careful review! |
close as #5369 is a better alternative. |
pynvml.nvmlDeviceGetHandleByIndex
will throw error whenindex
is larger than the node's max device count index.For example. Serving using two nodes:
node1: [0,1,2,3]
node2: [0,1]
and the final
physical_device_ids
will be [0,1,2,3,0,1]. Node 2 will throw error when it encounter2
and3
which is larger than its max device index(1).Another example:
node1: [0,1]
node2: [0,1]
the final
physical_device_ids
will be [0,1,0,1]. So the NVLINK status will be repeatedly checked.I think it is unnecessary to using
all_gather
to getphysical_device_ids
where we can get that fromdevice_ids
directly. Correct me if i miss anything. @youkaichaoPR Checklist (Click to Expand)
Thank you for your contribution to vLLM! Before submitting the pull request, please ensure the PR meets the following criteria. This helps vLLM maintain the code quality and improve the efficiency of the review process.
PR Title and Classification
Only specific types of PRs will be reviewed. The PR title is prefixed appropriately to indicate the type of change. Please use one of the following:
[Bugfix]
for bug fixes.[CI/Build]
for build or continuous integration improvements.[Doc]
for documentation fixes and improvements.[Model]
for adding a new model or improving an existing model. Model name should appear in the title.[Frontend]
For changes on the vLLM frontend (e.g., OpenAI API server,LLM
class, etc.)[Kernel]
for changes affecting CUDA kernels or other compute kernels.[Core]
for changes in the core vLLM logic (e.g.,LLMEngine
,AsyncLLMEngine
,Scheduler
, etc.)[Hardware][Vendor]
for hardware-specific changes. Vendor name should appear in the prefix (e.g.,[Hardware][AMD]
).[Misc]
for PRs that do not fit the above categories. Please use this sparingly.Note: If the PR spans more than one category, please include all relevant prefixes.
Code Quality
The PR need to meet the following code quality standards:
format.sh
to format your code.docs/source/
if the PR modifies the user-facing behaviors of vLLM. It helps vLLM user understand and utilize the new features or changes.Notes for Large Changes
Please keep the changes as concise as possible. For major architectural changes (>500 LOC excluding kernel/data/config/test), we would expect a GitHub issue (RFC) discussing the technical design and justification. Otherwise, we will tag it with
rfc-required
and might not go through the PR.What to Expect for the Reviews
The goal of the vLLM team is to be a transparent reviewing machine. We would like to make the review process transparent and efficient and make sure no contributor feel confused or frustrated. However, the vLLM team is small, so we need to prioritize some PRs over others. Here is what you can expect from the review process:
action-required
label on the PR if there are changes required. The contributor should address the comments and ping the reviewer to re-review the PR.Thank You
Finally, thank you for taking the time to read these guidelines and for your interest in contributing to vLLM. Your contributions make vLLM a great tool for everyone!