Nvidia CUDA Linux Ubuntu 10.04 and 9.04

install in the following order:
– driver (as root)
– toolkit (as root)
– sdk (as user)

Driver is compiled using devdriver script downloaded from CUDA site. Followings are necessary steps:

  • as root do: #apt-get remove nvidia-*
  • blacklist nouveau driver and vga16fb (which uses nouveau) by adding them in /etc/modprobe.d/blacklist.conf
  • reboot using recovery option to work in console/text
  • select netroot and #telinit 3
  • in order to smoothly compile NVIDIAComputingSDK install these packages using apt-get:
      #apt-get install libxext-dev libxi-dev x11proto-xext-dev libice-dev libsm-dev libxt-dev libxmu-headers libxmu-dev freeglut3-dev libglut3-dev
  • login and as root, start compilation CUDA driver by running #./devdriverXXXX
  • things should go fine
  • compile NVIDIAComputingSDK by change your directory to yourNVIDIAComputingSDKfolder/C and type make there

The followings are for Ubuntu 9.04 (and some of them may apply to Ubuntu 10.04):

0. Install the NVIDIA Linux display driver by executing the file

a. For 32-bit linux distributions use:

b. For 64-bit linux distributions use:

For information on installing NVIDIA Linux display drivers, please refer to
the NVIDIA Accelerated Linux Driver Set README and Installation Guide:

1. Install version 2.3 of the NVIDIA CUDA Toolkit by executing the file
cudatoolkit_2.3_linux_*.run where * corresponds to your Linux distribution

Add the CUDA binaries and lib path to your PATH and LD_LIBRARY_PATH
environment variables.

as user edit .bashrc ==> export PATH=$PATH:/usr/local/cuda/bin

* Please make sure your LD_LIBRARY_PATH
*   for 32-bit Linux distributions includes /usr/local/cuda/lib
*   for 64-bit Linux distributions includes /usr/local/cuda/lib64
* OR
*   for 32-bit Linux distributions add /usr/local/cuda/lib
*   for 64-bit Linux distributions add /usr/local/cuda/lib64
* to /etc/ld.so.conf and run ldconfig as root

as root
#gedit /etc/ld.so.conf.d/cuda-nvidia-whatever.conf
insert this following line:


2. Install version 2.3 of the NVIDIA GPU Computing SDK by executing the file

The installer will prompt you to enter an installation path for the SDK or
accept the default.  We will refer to the path you choose as

3. Build the SDK project examples.

4. Run the examples (32-bit or 64-bit Linux)
cd SDK_INSTALL_PATH/C/bin/linux/release

(or any of the other executables in that directory)

* Please make sure your PATH includes /usr/local/cuda/bin
* Please read the release notes in /usr/local/cuda/doc/
* To uninstall CUDA, delete /usr/local/cuda
* Installation Complete

$cd ~/NVIDIA_GPU_Computing_SDK
$cd C

if compilation is not successufl (i.e. libraries are missing), then you should install:
“libGLU”, “libX11” “libXi”, “libXm”  (development versions of course)
(all related to X11 graphics development)

RESULT if successful
~/NVIDIA_GPU_Computing_SDK/C/bin/linux/release$ ./deviceQuery
CUDA Device Query (Runtime API) version (CUDART static linking)
There is 1 device supporting CUDA
Device 0: "GeForce 9600 GT"
CUDA Driver Version:                           2.30
CUDA Runtime Version:                          2.30
CUDA Capability Major revision number:         1
CUDA Capability Minor revision number:         1
Total amount of global memory:                 536543232 bytes
Number of multiprocessors:                     8
Number of cores:                               64
Total amount of constant memory:               65536 bytes
Total amount of shared memory per block:       16384 bytes
Total number of registers available per block: 8192
Warp size:                                     32
Maximum number of threads per block:           512
Maximum sizes of each dimension of a block:    512 x 512 x 64
Maximum sizes of each dimension of a grid:     65535 x 65535 x 1
Maximum memory pitch:                          262144 bytes
Texture alignment:                             256 bytes
Clock rate:                                    1.50 GHz
Concurrent copy and execution:                 Yes
Run time limit on kernels:                     Yes
Integrated:                                    No
Support host page-locked memory mapping:       No
Compute mode:                                  Default (multiple host threads can use this device simultaneously)
Press ENTER to exit...
surya@surya-desktop:~/cuda/C/bin/linux/release$ ./matrixMul
Processing time: 0.356000 (ms)
Press ENTER to exit...

