Cuda 4.0 RC2 and Ubuntu 11.04b2

Hello,

I was wondering if someone had tried Ubuntu 11.04 beta 1 or 2 with Cuda 4.0 RC2 and managed to get it work?

I haven’t tried it yet.

Cheers,

Yes I got it working just now, this is how I did it:

NOTE!!! if http://developer.nvidia.com/cuda-downloads

has a version for ubuntu 11.04 this text is outdated!

Firstly install the needed dependencies:

sudo apt-get install build-essential gcc-4.4 g++-4.4 libxi-dev libxmu-dev freeglut3-dev

Go to: http://developer.nvidia.com/cuda-toolkit-40#Linux

And download and install all of the following {You will need to install the drivers from a VT}:

  • CUDA Toolkit for Ubuntu Linux 10.10 (as I said, if there is an 11.04 version what I’m saying here might no longer be true)

  • CUDA Tools SDK

  • GPU Computing SDK code samples

You will also need to get the Developer Drivers from the same place, but the installation here is not so straightforward.

first you need to remove the current nvidia packages you might have installed:

sudo apt-get remove nvidia-common nvidia-current

Then you have to stop X and install the drivers

after you have stopped gdm you might have to ctrl+alt+F1 to get to a VT

(better have a livecd around in case this goes wrong :P)

sudo service gdm stop

run the driver installer you downloaded and then start gdm again

sudo service gdm start

if all went well you should have X up and running again.

I had to blacklist the nouveau module because it conflicted with the nvidia driver, so in /etc/modprobe.d/nouveau.conf put:

blacklist nouveau

You will need to have the cuda libraries in your library path so create /etc/ld.so.conf.d/cuda.conf and ad the following lines:

/usr/local/cuda/lib64

/usr/local/cuda/lib

run ldconfig as root for it to take effect:

sudo ldconfig

you also want to add /usr/local/cuda/bin to your PATH you can do it by adding

PATH="$PATH:/usr/local/cuda/bin"

to your .bashrc

before we can try out the NVIDIA_GPU_Computing_SDK we must make nvcc use gcc/g++ version 4.4

(if you want gcc-4.4 as system default you’ll want to use update-alternatives instead of this method)

I created a directory in my home named gcc44 and had nvcc look there for gcc:

mkdir gcc44

cd gcc4

ln -s /usr/bin/cpp-4.4 cpp

ln -s /usr/bin/gcc-4.4 gcc

ln -s /usr/bin/g++-4.4 g++

now edit /usr/local/cuda/bin/nvcc.profile to look in the gcc44 directory (give it the full path)

compiler-bindir = /wherever/you/put/your/gcc44

by now you should be able to successfully run make in NVIDIA_GPU_Computing_SDK/C so cross your fingers and:

cd ~/NVIDIA_GPU_Computing_SDK/C

make

Go to NVIDIA_GPU_Computing_SDK/C/bin and try some of the examples, they should work now.

Note: Mathematica 8.0 found cuda immediatly after this, no configuration needed there

Nice step-by-step tutorial. For me there’s only the toolkit for Ubuntu 10.10 listed on the download page, but that doesn’t matter.

Note that you don’t necessarily need the dev drivers, the stock nvidia-current drivers work. However there’s a slight annoyance: libcuda.so is by default located in /usr/lib/nvidia-current and ld doesn’t pick that up with static linking. To be able to compile the SDK you need to change line 278 of sdk/C/common/common.mk to

LIB += -L/usr/lib/nvidia-current -lcuda   ${OPENGLLIB} $(PARAMGLLIB) $(REND

ERCHECKGLLIB) $(CUDPPLIB) ${LIB}

I’ve created a PPA with Cuda 4.0rc2 (based off the debian package for nvidia-cuda-toolkit 3.2) such that it can be apt-get installed. PPA is only for Maverick currently, but you might be able to use it in Natty with minimal changes. (in fact, I just uploaded a fix that will let nvcc find nvidia-current/libcuda.so by default)

Hi, I followed this step-by-step tutorial, and I am able to get most of the example working, but there are problems with some of the examples, like the volume render example, they ran, but if I try to interact with it, the entire OS freezes for more than 5 minutes, and this happens every time you try to interact with it, so basically I can’t interact with it at all. I am wondering if you know what the causes are.

