diff --git a/jtop/core/jetson_libraries.py b/jtop/core/jetson_libraries.py index f79ade35..bd886f65 100644 --- a/jtop/core/jetson_libraries.py +++ b/jtop/core/jetson_libraries.py @@ -17,6 +17,7 @@ import os import re +import subprocess from .common import cat from .command import Command # Fix connection refused for python 2.7 @@ -49,6 +50,17 @@ def get_cuda(): break except (OSError, Command.CommandException): pass + elif subprocess.call(["which", "nvcc"]) == 0: + cmd = Command(['nvcc', '--version']) + try: + lines = cmd() + for line in lines: + match = re.search(CUDA_NVCC_RE, line) + if match: + cuda_version = match.group(1) + break + except (OSError, Command.CommandException): + pass return cuda_version