How can I Install Nvidia Driver GT 520 and Cuda 5.0 in Ubuntu13.04?

7,589

Solution 1

This description is working with hybrid-cards of nvidia, who contains CUDA chipset (additionally in some cases with 'Optimus'-feature) like those with letter 'M' as graphics-cards for notebooks.

no question - linux-headers have to be installed first suiting to your installed kernel.

in case of hybrid-chipsets like CUDA with Optimus this following package might NOT work entirely :

NVIDIA-Linux-x86_64-310.51.run

you instead should try this package:

NVIDIA_CUDA_SDK_1.1_Beta_Linux.run

You can download it here:

http://www.nvidia.de/object/cuda_1_1_beta.html

In this example the 1 year old graphics hypbrid chipset with GeForce 540M CUDA Optimus (notebooks) - CUDA_SDK_1.1_Beta is working quite good ...

On desktop in terminal one first needs to do:

export PATH=${PATH}:/usr/local/cuda/bin

and on 32-bit-machines this:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/nvidia-current:/usr/lib32/nvidia- current

but on 64-bit-machines this:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib:/usr/local/cuda/lib64

I have kernel 3.9.0 and after:

Strg-Alt-F1 (use Ctrl instead of Strg on most non-German keyboards)

apt-get update

then it depends on your system what works better:

either this package for 32-bit:

apt-get install nvidia-current

or either this package for 64-bit:

apt-get install nvidia-current-updates

(never mix these both packages !)

I simply went out of x:0 with looking for x-window processes (gdm, lightdm, xdm, kdm and else ... ) with top and then ended all concerning x:0-processes with killing them manually:

(in protected mode resp. Strg-Alt-F1)

kill -9 PID number-of-PID

( this works more explicitly than xdm stop, gdm stop or kdm stop resp. lightdm stop and commands like init or telinit are not to recommend here in 12.10 - I write this here, because in many tutorials regarding nvidia these stopping commands are always told )

Then finally I simply ran off that package:

./NVIDIA_CUDA_SDK_1.1_Beta_Linux.run

when finish do not forget then:

 gdm start
 kdm start
 lightdm start

following is necessary in case of geforce-cards with cuda-optimus:

back to desktop with:

Strg-Alt-F7

there type into terminal

sudo add-apt repository ppa:bumblebee/stable

sudo apt-get update

sudo apt-get install --reinstall bumblebee virtualgl linux-headers-generic

(otherwise installation of cuda-sdk-package has no effect)

sudo reboot

now you should have wobbly graphics best working with compiz and cairo-dock and icon-fusion !!!

(remark: later after installing kernel 3.10 - Nvidia-driver CUDA-SDK-1.1 was accepted by 3.10 without further problems)

Solution 2

I've found this relatively simple approach for installing CUDA in Ubuntu. Unfortunately, the page seems to be incomplete and outdated (12.04).

https://help.ubuntu.com/community/Cuda

It basically involves the following steps:

Install the required packages:

sudo apt-get install libxi-dev libxmu-dev freeglut3-dev build-essential binutils-gold

Download "CUDA Toolkit" and "GPU Computing SDK". Substitute "32" for "64" if you're on 32 bits:

cd ~/Desktop
wget http://developer.download.nvidia.com/compute/cuda/4_2/rel/toolkit/cudatoolkit_4.2.9_linux_64_ubuntu11.04.run
wget http://developer.download.nvidia.com/compute/cuda/4_2/rel/sdk/gpucomputingsdk_4.2.9_linux.run

Install the CUDA toolkit (when prompted, choose /opt as the install path)

cd ~/Desktop
chmod +x cudatoolkit_4.2.9_linux_*
sudo ./cudatoolkit_4.2.9_linux_*

Install GPU Computing SDK (once again, choosing /opt as your install path upon prompt)

cd ~/Desktop
chmod +x gpucomputingsdk_4.2.9_linux.run
./gpucomputingsdk_4.2.9_linux.run

Prepare for compilation

export PATH=$PATH:/opt/cuda/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cuda/lib:/opt/cuda/lib64
echo 'export PATH=$PATH:/opt/cuda/bin' >> ~/.bash_profile
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cuda/lib:/opt/cuda/lib64' >> ~/.bash_profile

Compile SDK

cd ~/NVIDIA_GPU_Computing_SDK/C
LINKFLAGS=-L/usr/lib/nvidia-current/ make cuda-install=/opt/cuda

