Archive for cuda

compile cuda program in device emulation mode

Prior to 3.0 you can just compile with the -deviceemu flag:

nvcc -deviceemu main.cu

In 3.0, this was changed such that you should link against cudartemu instead of cudart
In 3.1, emulation was removed.

So if want device emulation, you need to use version 3.0 or earlier.

A

Leave a Comment

Setting up CUDA on Ubuntu 9.10

  1. Download some stuff
  2. 1)Developer drivers
    2)CUDA Toolkit
    3)CUDA SDK code samples

    from NVIDIA.

    In my case I grabbed 190.53 drivers, 64 bit CUDA Toolkit for Ubuntu 9.04, and the CUDA SDK code samples.

    Note: most of the CUDA SDK stuff doesn’t work out of the box with gcc 4.4 yet, so use 4.3.

    sudo apt-get install gcc-4.3 g++-4.3

    You may have to update the symlink /usr/bin/gcc to point to gcc-4.3.

    Some other libraries you may need:

    sudo apt-get install libxi-dev libxmu-dev freeglut3-dev

  3. Install the drivers
  4. You will have to drop out of X to install the drivers, note the command to start X back up if you don’t know it..

    ## to stop X
    service gdm stop
    sudo sh NVIDIA-Linux-x86_64-190.53-pkg2.run
    ## to start X up again
    startx

  5. Install the toolkit
  6. sudo sh cudatoolkit_2.3_linux_64_ubuntu9.04.run

    Modify your environment as it suggests, for example I added the following to my ~/.bashrc file:

    export CUDA_BIN="/usr/local/cuda/bin"
    export PATH=$PATH:$CUDA_BIN
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64

    Source your bashrc to make the changes active, or open a new terminal.

    source ~/.bashrc

  7. Install the SDK
  8. Install and build the SDK

    sudo sh cudasdk_2.3_linux.run
    ## cd to your NVIDIA_GPU_Computing_SDK/C
    sudo make

    Test it out, there should be a bunch of executables in created in the bin subdirectory..

    cd bin/linux/release
    ./bandwithtest

  9. Help!
  10. Some errors you may encounter.

    ## missing glu.h
    sudo apt-get install freeglut3-dev

    ## gcc: error trying to exec 'cc1plus'
    ## if you installed gcc 4.3 but not g++ 4.3 this may happen.
    sudo apt-get install g++-4.3

    ## /usr/bin/ld: cannot find -lparamgl
    ## /usr/bin/ld: cannot find -lrendergl
    ## these are built as part of the CUDA SDK
    ## cd to your NVIDIA_GPU_Computing_SDK/C
    sudo make

    If you are seeing errors that resemble the following, they may be caused by having gcc/g++ 4.4.. install 4.3

    error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak

Comments (2)