Today I updated my NVIDIA driver from 440xx to 450xx. As a consequence, I had to re-install CUDA and cudnn.
(I should also add that while reinstalling CUDA and cudnn I also updated them from 10.2 to 11 and 7 to 8 respectively)
I needed to add export PATH=/opt/cuda/bin:$PATH to my bashrc to be able to use nvcc - which is weird since nvcc worked before I updated my drivers and reinstalled CUDA and cudnn. (What might be happening here?)
But this created an issue - the gcc inside /opt/cuda/bin is gcc 9, whereas the system gcc is 10. I do not want to use gcc 9, I want to use gcc 10.
Before I updated my NVIDIA driver today and had to point bashrc to /opt/cuda/bin I was able to use both nvcc and gcc 10.
For completion’s sake, I checked which GCC versions are installed on my system -
Even if nvcc uses GCC 9 as the host compiler, I should still be able to use GCC 10 as my default system GCC version, as long as I have GCC 9 installed on my system.
Before I updated to CUDA 11, I was able to use GCC 10 as my default system GCC version with CUDA 10.2. CUDA 10.2 only supports GCC 8. Since I had GCC 8 installed on my system for nvcc to use as the host compiler, it didn’t matter that I was using GCC 10 as my default system GCC.
I already have gcc9 installed, like I showed in the list in the original post.
Maybe I should rephrase my question -
The default version of GCC installed on my system (from pacman) is 10.
Earlier, I had CUDA 10.2 installed on my system and didn’t need to explicitly add /opt/cuda/bin to PATH to use nvcc. GCC was version 10 as expected.
Today I updated to CUDA 11 (also involved reinstalling optimus-switch if that is relevant). I had to add /opt/cuda/bin to PATH to use nvcc. /opt/cuda/bin contains gcc9, therefore the default GCC version is now 9.
I want to use nvcc as well as GCC 10.
(@steanne mentioned that CUDA won’t use GCC 10, but that is fine. I should still be able to use GCC 10 as my default system GCC version as long as I have GCC 9 installed on my system for nvcc to use as the default compiler)