Install CUDA 6.0 on Ubuntu 14.04 LTS

2015-6-13

如果安装后出现

Xlib: extension “GLX” missing on display “:0” [closed]

安装 nvidia的bumblebee,就好了。


转自 http://blog.sina.com.cn/s/blog_74e1f7ce0101qobn.html


Ubuntu 14.04 LTS is out, loads of new features have been added.Here are some procedures I followed to install CUDA 6.0 on my DELLInspiron.


First of all, Ubuntu need to be installed successfully, and thenecessary libs are also need to installed:
sudo apt-get install build-essential gcc-4.4 g++-4.4 libxi-dev libxmu-dev freeglut3-dev

Things you need to have before start the installationprocess:
1. Latest NVIDIA graphic driver(NVIDIA-Linux-x86_64-331.49.run)
2. CUDA 6.0 installation file (cuda_6.0.37_linux_64.run)

Now let's install the graphic driver

If you’re not sure your system type, press Ctrl+Alt+T to openterminal and run:

uname -m


1. Find out your graphics card model

Use the lspci command to find out the model of your graphicscard

$ lspci -vnn | grep -i VGA -A 12
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GT218 [GeForce 210] [10de:0a65] (rev a2) (prog-if 00 [VGA controller])
        Subsystem: ASUSTeK Computer Inc. Device [1043:8416]

2. Find out the right driver version for your graphics card

Visit http://www.nvidia.com/Download/index.aspx
Fill in the details about your graphics card and system and thenclick Search. On the next page, it should tell you the correctdriver version with a download link and additional information.

For the above GeForce 210 card, it showed 331.67 as the correctdriver which can be downloaded from the website. However we shallinstall the drivers from ppa to make things easier.

3. Setup the xorg-edgers ppa

The xorg-edgers ppa provides the very latest nvidia drivers. Runthe following commands to set it up.

$ sudo add-apt-repository ppa:xorg-edgers/ppa -y
$ sudo apt-get update
Nowthe ppa is setup and the package information is alsoupdated.

4. Install the driver

Either you can install the driver directly by installing a singlepackage containing "nvidia" and the major version number ( 173,304, 310, 313, 319, 331, 334 or 337).

# 331 driver 
$ sudo apt-get install nvidia-331 
 # 334 driver 
$ sudo apt-get install nvidia-334 
# install the latest version 
$ sudo apt-get install nvidia-current
Oryou can enable it from the "Additional Drivers" section. This isdifferent on different Ubuntu flavors.


5. Verify the installation

The last thing to do is verify that the nvidia drivers are loadedand working. Run the lspci command again and this time the kerneldriver should show nvidia

$ lspci -vnn | grep -i VGA -A 12

Check the last line which says "kernel driver in use: nvidia". Thisshows that nvidia drivers are now in action. Also check hardwareacceleration with the glxinfo command

$ glxinfo | grep OpenGL | grep renderer
OpenGL renderer string: GeForce 210/PCIe/SSE2

The OpenGL renderer string should be anything other than "MESA".Then it indicates that the hardware drivers are being used forhardware acceleration.

6. Nvidia settings tool

Nvidia would install a gui tool called "Nvidia X Server Settings"somewhere in the menu. It can also be launched from the commandline using the command "nvidia-settings". The tool showsmiscellaneous information about the graphics card and the monitorconnected, and also allows to configure various options.


7. Removing the drivers

Incase anything goes wrong after the installation, like you are notable to boot Ubuntu, then try removing the Nvidia drivers.

Boot into the recovery console from the grub menu and then issuethe following commands

# remount root file system as writable 
$ mount -o remount,rw / 
 # remove all nvidia packages
 $ apt-get purge nvidia*
Additional Notes

Many tutorials out there talk about blacklisting the nouveaudriver. This is no longer necessary, since the nvidia driver wouldblacklist nouveau itself. This can be verified by checking thecontents of nvidia driver files in the the modprobe.ddirectory.

$ grep 'nouveau' /etc/modprobe.d/* | grep nvidia 
/etc/modprobe.d/nvidia-331_hybrid.conf:blacklist nouveau
/etc/modprobe.d/nvidia-331_hybrid.conf:blacklist lbm-nouveau
/etc/modprobe.d/nvidia-331_hybrid.conf:alias nouveau off
/etc/modprobe.d/nvidia-331_hybrid.conf:alias lbm-nouveau off
/etc/modprobe.d/nvidia-graphics-drivers.conf:blacklist nouveau
/etc/modprobe.d/nvidia-graphics-drivers.conf:blacklist lbm-nouveau
/etc/modprobe.d/nvidia-graphics-drivers.conf:alias nouveau off
/etc/modprobe.d/nvidia-graphics-drivers.conf:alias lbm-nouveau off

Note that the files "nvidia-331_hybrid.conf" and"nvidia-graphics-drivers.conf" have blacklisted nouveau.

To check information about the nvidia driver module, use thecommands lsmod, modprobe and modinfo

# check that nvidia kernel module is loaded or not 
$ lsmod | grep nvidia 
nvidia              10699336  49 
drm                   302817  2 nvidia

# find the real name of the nvidia module
$ modprobe -R nvidia
nvidia_331

# details about the nvidia_331 module
$ modinfo nvidia_331
filename:       /lib/modules/3.13.0-24-generic/updates/dkms/nvidia_331.ko
alias:          char-major-195-*
version:        331.67
supported:      external
license:        NVIDIA
.....

The kernel module file for the nvidia driver is located at"/lib/modules/3.13.0-24-generic/updates/dkms/nvidia_331.ko".

Note that it is a "dkms" module which means, its loadeddynamically. Due to this the grub screen, the Ubuntu/Kubuntu splashscreens would have a low resolution since at that time the nvidiadrivers are not in effect, and whatever resolution is available viathe VESA extensions, are used.

8. Another Option
$ sudo add-apt-repository ppa:xorg-edgers/ppa
$ sudo apt-get update
$ sudo apt-get install nvidia-340

Then remove it
$ sudo apt-get remove nvidia-340

9. Install CUDA
$ sudo apt insta llnvidia-cuda-toolkit


One more tip:
Highlight CUDA syntax in Sublime
cd ~/.config/sublime-text-2/Packages/User
git clonegit://github.com/harrism/sublimetext-cuda-cpp.git
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值