NOTE: In case you are using the latest (post-release updates; version current-updates) instead of the recommended (version current) Nvidia drivers, then change the LINKFLAGS to read:

cd ~/NVIDIA_GPU_Computing_SDK/C
LINKFLAGS=-L/usr/lib/nvidia-current-updates/ make cuda-install=/opt/cuda

Test

~/NVIDIA_GPU_Computing_SDK/C/bin/linux/release/./fluidsGL

If you can see the picture, it works!

If you are using optimus with bumblebee, run the above with optirun as below:

optirun ~/NVIDIA_GPU_Computing_SDK/C/bin/linux/release/./fluidsGL

Cleanup

cd ~/Desktop
rm cudatoolkit_4.2.9_linux_*
rm gpucomputingsdk_4.2.9_linux.run

Uninstallation

rm -r ~/NVIDIA_GPU_Computing_SDK
sudo rm -r /opt/cuda

Also, remove the export PATH=$PATH:/opt/cuda/bin and export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cuda/lib:/opt/cuda/lib64 lines of the ~/.bash_profile file.

Also, I've found this easy script

http://ammar.gr/?p=701

Which namely only works for 12.04, but according to Jiří Doubravský, it also works on 12.10 and 13.04.

Share:
7,589

Related videos on Youtube

edwin
Author by

edwin

There's no problem so large it can't be solved by killing the user off, deleting their files, closing their account and reporting their REAL earnings to the IRS.

Updated on September 18, 2022

Comments

  • edwin
    edwin over 1 year

    I'm just newbie with Ubuntu/Linux. Actually I am attempting to install Pyrit which requires GPU acceleration.

    I have dual-booted Ubuntu 13.04 and Windows 7 in my Desktop PC Gigabyte G31M-ES2C with:

    • Processor: Intel Core 2 Duo
    • RAM: 4.00 GB
    • Graphics:
      • Integrated Intel Graphics
      • Nvidia GT 520 (I think with Optimus)

    I have tried many times to install CUDA but unsuccessfully. Can someone explain to me how to install it with details?

    I've heard about Bumblebee, which might help me with an Optimus card. How can I make use of it? I've heard I have to uninstall Nouveau first.

    When I tried with Bumblebee everything seemed perfect except the following error appears:

    optirun glxgears -info
      ERROR-Bumblebee daemon has not been started yet or the socket path /var/<...>
      ERROR-Could not connect to bumblebee daemon - is it running?
    

    I need a way to install Pyrit or just CUDA, any help is appreciated.

    • guntbert
      guntbert almost 11 years
      Please take it easy on us: there is no need for ALL UPPERCASE, no need for big bold parts.
    • dschinn1001
      dschinn1001 almost 11 years
      @guntbert big bold parts don't happen by intention - if you type: #include <stdio.h> - this is getting big too ?!
    • guntbert
      guntbert almost 11 years
      @dschinn1001 true, but it is easy to format it correctly - but I am too tired to edit the complete post :-)
    • Braiam
      Braiam over 10 years
      @guntbert and people says I'm creepy for checking out the preview... :/
  • David Foerster
    David Foerster about 9 years
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
  • Fabby
    Fabby about 9 years
    Although your answer is correct, it might also become 100% useless if that link is moved, changed, merged into another one or the main site just disappears... :-( Therefore, please edit your answer, and copy the relevant steps from the link into your answer, thereby guaranteeing your answer for 100% of the lifetime of this site! ;-) You can always leave the link in at the bottom of your answer as a source for your material...
  • Waldir Leoncio
    Waldir Leoncio about 9 years
    @DavidFoerster and Fabby, you're right. I've expanded the answer as requested. Unfortunately, I couldn't access the script to post it as well.
  • Waldir Leoncio
    Waldir Leoncio about 9 years
    @Fabby, edited as requested. Thank you for the review.
  • David Foerster
    David Foerster about 9 years
    @WaldirLeoncio: Thanks for elaborating your answer, but I'm more concerned about ammar.gr becoming unreachable (which it is for me at the moment) than help.ubuntu.com. In case you are luckier than me, can you please copy it to a more reliable pastie service and replace the link in your answer?
  • Waldir Leoncio
    Waldir Leoncio about 9 years
    @DavidFoerster: yeah I can't reach it either; I'll understand the deletion of this answer if the community considers it an essential part of the answer.