Where to put the script?

I have converted my Vista 64 system to 64 bit Ubuntu 9.04, installed the Cuda driver, toolkit, sdk, and debugger. I set the compilers to the earlier version, added libraries as needed to compile the SDK.

What I am stuck on now is that I cannot run the examples, for example:

CUDA-1:~/NVIDIA_CUDA_SDK/bin/linux/release$ ./bandwidthTest
./bandwidthTest: error while loading shared libraries: libcudart.so.2: cannot open shared object file: No such file or directory

This means that the runtime is not correctly set up. I think what I need to do now is install the “example script”

#!/bin/bash

modprobe nvidia

if [ “$?” -eq 0 ]; then

Count the number of NVIDIA controllers found.

N3D=/sbin/lspci | grep -i NVIDIA | grep "3D controller" | wc -l
NVGA=/sbin/lspci | grep -i NVIDIA | grep "VGA compatible controller" | wc -l

N=expr $N3D + $NVGA - 1
for i in seq 0 $N; do
mknod -m 666 /dev/nvidia$i c 195 $i;
done

mknod -m 666 /dev/nvidiactl c 195 255

else
exit 1
fi

Is that so?

And if so, where is it suggested that I put this script? From my ancient Unix experience, I am guessing somewhere in /etc/init.d?

Is there some all-encompassing installation document I missed somewhere?

Did you set the LD_LIBRARY_PATH environment variable?

Now that you mention it, that sounds like a good idea. It makes many of the examples work.

The Mandelbrot example appears to work but freezes the machine - that is likely a separate issue. EDIT: It has not repeated.

Does this mean I don’t have to worry about the boot script?

Also: it appears that an alternative to setting LD_LIBRARY_PATH in my .profile would be using ld.so.conf and ldconfig. Is there a reason to prefer one over the other?

But the good news is that it looks like I have a CUDA development machine up and running here.

The particles example runs very lowly on Ubuntu 9.04 64 bit compared to how it ran under Vista 64. The nbody example runs abotu 10% faster.

Well it turns out for some reason one cannot simply add LD_LIBRARY_PATH to the .profile and move on. I can set other environment variables there, but not LD_LIBRARY_PATH. I can set it by hand though. I think this means that something runs between executing the .profile and launching my xterm is setting the LD_LIBRARY_PATH to empty.

What’s going on here?

Here are the last two lines in the .profile:

export LDLIBRARYPATH=/usr/local/cuda/lib
export LD_LIBRARY_PATH=/usr/local/cuda/lib

OK so what do I get when I open an xterm?

CUDA-1:~$ env | grep LIBRARY
LDLIBRARYPATH=/usr/local/cuda/lib
CUDA-1:~$ export LD_LIBRARY_PATH=/usr/local/cuda/lib
CUDA-1:~$ env | grep LIBRARY
LDLIBRARYPATH=/usr/local/cuda/lib
LD_LIBRARY_PATH=/usr/local/cuda/lib
CUDA-1:~$

AH - it turns out it’s a bug in Ubuntu 9.04 and xorg (whatever that is):

[url=“https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/380360”]https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/380360[/url]

"Expected behaviour would be that the environment with which I call xinit is the environment that clients in the session will see.

However, this is not the case, because ssh-agent (which is setuid) is indirectly a parent of all clients."

Well this is pretty annoying. LD_LIBRARY_PATH is ignored by things which are setuid.

Am I the only one getting hit with this? Or do other people have a nice workaround?

OK one idea that was suggested in that thread would be to comment out ssh-agent in /etc/X11/Xsession.options, which I have tried, and it seems to work. I just have to hope that nothing I use depends on that.