CUDA 9.1 installed with GCC above 5.0 in CentOS 7.x?

As listed in http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html, CUDA 9.1 is installed with GCC 4.8.3 in CentOS 7.x. It is done successfully.

However, some users require gcc 5.3+ with CUDA 9.1 in CentOS 7.x, just like Ubuntu 16.04.

Steps below were executed but were invaild:

  1. GCC 4.8.5 in CentOS 7.4 was updated to gcc 5.3+ manually,and
  2. reinstalled CUDA 9.1 step by step based on the NVIDIA CUDA Installation Guide for Linux(same line above)
  3. $ cat /proc/driver/nvidia/version, shows GCC version is still 4.8.5.

Could CUDA 9.1(with telsa v100) be installed with GCC 5.3+ in CentOS 7.x, assuming CentOS 7.x is a must?

Any advice?

How to install CUDA 9.1 with GCC 5.3+ in CentOS 7.x thoroughly without changing OS to Ubuntu 16.04?

CUDA will use whatever your default host compiler is.

If you find that CUDA is using gcc 4.8.5 when you installed gcc 5.3, it is because you did not make gcc 5.3 the default compiler.

The default compiler is the one that will be invoked if you type:

gcc --version

or

g++ --version

at the terminal command line.

If you installed both, and then want CUDA to use the newer one after it was installed using the older one, you can use the -ccbin command line parameter to nvcc, to tell it to use something other than the default compiler.