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

HAS_GPU does not reflect CUDA VISIBLE DEVICE Settings #220

Closed
bschifferer opened this issue Feb 15, 2023 · 3 comments · Fixed by #221
Closed

HAS_GPU does not reflect CUDA VISIBLE DEVICE Settings #220

bschifferer opened this issue Feb 15, 2023 · 3 comments · Fixed by #221
Labels
bug Something isn't working

Comments

@bschifferer
Copy link
Contributor

We check, if GPUs are available in following line:

HAS_GPU = nvml.device_get_count() > 0

If my machine has GPUs, but I want to run in CPU-only mode by setting CUDA_VISIBLE_DEVICE, the Merlin Library still has HAS_GPU=True

Example:
export CUDA_VISIBLE_DEVICES='';python -c 'from dask.distributed.diagnostics import nvml; print(nvml.device_get_count())'

Returns 2 for 2x GPUs. But I set CUDA_VISIBLE_DEVICES to empty

@bschifferer bschifferer added the bug Something isn't working label Feb 15, 2023
@bschifferer
Copy link
Contributor Author

@radekosmulski FYI

@oliverholworthy
Copy link
Member

At one point we were using cuda to set this global variable which did account for CUDA_VISIBLE_DEVICES. However, calling a cuda function in the global scope caused problems with dask and we switched to using NVML #145 which tells you how many devices are available on the machine, but doesn't know anything about CUDA_VISIBLE_DEVICES

@oliverholworthy
Copy link
Member

I've opened a PR #221 that checks the CUDA_VISIBLE_DEVICES environment variable and handles this case where it is set to an empty string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants