Linux check CUDA version and nvcc: command not found

In daily use, it is often necessary to check the CUDA version when configuring mirroring and using open source websites, and the version is indeed very important. Generally, we have three common query methods.

  1. View the current version of Cuda, that is, the version of Cuda actually installed
    nvcc -V(nvcc --version)
    nvcc 是The main wrapper for the NVIDIA CUDA Compiler suite. Used to compile and link both host and gpu code. 或者:
    cat /usr/local/cuda/version.txt
    If nvcc reports an error nvcc: command not found, then first:
  • 1.1 Check whether there is nvcc in the bin directory of cuda:
	cd /usr/local/cuda/bin
  • 1.2 If it exists, just add the cuda path to the system path directly:
	#进入配置文件
	vim ~/.bashrc
 
	#添加以下两行
	#在/.bashrc中配置LD_LIBRARY_PATH路径、配置PATH路径,完整配置如下:
	export LD_LIBRARY_PATH=/usr/local/cuda/lib
	export PATH=$PATH:/usr/local/cuda/bin
	
	source ~/.bashrc
  • 1.3 Execute nvcc -V again to see the corresponding cuda version, as follows:
    insert image description here
  1. Check the current NVIDIA driver version and the highest Cuda version that can match this driver. The Cuda
    version may be lower than the current Cuda version that the driver matches, so nvidia-smi cannot truly reflect the CUDA version installed on the machine at this time.
    insert image description here

Guess you like

Origin blog.csdn.net/NCU_wander/article/details/129668084