Skip to content
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

Can't hide GPUs to get_cuda_device_count() #1693

Open
mattiadg opened this issue May 7, 2024 · 5 comments
Open

Can't hide GPUs to get_cuda_device_count() #1693

mattiadg opened this issue May 7, 2024 · 5 comments

Comments

@mattiadg
Copy link

mattiadg commented May 7, 2024

Hi,
thank you for this great project!
I'm running on Windows 11 and ctranslate2 v4.2.1. When running in a machine with gpus, even if I set CUDA_VISIBLE_DEVICES to the empty string, get_cuda_device_count() always returns the number of gpus in the machine.
Is this expected?

@minhthuc2502
Copy link
Collaborator

CUDA_VISIBLE_DEVICES should affect which GPU will be visible. If you have more than 2 GPUs, try export CUDA_VISIBLE_DEVICES=1 and run a script to see if GPU 1 is used as expected.

@mattiadg
Copy link
Author

mattiadg commented May 13, 2024 via email

@minhthuc2502
Copy link
Collaborator

I just tested it, if I set CUDA_VISIBLE_DEVICES="" and get number of gpu device with ctranslate2::get_gpu_count() , I got the correct value.

@mattiadg
Copy link
Author

mattiadg commented May 14, 2024 via email

@minhthuc2502
Copy link
Collaborator

minhthuc2502 commented May 14, 2024

I tested on Linux. Make sure you set correctly the environment variable. You can test directly with CUDA without using ct2 before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants