Skip to content

Conversation

@mhucka
Copy link
Collaborator

@mhucka mhucka commented Oct 29, 2025

It seems that checking for the program nvidia-smi is the more reliable way to determine if a system has a usable NVIDIA GPU and the necessary drivers installed for running CUDA applications. Checking for nvcc may only tell you if the system can compile CUDA code, not necessarily if it can run it.

This PR also fixes a small portability issue, where the use of command -v is preferrable to the use of which for testing whether a program is available.

It seems that checking for the program `nvidia-smi` is the more reliable
way to determine if a system has a usable NVIDIA GPU and the necessary
drivers installed for running CUDA applications. Checking for `nvcc` may
only tell you if the system can compile CUDA code, not necessarily if it
can run it.
@mhucka mhucka marked this pull request as ready for review October 29, 2025 02:06
# an NVIDIA GPU. Checking for nvcc may only tell you if the system can compile
# CUDA code, not necessarily if it can run it.)

ifneq (,$(shell command -v nvidia-smi > /dev/null 2>&1))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might be two issues here.

  1. You discard both the standard output and the error output. So ifneq (,$(shell command -v nvidia-smi > /dev/null 2>&1)) is always false.

  2. It seems checking for nvidia-smi can also be unreliable. One can install nvidia-utils to get nvidia-smi (even on a machine that does not have an NVidia GPU) without installing cuda, etc. But we need nvcc to compile the code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. You discard both the standard output and the error output. So ifneq (,$(shell command -v nvidia-smi > /dev/null 2>&1)) is always false.

Ack, you're right of course. That should have been only 2> /dev/null. And of course, I only bothered to test it on a system that didn't have nvidia-smi, so the resulting behavior was what I expected. Anyway, thank you very for catching that.

  1. It seems checking for nvidia-smi can also be unreliable. One can install nvidia-utils to get nvidia-smi (even on a machine that does not have an NVidia GPU) without installing cuda, etc. But we need nvcc to compile the code.

Darn it. I guess one would need to test for nvcc and nvidia-smi, then grep the output of running nvidia-smi for an indication of a gpu card. This is getting complicated :-(.

I'm doing to close this PR and issue #884 and try to reproduce whatever led me to think it was an issue in the first place.

@mhucka
Copy link
Collaborator Author

mhucka commented Oct 29, 2025

This PR is flawed and does not even address the problem fully. Closing.

@mhucka mhucka closed this Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: S 10< lines changed <50

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants