Skip to content

[fix] replacing torch.cuda.set_device with CUDA_VISIBLE_DEVICES #85

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

Merged
merged 2 commits into from
Apr 2, 2025

Conversation

oandreeva-nv
Copy link
Contributor

@oandreeva-nv oandreeva-nv commented Mar 21, 2025

in my experiments with loading multiple models onto different gpus torch.cuda.set_device wasn't behaving as a GPU "router", thus using CUDA_VISIBLE_DEVICES
before the fix, tp=1 count=2 test GPU utilisation:

Test Matrix: model='vllm_opt_KIND_GPU_tp1_count2', kind='KIND_GPU', tp='1', instance_count='2'


=============== Before Loading vLLM Model ===============
GPU 0 Memory Utilization: 1426849792 bytes
GPU 1 Memory Utilization: 1426849792 bytes
=============== After Loading vLLM Model ===============
GPU 0 Memory Utilization: 44708986880 bytes
GPU 1 Memory Utilization: 1866727424 bytes

With this fix:

Test Matrix: model='vllm_opt_KIND_GPU_tp1_count2', kind='KIND_GPU', tp='1', instance_count='2'


=============== Before Loading vLLM Model ===============
GPU 0 Memory Utilization: 1426849792 bytes
GPU 1 Memory Utilization: 1426849792 bytes
=============== After Loading vLLM Model ===============
GPU 0 Memory Utilization: 43918819328 bytes
GPU 1 Memory Utilization: 43916722176 bytes
  • also tested with multiple TP=1 models + different GPU ids in a config.pbtxt in a cluster

@oandreeva-nv oandreeva-nv requested a review from kthui March 21, 2025 23:24
@oandreeva-nv oandreeva-nv merged commit b40fca4 into main Apr 2, 2025
3 checks passed
@oandreeva-nv oandreeva-nv deleted the oandreeva_torch_fix branch April 2, 2025 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants