Showing posts with label NVIDIA. Show all posts
Showing posts with label NVIDIA. Show all posts

Sunday, February 23, 2014

The Infinite Mystery of NVIDIA Linux Device Drivers 2/2


In our previous post we outlined what you have to do to install the NVIDIA graphics device driver under Centos / Redhat Linux 6.5 and similar systems.

In this post we go over each item in boring detail.

I am pretty sure there is a mistake in here somewhere (builds confidence, doesn't it?) because I distinctly recall doing an /sbin/telinit 3 and 5 at some point in the process, but obviously I have edited this out of my longer term memory.  But have no fears, if this doesn't work exactly I am sure you will get the general idea and improvise as necessary.  You have my greatest faith in your abilities.

Remember, before you begin you are expected to sacrifice a goat at least and say the proper prayers spreading the prayer cloth and so forth.

1. Are you already running the NVIDIA driver? How can you tell for sure?

The way I do this is by running "nvidia-settings" from the shell. If a window comes up, everything is installed and working. If it can't find it or it doesn't run, you do not have the driver installed and should proceed.

    nvidia-settings

2. Install the development tools.

Become su and run the command

    yum groupinstall "Development Tools" --skip-broken

Notice the quotes and capitalization. Say yes when it asks you if its ok. Then go get coffee and come back in 15 minutes.

3. Figure out the model of your graphics card.

As su, use the command

    /sbin/lspci -nn | grep VGA

The reported line will have the model of the card. It will probably begin with the word "Geforce" or "Quadro".

4. Figure out if your Linux is 32 or 64 bit

Run the command

    uname -m

and it will tell you.

5. Download the driver from Nvidia.

With your browser of choice, navigate to www.nvidia.com and click on "Drivers". You should find a menu which will ask you which OS you are running (e.g. Mac, Windows, Linux 32, Linux 64), which series of graphics card (e.g. 9 series, 8 series, 200 series, 600 series, etc) and the specific model.  Fill these in and hit search and it will find your driver. A 9xxx card is the 9 series, but a 4xx card is a 400 series.  If you do not find the model of your card then you gave it the wrong series and you should try again.

Click yes or agree on the license agreement and save the driver some place you can find it again. Get another cup of coffee and go play with your dog or something. Come back in a few minutes.

6. Put that driver someplace easy to get to, like /tmp and make it executable.

I used to skip this step but it was too much work. Copy the file you just downloaded to someplace easy to type, like /tmp. Then make it executable with the command

    cp NV* /tmp
    chmod 755 NV*

Ok, now we get to the weirder stuff.

7. Change /etc/inittab to bring the system up at level 3

    su
    cd /etc
    cp inittab inittab.orig
    vi inittab

and change the "5" in the last line to "3".

8. Blacklist Nouveau, Part 1

    su
    cd /etc/modprobe.d
    cp blacklist.conf blacklist.conf.orig
    vi blacklist.conf

and add three lines to the bottom of the file which say

    # get rid of nouveau driver
    blacklist nouveau
    options nouveau modeset=0

and save the file.

9. Blacklist Nouveau, Part 2

    su
    cd /boot/grub
    cp grub.conf grub.conf.orig
    vi grub.conf

and add the word "rdblacklist=nouveau" to the end of the lines that specify the kernel to boot. These are the longest lines in the file and begin with the phrase "kernel /vmlinux-blah-blah-blah".

Dont fuck this up or you wont be able to reboot the system without some major help.

10. Reboot the system

11. Log in as root

12. Verify the location of the system kernel libraries

    cd /usr/src/kernels
    ls

You should see some horrible name that starts with 2.6. You either want to remember that name, or if you are like me, you want to save it as a shell variable. I use csh or tcsh, if you don't then you will have to figure out how your shell does this.

    cd 2.6<esc>
    set kernelpath=`pwd`

Notice the funny direction of the quotes on that set command.

13. Install the Nvidia driver

You should still be root. Change directory to /tmp or where you put the nvidia driver and say

    cd /tmp
    ./NV<esc> --kernel-source-path=$kernelpath

You will need to use the mouse, agree to the license agreement, and watch with your breath held while it jumps through hoops. When it asks you if it can create a new X11.conf say yes. When it asks you if it can install 32 bit compatibility say yes.

If it completes without complaining much we are almost done.

14. Restore the /etc/inittab runlevel to 5

Still as root say

    cd /etc
    cp inittab.orig inittab

It will ask you if its ok to overwrite a file, say yes.

15. Reboot the system

Hopefully the system will come up and the window system will come up, and you will log in.

16. As su, run "nvidia-xconfig"

    su
    nvidia-xconfig

17. Run "nvidia-settings" and save your work.

Say

    nvidia-settings

and goof around with the different options and screens and set things to your liking. Or just say ok and quit.

That is it.

You are done.

The Infinite Mystery of NVIDIA Linux Device Drivers 1/2


We are now going to do a series of boring technical notes that nevertheless fulfill a more noble purpose.

Those of us who are interested in doing or fostering independent production with computers and computer animation have a lot to be grateful for with Linux, particularly with Centos/Redhat Linux. It is stable, scalable, various applications work with it and it is remarkably Unix-like for something that isn't Unix.

And it has so far avoided the insane Linux-of-the-day bullshit of Ubuntu, praise Allah.

But we do not live in a perfect world and a well-tempered Linux is going to be running the NVIDIA device driver with a solid, respectable NVIDIA graphics card and we are going to discuss why and then dive into the crazy shit you have to do to make it all work.

The only manufacturer out there that really supports Linux is NVIDIA, in spite of what you may have heard of Linus fingering NVIDIA. His frustration is real, but it is bullshit. For a variety of reasons NVIDIA is not able to put their device drivers in the open source because it contains proprietary information they just do not want to give their competitors. So that means that certain purists can not include it with the standard distributions. That means you have to install it yourself.

With Centos / Redhat, one also has the option of using the so-called "nouveau" driver which supposedly supports NVIDIA. I have crashed my system so many times using the nouveau driver that I do not recommend you use it for serious work. Since I also do things like CUDA/GPU development, it isnt a serious option anyway.

So we are going to install the NVIDIA driver, and it is a little wacky to do so. There are three fundamental reasons why installing the driver is so convoluted and they are (a) you can not install a graphics driver if you have graphics running, (b) in particular you have to get rid of the nouveau driver and its non-trivial to do so, and finally (c) you have to be able to "compile" the NVIDIA driver against your current Linux and that means having the development environment loaded.

There is one more reason too that this note was written. There is so much craziness on the Internet about what to do with graphics drivers that I am adding my own opinion to the mix, along with clear instructions.

In order to follow these steps, you need to know how to do basic Unix/Linux things like ls, cd, chmod and so forth, have the su/root password, be able to use a text editor like vi that can work without X running, have access to the Internet, be able to use a web browser to download files, and be able to follow instructions.

In this post, I am just going to outline what you will have to do to install the driver. In the next post, I will fill in the details of how to actually do these things.

So hold on everybody, here we go!

1. Are you already running the NVIDIA driver? How can you tell for sure?
2. Install the development tools.
3. Figure out the model of your graphics card.
4. Figure out if your Linux is 32 or 64 bit
5. Download the driver from NVIDIA.
6. Put that driver someplace easy to get to, like /tmp and make it executable.

Now we get into the more tricky stuff.

7. Change /etc/inittab to bring the system up at level 3
8. Blacklist Nouveau, Part 1
9. Blacklist Nouveau, Part 2
10. Reboot
11. Log in as root
12. Verify the location of the system kernel libraries
13. Install the Nvidia driver (say yes to compatibility mode if you are asked)
14. Restore the /etc/inittab runlevel to 5
15. Reboot the system

We are almost done, hang in there!

16. As su, run "nvidia-xconfig"
17. Run "nvidia-settings" and save your work.

My goodness, that was annoying wasn't it?

The next post will have the mere details of how you actually do these things. The only thing really, really arcane is the blacklist of Nouveau.



Friday, October 25, 2013

The Mighty Sphere


About two years ago, I decided to learn NVIDIA's GPU programming environment, CUDA. I wrote a volume renderer in it which can render anything you want as long as it is a sphere.

The problem of course with volume rendering is getting data to render. Volume datasets are usually associated with scientific visualization and when you can get them at all they are not trivial to process. They are real data about real things and it requires serious work to make something of them.

So, for my tests I used normal 3D objects but made every vertex a sphere. It turned out pretty well. Here are two test images, one with glowy spheres and one with spheres that were more hardedged.

You get extra credit if you can figure out what they were originally.








Give up?  The one on the bottom is an upside down SR-71.   The one on top is something with a backbone, you can see the vertebrae clearly.  Dont remember what it was, though.