Nvidia
Installing Cuda on Ubuntu 11.10
Here are steps to install and configure Nvidia Cuda on Ubuntu 11.10
Install gcc 4.4, g++ 4.4, and cpp 4.4.
sudo apt-get install gcc-4.4 g++-4.4 cpp-4.4 build-essential
Create symbolic links for gcc 4.4
cd /usr/bin
sudo mkdir gcc44
cd gcc44
sudo ln -s /usr/bin/gcc-4.4 gcc
sudo ln -s /usr/bin/g++-4.4 g++
sudo ln -s /usr/bin/cpp-4.4 cpp
Install the nvidia drivers
sudo apt-get install nvidia-current nvidia-current-dev nvidia-current-updates nvidia-current-updates-dev
Download the current Cuda Toolkit and GPU Computing SDK for Ubuntu and the GPU Computing SDK, and save the .run files somewhere.
chmod +x *.run
sudo ./cudatoolkit_4.0.17_linux_32_ubuntu10.10.run
Install with default options including paths
./gpucomputingsdk_4.0.17_linux.run
Install where you want to play.
For compiling the SDK examples, you also need to install
sudo apt-get install freeglut3-dev libxi-dev
sudo ln -s /usr/lib/libXmu.so.6 /usr/lib/libXmu.so
sudo ln -s /usr/lib/nvidia-current/libGL.so /usr/lib/libGL.so
Then go to the NVIDIA_GPU_COMPUTING_SDK_… folder. In the file C/common/common.mk change the line
LINKFLAGS +=
–>
LINKFLAGS += -L/usr/lib/nvidia-current
Add a following line at the end of /usr/local/cuda/bin/nvcc.profile
compiler-bindir=/usr/bin/gcc44
Make GPU computing SDK
cd NVIDIA_GPU_COMPUTING_SDK_…
make -j4 -i
Set up $PATH and $LD_LIBRARY_PATH. Add the followings ~/.bashrc.
export CUDA_HOME=/usr/local/cuda
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA_HOME/lib
export PATH=$CUDA_HOME/bin:$PATH
Enjoy!
======================================================================================================================================================================
Installing CUDA 4.0 on Ubuntu 11.04 (Natty Narwhal)
NVIDIA recently released CUDA 4.0, their latest toolkit to harness the compute power of modern GPUs. However, installing NVIDIA's CUDA 4.0 on Ubuntu 11.04 can give problems. This mini how-to describes the steps to make it work.
Installing NVIDIA's CUDA 4.0 is not always straightforward on Ubuntu. On Ubuntu 10.10 it runs out-of-the-box, but CUDA 4.0 will not install on Ubuntu 10.04 and it will not install out-of-the-box on Ubuntu 11.04 either.
I was working on Ubuntu 10.04 when I decided to install CUDA 4.0. However, the CUDA 4.0 release notes state that Ubuntu 10.04 is not supported, so I decided to upgrade my Ubuntu, which gave me version 11.04. Here I encountered two problems. First, CUDA 4.0 relies on gcc-4.4 whereas Ubuntu 11.04 comes with gcc-4.5 by default. Second, CUDA 4.0 requires newer NVIDIA drivers than the ones that ship with Ubuntu 11.04. Fortunately, only a few relatively simple steps are required to make CUDA 4.0 work on Ubuntu 11.04.
Installing packages
I performed the following steps to install CUDA 4.0 on Ubuntu 11.04. Note that I wrote down these steps from my memory, but at least you should get the gist of it:
Install newer NVIDIA drivers and older versions of gcc and g++:
$ sudo apt-add-repository ppa:ubuntu-x-swat/x-updates $ sudo apt-get update $ sudo apt-get install gcc-4.4 g++-4.4 nvidia-current
Selecting the right version of gxx
Now you have both the gxx-4.4 and gxx-4.5 versions on your system. So how do you select the right one? By default, your system uses the gxx-4.5 versions:
$ ls -l /usr/bin/g++ /usr/bin/gcc > /usr/bin/g++ -> g++-4.5 > /usr/bin/gcc -> gcc-4.5
We could make gxx-4.4 the default using sudo update-alternatives as described in the ubuntu gcc installation howto. However, I only want to use the gxx-4.4 versions if I'm working with CUDA and just leave gxx-4.5 as the default.
I found that the most convenient way to achieve this is to create two little gxx scripts that are executed instead of the /usr/bin/gxx ones. The scripts choose the right version of gxx based on the existence of an environment variable. I put these scripts in my ~/bin directory and placed them in my path before the /usr/bin entry.
Create a script ~/bin/gcc and make it executable (chmod +x), containing the following lines:
#!/bin/sh if [ -n "$GCC_CUDA" ]; then exec /usr/bin/gcc-4.4 "$@" else exec /usr/bin/gcc-4.5 "$@" fi
Create a similar script for g++.
Add ~/bin to the beginning of your environment path. For example, for bash, add to ~/.bashrc the following line:
PATH=~/bin:$PATH
Now, to use gxx-4.4 with CUDA, simply define the variable GCC_CUDA:
$ gcc --version > gcc-4.5 $ export GCC_CUDA=1 $ gcc --version > gcc-4.4
Downloading CUDA
Now we are ready to install the CUDA toolkit for Ubuntu and the NVIDIA GPU Computing SDK. (By the way, the following steps are also required on other versions of Ubuntu.)
Download the toolkit and Computing SDK
Run the install for the toolkit. You can install in any location, but I assume you use the default path of /usr/local.
Add /usr/local/cuda/bin to your path by adding the following to your environment. For example, for bash, add to ~/.bashrc the following line:
PATH=/usr/local/cuda/bin:$PATH
We need to tell the linker where to find the CUDA libraries. Create a file /etc/ld.so.conf.d/cuda.conf, containing:
/usr/local/cuda/lib64 /usr/local/cuda/lib
and run:
$ sudo ldconfig
Run the install for the GPU Computing SDK. When asked, point it to where you installed the toolkit.
The SDK cannot find the NVIDIA drivers by itself. In order to fix this:
Edit ~/NVIDIA_GPU_Computing_SDK/C/common/common.mk, search for 'Libs', then add -L/usr/lib/nvidia-current.
Go to ~/NVIDIA_GPU_Computing_SDK/C and run make. This should build all the examples.
If everything worked out well, you have a working installation of CUDA 4.0 on your Ubuntu system! To test if everything is installed properly:
Go to ~/NVIDIA_GPU_Computing_SDK/C/bin/linux/release
Run the deviceQuery example; this should give you a list of CUDA-supported devices.
Run the bandwidthTest example to obtain memory bandwidth figures.
=======================================================================================
http://blog.ryant.org/2011/12/installing-cuda-toolkit-on-ubuntu-1110.html
Installing the CUDA Toolkit on Ubuntu 11.10
I ran into a couple of issues installing CUDA 4.0 on Ubuntu 11.10 and decided to write them up, here's how I went about it.
Install the required build tools
CUDA 4.0 does not support gcc 4.5+, I seemed to already have gcc 4.6 installed on my instance. There is no problem with having multiple versions of gcc installed side-by-side, we just have to install the 4.4 versions.
$ sudo apt-get install build-essential gcc-4.4 g++-4.4
Download the SDKs
Download the CUDA Toolkit for Ubuntu (the 10.10 version) and the GPU Computing SDK from here http://developer.nvidia.com/cuda-toolkit-40
These weigh in at around 210Mb and 140Mb respectively.
Install the CUDA Toolkit:
The CUDA Toolkit needs to be installed as root.
$ chmod 755 cudatoolkit_4.0.17_linux_64_ubuntu10.10.run
$ sudo ./cudatoolkit_4.0.17_linux_64_ubuntu10.10.run
Once you have completed installing this, add the CUDA bin location to your path - I did this in my .bashrc .
export PATH=$PATH:/usr/local/cuda/bin
And now you need to add the CUDA libs to your library search path, I already had the nvidia_settings.conf file here, though you can add any file with a .conf extension. The lines added are in bold.
$ cat /etc/ld.so.conf.d/nvidia_settings.conf
/usr/lib/nvidia-settings
/usr/local/cuda/lib64
/usr/local/cuda/lib
Now run ldconfig to pick up the changes.
$ sudo ldconfig
Install the GPU SDK
Much like the CUDA Toolkit, though this does not need to be installed by root, it defaults to ~/NVIDIA_GPU_Computing_SDK .
$ chmod 755 gpucomputingsdk_4.1.21_linux.run
$ ./gpucomputingsdk_4.1.21_linux.run
Link the 4.4 compilers
If you have multiple gcc versions installed, we need to make sure that nvcc (the CUDA compiler) picks up the 4.4 version. This can be done through flags for nvcc, however we need a link for it called gcc and g++.
Create a new directory in your home, called gcc-4.4 and create a link in here to the 4.4 version of gcc and g++.
$ cd
$ mkdir gcc-4.4
$ cd gcc-4.4
$ ln -s /usr/bin/g++-4.4 g++
$ ln -s /usr/bin/gcc-4.4 gcc
Set the compiler flag in the provided samples
In order to build the supplied samples we now need to modify the supplied MakeFile.
$ cd ~/NVIDIA_GPU_Computing_SDK/C/common
$ vim common.mk
Find a line that looks like:
NVCCFLAGS :=
And change it to look like:
NVCCFLAGS := -ccbin ~/gcc-4.4/
This flag tells nvcc where to find the gcc and g++ compilers.
Make the sample - deviceQuery
We will build the deviceQuery sample, this sample prints output of our CUDA device.
$ cd ~/NVIDIA_GPU_Computing_SDK/C/src/deviceQuery
$ make
$ cd ~/NVIDIA_GPU_Computing_SDK/C/bin/linux/release
$ ./deviceQuery
You should now see the output of the deviceQuery sample.
Using nvcc
You will need to use the -ccbin flag if you wish to use nvcc from the commandline, though this is quite easy:
$ nvcc -ccbin ~/gcc-4.4 my_app.cu
=======================================================================================
http://www.dickscheid.net/2011/10/19-cuda-ubuntu-1110/
Installing Cuda on Ubuntu 11.10
To install Cuda, I followed some hints on bottom of this thread, but also had to fix a few more issues.
Download the current Cuda Toolkit for Ubuntu and the GPU Computing SDK, and save the .run files somewhere.
Install and select gcc/g++ 4.4
sudo apt-get install \ gcc-4.4 g++-4.4 build-essential sudo update-alternatives \ --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 40 \ --slave /usr/bin/g++ g++ /usr/bin/g++-4.6 sudo update-alternatives \ --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 60 \ --slave /usr/bin/g++ g++ /usr/bin/g++-4.4
Check with
sudo update-alternatives —config gcc gcc —version
that you have now version 4.4.x of the compilers.
Install the nvidia drivers
sudo apt-get install \ nvidia-current\ nvidia-current-dev\ nvidia-current-updates\ nvidia-current-updates-dev
As root, run the two .run files from nvidia (see 1.).
For compiling the SDK examples, you also need to install
sudo apt-get install freeglut3-dev libxi-dev
and create the following links
sudo ln -s /usr/lib/libXmu.so.6 /usr/lib/libXmu.so sudo ln -s /usr/lib/nvidia-173/libGL.so /usr/lib/libGL.so
Then go to the NVIDIA_GPU_COMPUTING_SDK_... folder. In the file C/common/common.mk change the line
LINKFLAGS +=
to
LINKFLAGS += -L/usr/lib/nvidia-current
Then run make. This should compile everything, indicating that the CUDA stuff works.
=======================================================================================
1.NVIDIA GPU Computing Software Development Kit
CUDA SDK 4.0 Release Notes
For more detailed instructions, see section II below.
0. Install the NVIDIA Linux display driver by executing the file
In addition, a NVIDIA Linux Display driver is needed to run CUDA code on an
NVIDIA GPU. CUDA 4.0 Release requires version 270 or newer version of the linux
NVIDIA Display Driver. Please see the NVIDIA CUDA Toolkit 4.0 Release notes
for more details.
a. For 32-bit linux distributions use:
cudadriver_4.0_linux_32_270.xx.run
Download from:
http://developer.download.nvidia.com/compute/cuda/4_0/drivers/devdriver_4.0_linux_32_270.41.19.run
b. For 64-bit linux distributions use:
cudadriver_4.0_linux_64_270.xx.run
Download from:
http://developer.download.nvidia.com/compute/cuda/4_0/drivers/devdriver_4.0_linux_64_270.41.19.run
For information on installing NVIDIA Linux display drivers, please refer to
the NVIDIA Accelerated Linux Driver Set README and Installation Guide:
http://us.download.nvidia.com/XFree86/Linux-x86/1.0-9755/README/index.html
1. Install version 4.0 Release of the NVIDIA CUDA Toolkit by executing the file
cudatoolkit_4.0_linux_*.run where * corresponds to your Linux distribution
Download from:
To install, run the cudatoolkit_4.0_linux_*.run script. You will be prompted
for the path to where you want to put the CUDA files. In the following we will
call this path <CUDA_INSTALL_PATH>. It is recommended that you run the
installer as root and use the default install path (/usr/local).
Make sure that you add the location of the CUDA binaries (such as nvcc) to
your PATH environment variable and the location of the CUDA libraries
(such as libcuda.so) to your LD_LIBRARY_PATH environment variable.
In the bash shell, one way to do this is to add the following lines to the
file ~/.bash_profile from your home directory.
a. For 32-bit operating systems use the following paths
PATH=$PATH:<CUDA_INSTALL_PATH>/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<CUDA_INSTALL_PATH>/lib
b. For 64-bit operating systems use the following paths
PATH=$PATH:<CUDA_INSTALL_PATH>/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<CUDA_INSTALL_PATH>/lib64
Then to export the environment variables add this to the profile configuration
export PATH
export LD_LIBRARY_PATH
2. Install version 4.0 Release of the NVIDIA GPU Computing SDK by executing the file
gpucomputingsdk_4.0_linux.run
Download from:
http://developer.download.nvidia.com/compute/cuda/4_0/sdk/gpucomputingsdk_4.0.17_linux.run
To install, run the gpucomputingsdk_4.0_linux.run script. You will
be prompted for the path to where you want to put the CUDA SDK. You can
regard the CUDA SDK as user code (it is a set of examples), and therefore
the default installation is in the current user's home directory
(~/NVIDIA_GPU_Computing_SDK). You must either accept the default or specify a path
to which the user has write permissions.
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
SDK_INSTALL_PATH.
(Note: The default installation folder <SDK_INSTALL_PATH> is "~/NVIDIA_GPU_Computing_SDK")
3. Build the SDK project examples.
a. cd <SDK_INSTALL_PATH>/C
(Note: The default installation folder <SDK_INSTALL_PATH> is "~/NVIDIA_GPU_Computing_SDK")
b. Build:
- release configuration by typing "make".
- debug configuration by typing "make dbg=1".
- x86_64=1 configuration by typing "make x86_64=1"
- i386=1 configuration by typing "make i386=1"
Running make at the top level first builds libcutil, a utility library used
by the SDK examples (libcutil is simply for convenience -- it is not a part
of CUDA and is not required for your own CUDA programs). Make then builds
each of the projects in the SDK.
NOTES:
- The release and debug configurations require a CUDA-capable GPU to run
properly (see Appendix A.1 of the CUDA Programming Guide for a complete
list of CUDA-capable GPUs).
- To build just libcutil, type "make" (or "make dbg=1") in the "common"
subdirectory:
cd <SDK_INSTALL_PATH>/C/common
make
4. Run the examples (32-bit or 64-bit Linux)
cd <SDK_INSTALL_PATH>/C/bin/linux/release
matrixmul
(Note: The default installation folder <SDK_INSTALL_PATH> is "~/NVIDIA_GPU_Computing_SDK")
(or any of the other executables in that directory)
See the next section for more details on installing, building, and running
SDK samples.
This package consists of a ".run" file. This is a self-extracting archive that
decompresses its contents to a temporary folder and then installs the contents
The archive is:
gpucomputingsdk_4.0_linux.run: NVIDIA GPU Computing SDK Installer