Xorg.Conf for BenQ

For some reasons, CUDA driver can not display the best resolution for my BENQ T71W which has native resolution 1440 x 900.

Here is file xorg.conf which works
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
Option "Xinerama" "0"
Section "Files"
Section "InputDevice"
# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
Section "InputDevice"
# generated from default
Identifier "Keyboard0"
Driver "kbd"
Section "Monitor"
Identifier "Monitor0"
VendorName "BenQ"
ModelName "BenQ T71W"
Option "DPMS"
HorizSync 30-81
VertRefresh 50-76
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "GeForce 9800 GT"
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "TwinView" "0"
# Option "metamodes" "1440x900 +0+0"
SubSection "Display"
Depth 24
Depth 24
Modes "1440x900" "1366x768" "1280x800" "1152x864" "1280x768" "1024x768" "1280x600" "1024x600" "800x600" "768x576" "640x480"
SubSection "Display"
Virtual 1440 900
Depth 24
Modes "1440x900" "1280x1024" "1280x960" "1152x864" "1024x768" "832x624" "800x600" "720x400" "640x640" "640x480"

Posted in Linux, Penelitian, Programming/Notes
5 comments on “Nvidia CUDA Linux Ubuntu 10.04 and 9.04
  1. M_M says:

    Great Tutorial!

    This has taken me from 0 -> 80% functionality.

    To make my system work, I need to find the driver associated to -lXmu, and a few more.

  2. M_M says:

    You may want to include a tidbit on configuring your xorg.conf file for those who are using dual-video cards (like myself). It’s a simple step to let auto config guess at your xorg configuration, then modify the guess to fit your computer’s specifications.

    Also, you may want to add a tidbit on configuring “headless” graphics cards. This will allow users who don’t have two CUDA-compatible cards (e.g. one ATI, one Nvidia) to still run CUDA on the Nvidia and render with the ATI. This, also, is a step which can be handled through proper configuration of xorg.conf

  3. yuhendra says:

    PAk sumpeno ,gimana belajar mudah programing CUDA
    saya ada contoh program C, gimana trik untuk memodifie ke CUDA. Terima kasih saran dan bantuannya.
    *Programed by yuhendra2009/04/02
    *Binary Image Read and Write library


    using namespace std;

    /*Read Binaryfile*/
    X* GetReader(char* filename,long *FileSize){

    FILE *fp;
    long fsize;
    X* buffer;

    fp = fopen(filename,”rb”);

    if(fp == NULL){
    int GetWriter (X* buffer , char* output_name, long FileSize ){
    FILE *fp;

    printf(“Can not open write file”);
    return 1;
    printf(“WRITER=sizeof(X)=%d FileSize/sizeof(X)=%d\n”,sizeof(X),FileSize/sizeof(X));
    return 0;


    int CalcRecordNum (long FileSize){
    int RecordNum;

    RecordNum=FileSize/sizeof (X);

    return RecordNum;


  4. surya says:

    I just installed dual card GPU and my Linux went blink after reboot. To remedy this problem, you can do:

    #nvidia-xconfig -a

    where “-a” means

    -a, --enable-all-gpus
    Configure an X screen on every GPU in the system.

  5. surya says:

    $uname -a
    Linux surya-desktop 2.6.32-24-generic #43-Ubuntu SMP Thu Sep 16 14:58:24 UTC 2010 x86_64 GNU/Linux
    Error: glXCreateContext failed
    #cd /usr/lib/xorg/modules/extension
    #mv libglx.so libglx.so.whatever
    #ln -s libglx.so.256.40 libglx.so

    restart x

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: