错误的gcc版本与nvidia相关联

时间:2018-04-28 14:24:25

标签: c++ c gcc cuda

我安装了gcc-5和gcc-7,当我尝试使用'make'编译cuda样本时,我遇到了很多错误,经过一些研究后我发现我需要降级我的gcc,所以我认为系统使用gcc-7而不是其他,所以我使用purge卸载它,但是gcc甚至没有被识别,gcc --version给出了错误。所以我也清除了另一个gcc并再次安装了'sudo apt-get update'和'suda apt-get install build essential'。 'gcc --version'现在已经可以使用了,但是我的cuda司机不再工作了。 nvidia-smi导致“命令未找到”,我无法运行任何cuda样本,虽然现在我可以编译它。例如,deviceQuery返回:

cudaGetDeviceCount returned 35
-> CUDA driver version is insufficient for CUDA runtime version
Result = FAIL

'nvcc --version'也有效,这是输出:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Sep__1_21:08:03_CDT_2017
Cuda compilation tools, release 9.0, V9.0.176

运行'lshw -numeric -C display'会导致:

WARNING: you should run this program as super-user.
  *-display               
       description: 3D controller
       product: GM107M [GeForce GTX 950M] [10DE:139A]
       vendor: NVIDIA Corporation [10DE]
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a2
       width: 64 bits
       clock: 33MHz
       capabilities: bus_master cap_list rom
       configuration: driver=nvidia latency=0
       resources: irq:38 memory:f6000000-f6ffffff memory:e0000000-efffffff memory:f0000000-f1ffffff ioport:e000(size=128) memory:f7000000-f707ffff
  *-display
       description: VGA compatible controller
       product: 4th Gen Core Processor Integrated Graphics Controller [8086:416]
       vendor: Intel Corporation [8086]
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 06
       width: 64 bits
       clock: 33MHz
       capabilities: vga_controller bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: irq:34 memory:f7400000-f77fffff memory:d0000000-dfffffff ioport:f000(size=64) memory:c0000-dffff
WARNING: output may be incomplete or inaccurate, you should run this program as super-user.

我没有改变我的驱动程序,但重新安装gcc打破了他们。我该如何解决这个问题?

由于

- 编辑 -

当我'找到nvidia-smi'时,我得到以下结果:

/etc/alternatives/x86_64-linux-gnu_nvidia-smi.1.gz
/usr/bin/nvidia-smi
/usr/share/man/man1/nvidia-smi.1.gz

虽然当我进入那些目录时,比如/ usr / bin没有nvidia-smi可执行文件,在/ usr / share / man / man1 /下没有nvidia-smi.1.gz

做'cat / proc / driver / nvidia / version'我得到:

NVRM version: NVIDIA UNIX x86_64 Kernel Module  384.111  Tue Dec 19 23:51:45 PST 2017
GCC version:  gcc version 7.2.0 (Ubuntu 7.2.0-1ubuntu1~16.04)

它仍然显示旧的gcc,我现在有gcc-5,而不是7

1 个答案:

答案 0 :(得分:0)

我设法解决了这个问题,实际上非常简单,我只需要重新安装我的nvidia驱动程序:

sudo apt-get purge nvidia* 
sudo apt-get update 
sudo apt-get install nvidia-384