cudaversion

How can I determine the full CUDA version + subversion?


CUDA distributions on Linux used to have a file named version.txt which read, e.g.:

CUDA Version 10.2.89

which is quite useful. However, as of CUDA 11.1, this file no longer exists.

How can I determine, on Linux and from the command line, and inspecting /path/to/cuda/toolkit, which exact version I'm looking at? Including the subversion?


Solution

  • (Answer due to @RobertCrovella's comment)

    This will do the trick:

    /path/to/cuda/toolkit/bin/nvcc --version \
    | egrep -o "V[0-9]+.[0-9]+.[0-9]+" \
    | cut -c2-
    

    And of course, for the CUDA version currently chosen and configured to be used, just take the nvcc that's on the path:

    nvcc --version | egrep -o "V[0-9]+.[0-9]+.[0-9]+" | cut -c2-
    

    For example: You would get 11.2.67 for the download of CUDA 11.2 which was available this week on the NVIDIA website.

    The full nvcc --version output would be:

    nvcc: NVIDIA (R) Cuda compiler driver
    Copyright (c) 2005-2020 NVIDIA Corporation
    Built on Mon_Nov_30_19:08:53_PST_2020
    Cuda compilation tools, release 11.2, V11.2.67
    Build cuda_11.2.r11.2/compiler.29373293_0