I want to determine the number of CUDA devices on my system. Of course I can do this using the CUDA runtime API in a C program I compile, but - what's the simplest/most straightforward way to do this without compiling any code?
Assumptions:
If you're on Linux or a UNIX-like system, this works:
nvidia-smi -L | wc -l
Explanation:
nvidia-smi is nVIDIA's "system management interface" utility. You can use it to determine all sorts of information about your GPUs and also to carry out some maintenance actions.nvidia-smi -L lists the GPUs available on the system.wc is the UNIX word/line/character counting utilitywc -l counts the number of lines on the standard input... but is kind of brittle. I wish I had something a bit more robust.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With