Farbod pm

Error invalid device function

This error may occurs when the gpu setting is wrong. In my experience I have chosen wrong “Generate PTX code” and “Generate GPU code” version. If you are directly running the code on your local device you can check the right version on “properties -> build -> Settings -> cuda” when you see the below pic it means that you have chosen the right version.
** remember clean the project and rebuild it to see the changes.

Feel free and ask your questions or share your experiences with us.

GPU Programming in Ubuntu ,Cuda Installation

General-purpose computing on a graphics processing unit, known as GPU programming, is use of a GPU with CPU to accelerate computation. Today application of GPU programming is image processing, Signal processing, medical imaging and so on. This article show you how to install Cuda platform on your system.

Verify You Have a Supported Version of Linux

First of all you have to determine which distribution and release number you’re running. Type the following at command line:
$ uname -m && cat /etc/*release
you should see output similar to the following, modified for your particular system:
Red Hat Enterprise Linux Workstation release 6.0
The x86_64 line indicates you are running on a 64-bit system.

Verify the System Has gcc Installed

To verify the version of gcc installed on your system, type the following on the command line:
$ gcc –version
Something like below should returned:

if an error message displays , you need to install the development tools from your Linux distribution or obtain a version of gcc and its accompanying toolchain from the web.

Verify the System Has the Correct Kernel Headers and Development Packages Installed

The kernel headers and development packages for the currently running kernel can be installed with:
$ sudo apt-get install kernel-headers-$(uname -r)
$ uname -r returns the version of the kernel your system is running.

Download the NVIDIA CUDA Toolkit

Download your desired installation file from here. After installation verify your file using this code:
$ md5sum <file address>
it takes a while and the result should be like below:

Before installation it’s better to uninstall every other CUDA toolkit using this code:
$ sudo /usr/local/cuda-X.Y/bin/uninstall_cuda_X.Y.pl
and uninstall CUDA driver using below:
$ sudo /usr/bin/nvidia-uninstall
( I did not do it but according to nvidia document you have to do it. Also I am not sure that I had cuda driver or toolkit before.)

Finally, install cuda with code:
$ sudo sh cuda_<version>_linux.run