cuda-smi icon indicating copy to clipboard operation
cuda-smi copied to clipboard

Fix NVIDIA driver version parsing for Ubuntu

Open marcoesposito1988 opened this issue 8 years ago • 3 comments

marcoesposito1988 avatar Jan 28 '17 15:01 marcoesposito1988

Hi Marco!

Could you please provide example of erroneously parsed version string? Also, were you using drivers from Ubuntu repos, or the ones directly from Nvidia website?

al42and avatar Jan 28 '17 17:01 al42and

Hi Andrey,

I am using Ubuntu 14.04.5 and the NVIDIA drivers from the official CUDA PPA (so through apt-get).

Here is the version string:

NVRM version: NVIDIA UNIX x86_64 Kernel Module  361.93.02  Wed Sep 21 16:32:29 PDT 2016
GCC version:  gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)

This is the output without the proposed fix:

g++ -I/usr/local/cuda/include -L/usr/local/cuda/lib64/ -L/usr/lib/nvidia-NVRM version: NVIDIA UNIX x86_64 Kernel Module  361.93.02  Wed Sep 21 16:32:29 PDT 2016/ -L/usr/lib/nvidia-NVRM version: NVIDIA UNIX x86_64 Kernel Module  361.93.02  Wed Sep 21 16:32:29 PDT 2016/ cuda-smi.cpp -lcudart_static -lpthread -ldl -lnvidia-ml -lrt -o cuda-smi
g++: error: version:: No such file or directory
g++: error: NVIDIA: No such file or directory
g++: error: UNIX: No such file or directory
g++: error: x86_64: No such file or directory
g++: error: Kernel: No such file or directory
g++: error: Module: No such file or directory
g++: error: 361.93.02: No such file or directory
g++: error: Wed: No such file or directory
g++: error: Sep: No such file or directory
g++: error: 21: No such file or directory
g++: error: 16:32:29: No such file or directory
g++: error: PDT: No such file or directory
g++: error: 2016/: No such file or directory
g++: error: version:: No such file or directory
g++: error: NVIDIA: No such file or directory                                                                                                                                                                                                                                               
g++: error: UNIX: No such file or directory                                                                                                                                                                                                                                                 
g++: error: x86_64: No such file or directory                                                                                                                                                                                                                                               
g++: error: Kernel: No such file or directory                                                                                                                                                                                                                                               
g++: error: Module: No such file or directory                                                                                                                                                                                                                                               
g++: error: 361.93.02: No such file or directory                                                                                                                                                                                                                                            
g++: error: Wed: No such file or directory                                                                                                                                                                                                                                                  
g++: error: Sep: No such file or directory                                                                                                                                                                                                                                                  
g++: error: 21: No such file or directory                                                                                                                                                                                                                                                   
g++: error: 16:32:29: No such file or directory                                                                                                                                                                                                                                             
g++: error: PDT: No such file or directory                                                                                                                                                                                                                                                  
g++: error: 2016/: No such file or directory                                                                                                                                                                                                                                                
make: *** [cuda-smi] Error 1 

marcoesposito1988 avatar Jan 31 '17 10:01 marcoesposito1988

Ah, okay, I see the problem. It's really a shame Nvidia is so inconsistent with their version numbering.

Please check if your problem is fixed in current master branch (87d9196). I'd rather prefer to parse driver response with regex: it's not perfect, but relying on specific token position seems a bit more fragile to me.

al42and avatar Feb 04 '17 12:02 al42and