Updated tutorial, done on 9.04 Alpha 6, but again, should work on older ubuntu distros
Confirmed working on Debian 5.0 Lenny as well
GPU folding in Linux is exclusive to nvidia cards, 8x00 series and up, if you have a ATi card, you are out of luck :(
If you really wish to maximize the performance you get in Folding@Home, I highly recommend you try it under Linux. Linux scales multi-core CPUs much better then Windows does, so you will under most circumstances gain a significant boost in speed, and at the same time get much more points per day. I myself have experienced up to 100% increase in PPD over the windows SMP client, that's pretty amazing isn't it? Well, it gets better, according to Max, using his i7 with -smp 8 yields a 300% increase in PPD over the windows SMP client. :awsm:
Check out the difference of my E8500 on Linux and Windows
But I'm a gamer, and Linux doesn't run the games I play!
No problem, you have two options: Running Linux and Windows in dual boot, which I will explain in detail below, or you can use a virtual machine.
You do not need to actually install Linux to your system to get the benefits, equal results can be achieved using a virtual machine running Linux as a guest operating system. That way, you can run the Linux SMP client inside the machine to get maximum performance out of your CPU, while keeping everything else in Windows. If you want to use Linux this way the best way would be to get VMware Server.
However, VMware can only use two cores, so if you are doing this with a quad core, you would get 50% of the potential performance. Once you have VMware up and running, just follow the same steps below until you have configured the GPU client. The GPU client will not work, because VMware cannot utilise your graphics card. If you want to run a GPU client as well, the gain you would get by running the CPU client in Linux can only be achieved using Vista, since the virtual machine can only use one core in XP if you are running the GPU client.
If you decide to run it using VMware, you are missing out, since I switched to Linux the only thing I ever use windows for is gaming.
Alright, how do I install Linux?
First thing's first, you need a Linux distribution, I recommend "Ubuntu". It is one of the most used Linux distributions there is and it's also the user friendliest, so newcomers to Linux won't be overwhelmed by massive terminal usage.
One of the most important things to do is to have space for Ubuntu. Vista users will find this an easy task, simply right click on 'My Computer', click 'Manage' and under disk management, you can shrink partitions and create new. I recommend using a unique disk for Ubuntu though, to keep Windows' Master Boot Record intact. This isn't a tutorial on the basics of creating partitions, if you need more help with that, use Google ;) 20GB should be more than enough for a Linux folder.
For this tutorial I am going to use Ubuntu 8.10, the newest stable release. (Max has pointed out that Ubuntu 8.04 LTS has superior scaling for quad cores, and is also better to use if you are running Linux inside a virtual machine, so if either applies to you, get 8.04 instead of 8.10, every single step below should be EXACTLY the same) Start off by downloading the .ISO for the LiveCD. The LiveCD allows you to try out Ubuntu from the CD without making any changes to your system. Head over to: http://www.ubuntu.com/getubuntu/download. Ubuntu 8.10 should be selected by default. Under 'Custom Options' check 64bit version. IT IS VITAL THAT YOU USE THE 64-BIT VERSION! OR ELSE YOU CANNOT FOLD WITH MULTIPLE CPU CORES. Select a mirror close to you and start downloading. The filename of your download should be: 'ubuntu-8.10-desktop-amd64.iso' (or 'ubuntu-8.04.1-desktop-amd64.iso' if you choose to go with 8.04)
Okay, so you have the .iso file now. Next thing to do is to burn it to a CD. Insert a blank CD into your CD-ROM drive (I'm going to assume that everyone reading this has a CD drive capable of writing, if not, you can request a free CD, but that could take quite a while to ship). Now, use your favorite burning program (I use Alcohol 120%) to burn the .iso into the disc. Reboot your system. If you did it right, the Ubuntu CD menu should pop up. If you want to try Ubuntu out before installing it, press "Try ubuntu without making any changes to the system". You can then do the following steps by pressing an install shortcut on the desktop.
Installation is pretty straight forward, just follow a few quick and easy steps until you arrive at the partition manager. If you can identify your hard drives you are in luck. Equally sized hard drives from the same maker are hard to distinguish, so make sure you are not overwriting anything. If you have a unique disk for ubuntu, select 'use whole disk' and choose that disk. If you just have a partition for Ubuntu, go to custom settings and select said partition. You should be able to distinguish partitions there, any windows partition since Windows98 is formatted as 'NTFS', storage partitions are often either 'Fat32' or 'NTFS' and Linux partitions are EXT3. If you created a new partition, you should see a partition that is unformatted. It is best to have the Linux partition in front of the Windows partition, but if you are installing Linux after Windows, odds are the Linux partition is behind. Select the partition and format it to EXT3. I recommend leaving out a couple of GB and then formatting those as SWAP, SWAP partitions serve the same purpose as Pagefile in Windows, so if your RAM fills up, Linux will simply write data onto the SWAP. Take note of what the device name is being used (In most cases '/dev/sda#', '/dev/sdb#' and so on, while the number behind it represents the partition number of said disk). installing GRUB to HD0 is fine, but it's always best to install it onto the disk, or even partition itself (if Linux is in front of Windows on the hard drive). If you opt to install it to HD0, you could really mess things up if you start tampering with the boot order of hard drives. So, in advanced settings, choose to install GRUB on '/dev/sdx', being the hard disk you are about to install Ubuntu on.
Start the installation. After installing, it will prompt you to take out your CD and restart. Do so. Now, if you have done everything correctly, you should see GRUB appear after the POST message, and you should be able to choose between all your operating systems. Boot into Ubuntu.
That's it! You have booted into Ubuntu! The next logical step would be to update the system, a red arrow should pop up on the right side of the top menu bar indicating updates. Everything is selected by default, so just get all the updates. After downloading and installing updates it's time to restart and set up F@H!
Setting up the CPU Client:
Setting up the CPU client is pretty straight-forward
Start by opening a terminal, located in Applications > Accessories > Terminal
Then type in or copy/paste this into the terminal. (Best to do so one line at a time)
sudo apt-get install ia32-libs mkdir -p ~/folding cd ~/folding wget http://www.stanford.edu/group/pandegroup/folding/release/FAH6.24beta-Linux.tgz tar xzf FAH6.24beta-Linux.tgz
Now, to configure the client:
./fah6 -smp -verbosity 9
This is where it gets tricky, because there is no available source for the GPU client, only the Windows binaries. Therefore we will use Wine to run it.
But firstly, we need to install drivers and the CUDA toolkit.
Let's download the latest CUDA enabled driver.
Go to System > Administration > Hardware Drivers and select the 180 drivers, let them download and install.
The next step is downloading the CUDA toolkit. Open a new terminal and type in:
sudo sh NVIDIA_CUDA_Toolkit_2.0_ubuntu7.10_x86.run
Then, we need to link the toolkit.
sudo sh -c "echo '/usr/local/cuda/lib' > /etc/ld.so.conf.d/cuda.conf" sudo ldconfig
The following command will download the latest binary release of wine (currently 1.1.9)
sudo apt-get install wine
You need to download the CUDA wrapper, or else the GPU client is likely to use up 100% CPU and simply freeze everything you are doing.
If you just installed Wine, you might want to create the directory structure before starting up the GPU client, do so by simply running notepad.
wget http://www.gpu2.twomurs.com/wrapper2ndgen/2.1/cudart.dll.so -O ~/.wine/drive_c/windows/system32/cudart.dll ln -s ~/.wine/drive_c/windows/system32/cudart.dll ~/.wine/drive_c/windows/system32/nvcuda.dll
user@computer:~$ ldd /usr/local/lib/wine/nvcuda.dll.so linux-gate.so.1 => (0xf7fae000) libcudart.so.2 => /usr/local/cuda/lib/libcudart.so.2 (0xf7f34000) libwine.so.1 => /usr/local/lib/libwine.so.1 (0xf7dfd000) libm.so.6 => /lib32/libm.so.6 (0xf7dd6000) libc.so.6 => /lib32/libc.so.6 (0xf7c78000) libdl.so.2 => /lib32/libdl.so.2 (0xf7c74000) libpthread.so.0 => /lib32/libpthread.so.0 (0xf7c5b000) librt.so.1 => /lib32/librt.so.1 (0xf7c52000) libstdc++.so.6 => /usr/lib32/libstdc++.so.6 (0xf7b64000) libgcc_s.so.1 => /usr/lib32/libgcc_s.so.1 (0xf7b54000) /lib/ld-linux.so.2 (0xf7faf000)
Hard part is over, now it's just setting up the client. Start by downloading it. To do this open a new terminal and type this:
mkdir ~/gpu0 cd ~/gpu0 wget http://www.stanford.edu/group/pandegroup/folding/release/Folding@home-Win32-GPU_XP-623.zip unzip Folding@home-Win32-GPU_XP-623.zip
nice -n 19 wine [email protected] -forcegpu nvidia_g80
After configuring it, your client should be folding away.
DUAL GPU FOLDING
Max has pointed out that you can easily fold with two nvidia GPUs, follow these steps if you have two configured CUDA-supported nvidia cards without SLi.
mkdir ~/gpu1/ cp ~/gpu0/Folding@home-Win32-GPU_XP-623.zip ~/gpu1/ cd ~/gpu1/ unzip Folding@home-Win32-GPU_XP-623.zip
nice -n 19 wine [email protected] -forcegpu nvidia_g80 -gpu 1
Scripts for running the clients.
I don't like to have a lot of programs start up with my OS, so I have a simple script to start my clients.
Run these commands to create scripts for every client (Users with only one GPU need not do the last command)
echo -e "cd ~/folding/\n./fah6 -smp -verbosity 9 -advmethods" > ~/folding/fahcpu
echo -e "cd ~/gpu0/\nnice -n 19 wine [email protected] -forcegpu nvidia_g80 -verbosity 9 -advmethods -gpu 0" > ~/folding/fahgpu0
echo -e "cd ~/gpu1/\nnice -n 19 wine [email protected] -forcegpu nvidia_g80 -verbosity 9 -advmethods -gpu 1" > ~/folding/fahgpu1
echo -e "gnome-terminal -x ./fahcpu\ngnome-terminal -x ./fahgpu0\ngnome-terminal -x ./fahgpu1" > ~/fah
chmod +x fahcpu fahgpu0 fahgpu1 fah
Overclocking your GPU in Linux
If you are doing this, I assume you have already done so in Windows and know the safe clocks for your card(s). To overclock your video card in Linux you have to enable 'coolbits' in your nvidia control panel. To do this we will have to edit the xorg configuration
sudo gedit /etc/X11/xorg.conf
Save the file and quit. Now you will have access to the CoolBits menu under your nvidia control panelSection "Device"
Identifier "Configured Video Device"
Option "NoLogo" "True"
Option "Coolbits" "1"
Access the control panel by going to System > Administration > NVIDIA X Server Settings, or simply typing "nvidia-settings" in a terminal. You should now see a 'Clock Frequencies' section where you can set your clocks. This has to be done every time you boot up Linux though, so the most convenient way would be to flash your video card with a BIOS with increased clock settings. Doing that is risky and is NOT RECOMMENDED UNLESS YOU KNOW EXACTLY WHAT YOU ARE DOING.
For monitoring, I will use FahMon. If you have been folding on Windows, you have perhaps been using FahMon. So, we head over to http://www.fahmon.net/ and go to download. Now, this is one of the things that has kept people away from Linux, installing programs. Most people are used to downloading a .exe installer and running it, pressing next a lot of times and there we go. That's a binary installation, where you just install the program itself and what is needed to run it. Binary installers for Ubuntu are .deb files, they are just as simple to install as .exe are in Windows. There are no binary installers for FahMon, only the source installer. That means we have to compile the source ourselves! So, let's get this going, open a terminal and type:
sudo apt-get install subversion svn export http://svn.fahmon.net/trunk fahmon cd fahmon
sudo apt-get install build-essential sudo apt-get install libwxgtk2.8-0 libwxgtk2.8-dev libcurl4-dev
./configure make sudo make install
This guide was based on information from:
Folding@Home Linux SMP Guide
NVIDIA GPU2 Linux/WINE Headless Install Guide
Feel free to improve this guide and redistribute it, giving me credit would be greatly appreciated
If you have any questions, issues or anything regarding F@H under Linux, just ask in this thread and I will try to help.
What to do if my xserver doesn't start?
Last edited by Sydney (2009-08-24 13:54:35)