# Determine CUDA version using /usr/local/cuda/bin/nvcc binaryĬUDA_VERSION=$(/usr/local/cuda/bin/nvcc -version | sed -n 's/^.*release \(\+\).*$/\1/p') Įlif then # Determine CUDA version using default nvcc binaryĬUDA_VERSION=$(nvcc -version | sed -n 's/^.*release \(\+\).*$/\1/p') Įlif /usr/local/cuda/bin/nvcc -version 2&> /dev/null then We can combine these three methods together in order to robustly get the CUDA version as follows: if nvcc -version 2&> /dev/null then In this scenario, the nvcc version should be the version you're actually using. Note that sometimes the version.txt file refers to a different CUDA installation than the nvcc -version. The output of which CUDA Version 10.1.243Ĭan be parsed using sed to pick out just the MAJOR.MINOR release version number. The output of which is the same as above, and it can be parsed in the same way.Īlternatively, you can find the CUDA version from the version.txt file.
#CUDA DRIVER MAC FULL#
If nvcc isn't on your path, you should be able to run it by specifying the full path to the default location of nvcc instead. We can pass this output through sed to pick out just the MAJOR.MINOR release version number. The output looks like this: nvcc: NVIDIA (R) Cuda compiler driverĬopyright (c) 2005-2020 NVIDIA CorporationĬuda compilation tools, release 11.0, V11.0.194 If you have multiple versions of CUDA installed, this command should print out the version for the copy which is highest on your PATH. I think this should be your first port of call.
#CUDA DRIVER MAC HOW TO#
Here, I'll describe how to turn the output of those commands into an environment variable of the form "10.2", "11.0", etc. Other respondents have already described which commands can be used to check the CUDA version.