after installing cuda 4.0rc2 on Ubuntu 11.04 i cant even access tty
booting in recovery mode says:
init: cups main process ended, respawning
any ideas how to fix this?

I’m trying to install CUDA4.0RC2 on Ubuntu 11.04 (released version).
I followed the steps corcc described.
But at the step of installing driver(devdriver_4.0_linux_64_270.40.run), still I cannot remove
Nouveau kernel driver and the installer says
‘ERROR: The Nouveau kernel driver is currently in use by your system…’
I’m wondering if someone could remove the driver. If so, could you tell me more detailed steps?

@corcc Thanks for the clear instructions! I did the installation on Ubuntu 11.04 (64-bit) and it works without problems (even though the NVIDIA website says the package is for Ubuntu 10.10).

I did not remove nvidia-current and nvidia-common because it also wants to remove the package ubuntu-desktop, which does not sound like a good idea… It looks like this wasn’t really necessary, the drivers install over the Ubuntu-installed drivers without problems.

Is it really necessary to install GCC version 4.4? It seems to work fine with GCC 4.5 which is included with Ubuntu 11.04.
edit No, it doesn’t work on GCC 4.5, compiling the examples fails with this. I first tried it on a system that previously had Ubuntu 10.10 on it (upgraded from 10.10 to 11.04), it must have also had GCC 4.4 installed. On a freshly-installed 11.04 it complains about GCC 4.5 and newer not being supported.

There are also instructions in the Linux Getting Started Guide: http://developer.download.nvidia.com/compute/cuda/4_0_rc2/docs/Getting_Started_Linux.pdf

Thanks, I was trying to figure out how to tell nvcc where to find the correct binaries for gcc and g++.

As a note: I did not have to remove the nvidia-… packages nor blacklist nouveau.

[s]I know this thread is old but I wanted to add that after following these instructions my build would still error out when building deviceQuery, with error message “cannot locate -lcuda”. I also had to change the line in ~/NVIDIA_GPU_Computing_SDK/C/src/deviceQuery/Makefile from

LIB += -lcuda

to

LIB += -L/usr/lib/nvidia-current -lcuda

For some reason adding the -L/usr/… to common/common.mk as suggested by kynan worked on all up to the deviceQuery, but this fix was necessary to finish building the SDK examples.[/s]

NOTE: The current “Recommended” drivers available from Ubuntu’s Hardware Driver utility do not work properly with these devices (at least on my machine, Ubuntu 11.04 64-bit with GeForce 9500 GT,) although the fix I listed above worked to compile, the examples didn’t run correctly. Manually installing the development drivers removed the need for the Library command and the examples are working correctly.

CUDA SDK4.0 on UBUNTU11.04:

“error while loading shared libraries: libcudart.so.3: cannot open shared object file: No such file or directory”
$LD_LIBRARY_PATH set properly.
There is no libcublas.so.3 but libcublas.so.4 in both “/usr/local/cuda/lib64” and “/usr/local/cuda/lib”.
I created a link:“sudo ln -s libcublas.so.4 libcublas.so.3” and the following error came:
“cudaSafeCall() Runtime API error : CUDA version is insufficient for CUDART version”
I also tried Toolkit3.2, Toolkit3.1 and Toolkit3.0 but all of them said “CUDA version is insufficient for CUDART version”.

What should I do now? Thanks in advance!

ls /usr/local/cuda/lib64 (Toolkit4.0)

libcublas.so libcufft.so libcusparse.so
libcublas.so.4 libcufft.so.4 libcusparse.so.4
libcublas.so.4.0.17 libcufft.so.4.0.17 libcusparse.so.4.0.17
libcudart.so libcurand.so libnpp.so
libcudart.so.4 libcurand.so.4 libnpp.so.4
libcudart.so.4.0.17 libcurand.so.4.0.17 libnpp.so.4.0.17

NVIDIA_GPU_Computing_SDK/C/bin/linux/release/deviceQuery gives:

evice 0: “GeForce GTX 460”
CUDA Driver Version / Runtime Version 4.0 / 4.0
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 4.0, CUDA Runtime Version = 4.0, NumDevs = 1, Device = GeForce GTX 460
[deviceQuery] test results…
PASSED

env:

Linux 2.6.38-11-generic #50-Ubuntu SMP 2011 x86_64 x86_64 x86_64 GNU/Linux