## Cuda Toolkit >問題:nvcc --version 版本太舊或是沒有,但 /usr/local 這裡也沒有看到想要的 cuda toolkit 首先,cuda版本有分成 driver API 和 runtime API,nvcc --version 看的是 runtime 的,nvidia-smi 則是 driver API。 通常 driver API 可以向下兼容 runtime API,也就是不要讓 nvcc --version 版本高於 nvidia-smi 就可以了。 下載 cuda toolkit 要到 [nvidia 官方網站](https://developer.nvidia.com/cuda-11-7-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=18.04&target_type=runfile_local)下載,選擇 runfile 版本。 (因為檔案很大,可以統一丟到 " /media/public_dataset2/Driver_file" ) > 或是可以先到 /media/public_dataset2/Driver_file 這邊看有沒有。 ![image](https://hackmd.io/_uploads/HJvbm2liT.png) 插播失敗案例(記得不要切到root的路徑!): ![image](https://hackmd.io/_uploads/r1j30QRna.png) > 安裝的時候記得要把 Driver 這個選項關掉,才不會直接改到 Driver API。 > 更新:保留 CUDA Toolkit 11.7 的選項即可,其他都可以關掉。 ![image](https://hackmd.io/_uploads/BkPDG2xsp.png) > 這裡的 symlink 記得選 No,這個代表會把這個版本的 "/local/local/cuda11.x" link 到 "/user/local/cuda",想知道長怎樣,可以在 "/user/local" 打指令 'll' 直接看 。 ![image](https://hackmd.io/_uploads/Skr2z3gjp.png) 接下來到 bashrc 最底下把 toolkit 路徑寫進去: ``` vi ~/.bashrc export PATH=/usr/local/cuda/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH source ~/.bashrc ``` #### Uninstall Cuda Toolkit (haven't been tested yet) ![image](https://hackmd.io/_uploads/SJhyyb0f0.png) ``` <!-- To uninstall the CUDA Toolkit, run cuda-uninstaller in /usr/local/cuda-11.7/bin --> ``` ### Error for mismatch gcc version, see [here](https://blog.csdn.net/aizsa111/article/details/129455363): ``` # error message: Failed to verify gcc version. See log at /var/log/cuda-installer.log for details. ``` Go to [here](https://developer.nvidia.com/cuda-toolkit-archive), and clicked Versioned Onlined Documentation. For changing gcc version, see [here](https://hackmd.io/kSKPi-q_THGlvOlAtXS-Rg): ``` gcc --version gcc (Ubuntu 11.4.0-2ubuntu1~18.04) 11.4.0 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ```