Jump to content

F@h Gpu On Native Linux Guide


Recommended Posts



This is a guide to setting up the nVidia Folding@Home GPU client on a 64-bit linux operating system. I have written it based on Ubuntu Hardy Heron (8.04) but it should be the same on other versions of Ubuntu 8.04+. If you are using the 32-bit version of ubunbtu, leave out the 64-bit only steps. This guide assume you have already installed Linux and have some general knowledge of how to use it.




A lot of people run the Folding@Home SMP client in Linux because it is much fster than the

Windows version but it means that you cannot run the GPU client as there is not yet a Linux version. By following this guide, you will be able to run the SMP client along side the GPU client in native Linux without any performance loss.


First Steps


The first thing to do once Linux is installed is update it. A balloon tip might appear in the top right of your screen to notify you of updates. If this happens, click the icon that the balloon tip is comming from and a window will appear. It may ask you for your password, if so enter it and click the 'Install' button in the window. You may have to wait a while for the updates to download and install. If it asks you to restart, do so.


32-bit libraries


If you are running Ubuntu 64-bit you will need to install 32-bit libraries for most programs to work. To do this first we need to update the app repositories. Open a terminal by clicking on the Applications menu at the top of your screen. Then go to Accessories -> Terminal. A window that resembles the windows command prompt will appear. Into this window copy and past the following command (to paste into the terminal you must right click -> Paste, Ctrl+V will not work):


sudo apt-get update


Note: Whenever the sudo command is used you may be prompted for your password. Sudo just gives you the equivalent of adminastrative priveleges in Windows.


Next we need to download and install the 32-bit libraries. In the terminal type (or copy paste):


sudo apt-get install ia32-libs




For the next step we need to install wine. But don't get too excited, I'm not talking about the alcoholic kind (although you may need some after following this step). Wine is a translation layer for running programs written for Windows on a Unix OS (in this case Ubuntu Linux). This is what will allow us to run the Windows GPU client in Linux. To start off, download the Wine source code from Here to your Linux desktop (when the download dialog appears, just click save). When the download has completed we need to get build dependencies for Wine (don't worry if you don't understand some parts, just follow the steps and you'll be OK ;) ). To do this run the following command in a terminal:


sudo apt-get build-dep wine


If it asks you are you sure or something like that, type 'y' and press enter. This process may take a while so you might want to enjoy a hot cup of tea with some digestives in the meantime. When it is finished go to your desktop and right click 'wine-1.1.15.tar.bz2' that we downloaded earlier then click 'Extract Here'. GO back to the terminal and run the command:


cd Desktop/wine-1.1.15


This changes our working directory to the one that contains the files that we just extracted. If you have the 64-bit version of Ubuntu installed (you should have to run the SMP client) then you need to run the following commands:


mkdir -p `pwd`/lib32
ln -s /usr/lib32/libX11.so.6 `pwd`/lib32/libX11.so
ln -s /usr/lib32/libXext.so.6 `pwd`/lib32/libXext.so
ln -s /usr/lib32/libfreetype.so.6 `pwd`/lib32/libfreetype.so
ln -s /usr/lib32/libfontconfig.so.1 `pwd`/lib32/libfontconfig.so
ln -s /usr/lib32/libGL.so.1 `pwd`/lib32/libGL.so
ln -s /usr/lib32/libGLU.so.1 `pwd`/lib32/libGLU.so
ln -s /usr/lib32/libXrender.so.1 `pwd`/lib32/libXrender.so
ln -s /usr/lib32/libXinerama.so.1 `pwd`/lib32/libXinerama.so
ln -s /usr/lib32/libXxf86vm.so.1 `pwd`/lib32/libXxf86vm.so
ln -s /usr/lib32/libXi.so.6 `pwd`/lib32/libXi.so
ln -s /usr/lib32/libXrandr.so.2 `pwd`/lib32/libXrandr.so
ln -s /usr/lib32/liblcms.so.1 `pwd`/lib32/liblcms.so
ln -s /usr/lib32/libpng12.so.0 `pwd`/lib32/libpng.so
ln -s /usr/lib32/libcrypto.so.0.9.8 `pwd`/lib32/libcrypto.so
ln -s /usr/lib32/libssl.so.0.9.8 `pwd`/lib32/libssl.so
ln -s /usr/lib32/libxml2.so.2 `pwd`/lib32/libxml2.so
ln -s /usr/lib32/libjpeg.so.62 `pwd`/lib32/libjpeg.so
ln -s /usr/lib32/libXcomposite.so.1 `pwd`/lib32/libXcomposite.so
ln -s /usr/lib32/libcups.so.2 `pwd`/lib32/libcups.so
ln -s /usr/lib32/libXcursor.so.1 `pwd`/lib32/libXcursor.so
ln -s /usr/lib32/libdbus-1.so.3 `pwd`/lib32/libdbus-1.so
ln -s /usr/lib32/libhal.so.1 `pwd`/lib32/libhal.so
ln -s /usr/lib32/libsane.so.1 `pwd`/lib32/libsane.so
ln -s /usr/lib32/libgphoto2.so.2 `pwd`/lib32/libgphoto2.so
ln -s /usr/lib32/libgphoto2_port.so.0 `pwd`/lib32/libgphoto2_port.so
ln -s /usr/lib32/libldap-2.4.so.2 `pwd`/lib32/libldap.so
ln -s /usr/lib32/libldap_r-2.4.so.2 `pwd`/lib32/libldap_r.so
ln -s /usr/lib32/liblber-2.4.so.2 `pwd`/lib32/liblber.so
ln -s /usr/lib32/libxslt.so.1 `pwd`/lib32/libxslt.so
ln -s /usr/lib32/libcapi20.so.3 `pwd`/lib32/libcapi20.so
ln -s /usr/lib32/libjack.so.0 `pwd`/lib32/libjack.so
ln -s /usr/lib32/libodbc.so.1 `pwd`/lib32/libodbc.so


Don't be intimidated by all that, just copy & paste it into the terminal and it will sort everything out. Next we need to compile the Wine source code. Run:


CC="gcc-4.2 -m32" LDFLAGS="-L/lib32 -L/usr/lib32 -L`pwd`/lib32 -Wl,-rpath,/lib32 -Wl,-rpath,/usr/lib32" ./configure -v


To prepare all the files. Then run the following command but replace the #s with the number of cores your processor has then add one. So for duals it'll be 3, for quads 5, for i7s 9. This will change all the source code from human interpretible code into code instructions that the computer can interpret


make -j# depend && make -j#


This could take a long time, it took about 5 minutes on my quad. Not sure how long on other CPUs but obviously duals will be slower and Unicores will be painfully slow. Finally we need to install the program we just compiled, so run:


sudo make install


Now close the terminal and download "nvcuda.dll.so.txt" and "cudart.dll.so.txt" to your desktop. Remove the .txt extension from both files then open a new terminal (Applications -> Accessories -> Terminal). Run:


cd Desktop


To change the working directory to your desktop. Then copy the two files you just downloaded to '/usr/local/lib/wine' by running the folowing two commands:


sudo cp nvcuda.dll.so /usr/local/lib/wine
sudo cp cudart.dll.so /usr/local/lib/wine


nVidia Drivers


First we need to find out which kernel version you are running. To do this go to System -> Administration -> System Monitor -> System tab, it shows which kernel version you are using in the line "Kernel Linux". Then go to System -> Administration -> Synaptic Package Manager and search for "linux header" (There's a search button at the top of the window). Click the file which is called 'Linux-kernel' followed by the kernel version that we found before, then 'Mark for installation'. Now click apply. If the file was already ticked you don't need to do it again. Now do another search for "build-essential". Mark the file with that exact name then click apply (If it is already there, skip it). Next we need to download the nVidia driver installer from Here to your desktop. Rename the file to 'nv.run'. This is just to make it easier to remember.




You will need to write down or print the following commands because we will be executing them


without a GUI, that means you won't be able to view firefox.


Press Ctrl+Alt+Backspace to go back to the logon screen

Press Ctrl+Alt+F2 to enter text only mode

Enter your username, press enter.

Enter your password, press enter.


Then run these command as if you were in a terminal. But obviously you will have to type them manually because you cannot see this page.


sudo /etc/init.d/gdm stop
cd Desktop
sudo sh nv.run


This stops the desktop manager and runs the nVidia driver installer. A low-res installer will appear. You will need to navigate it with only your keyboard. All you will need is the left and right arrow key and the enter key. If the installer finds an older driver version, allow it to overwrite it. The installer will fail to find anything on the nVidia FTP server, so it will ask you to build the source for your kernel (This is why we needed the headers earlier) Allow it do so. Allow it to install OpenGL 32-bit libraries if you want to play games on this Linux installation, of not you don't have to allow it. Allow it to update the xorg.conf file and backup the old one. When it is finshed run the folloeing command to restart the desktop manager (thus re-entering the GUI).


sudo /ect/init.d/gdm start




If you get a request in low-res asking you to reconfigure your monitor and resolution. Do so and you should be back in the GUI. Now login again. Check that the item "Nvidia X Server Settings" is present in Applications -> System Tools. If it is, the installation was a success.


CUDA Toolkit


Now we've installed the drivers we need the CUDA toolkit. Donwload it from Here to the desktop. Then rename it to 'cuda.run', so we can easily remember the name. Open a new terminal and run:


cd Desktop
sudo sh cuda.run


This will start the installer. This time there is no need to go into text-only mode. If it asks about a path just press enter to use the default.


CUDA & Wine


Now we need to combine CUDA & Wine so that we can run the GPU client. Run the following in a terminal:


cd /etc/ld.so.conf.d
sudo gedit cuda.conf


A text editor will open, copy and paste the following path into it then click save.




GPU Client


Now download the Windows GPU client from Here to your desktop. Right click -> Extract here. Now open the folder on your desktop 'folding@home****' that the GPU client extracted to. Copy and paste the contents to your Home folder (Places -> Home). Now rename '[email protected]' to 'fahgpu.exe' or something easy to remember.


Running The Client


When you want to run the client, open a terminal and type:


cd Desktop
wine fahgpu.exe -any_params_here


Replace '-any_params_here' with any command line arguments that you would usually use in windows such as '-forceasm' & '-advmethods'. When you want to stop the client, use the usual Ctrl+C then type:


wineserver --kill


To stop wine from running in the background. Now you can successfully fold on your CPU & GPU in native Linux. If you have any problems or questions, don't be afraid to post here or PM me.


Reading Sensors


You may want to monitor temps & clocks etc. To install lm-sensors run the following in a terminal:


sudo apt-get install lm-sensors
cd /usr/share/lm-sensors
sudo gedit mkdev.sh


The text editor should open with an empty file, copy and paste the following into it:



# Here you can set several defaults.

# The number of devices to create (max: 256)

# The owner and group of the devices
# The mode of the devices

# This script doesn't need to be run if devfs is used
if [ -r /proc/mounts ]; then
if grep -q "/dev devfs" /proc/mounts; then
echo "You do not need to run this script as your system uses devfs."


while [ $i -lt $NUMBER ]; do
echo /dev/i2c-$i
mknod -m $MODE /dev/i2c-$i c 89 $i || exit
chown "$OUSER:$OGROUP" /dev/i2c-$i || exit
i=$[$i + 1]
#end of file


Click save and close the text editor. Now run in a terminal:


sudo chmod 755 mkdev.sh
sudo ./mkdev.sh
sudo sensors-detect


Answer yes to all prompts when asked to probe buses. Press enter twice when asked. The it will ask 'Do you want to add these lines automatically?', say yes. Then run in a terminal:


 sudo /etc/init.d/module-init-tools


To read the sensors:


 sudo sensors


You should get an output similar to the following:



Adapter: ISA adapter

in0: +1.31 V (min = +0.00 V, max = +4.08 V)

in1: +1.20 V (min = +1.28 V, max = +1.68 V)

in2: +3.23 V (min = +2.78 V, max = +3.78 V)

in3: +2.93 V (min = +2.67 V, max = +3.26 V)

in4: +3.01 V (min = +2.50 V, max = +3.49 V)

in5: +1.26 V (min = +0.58 V, max = +1.34 V)

in6: +2.06 V (min = +1.04 V, max = +1.36 V)

in7: +2.91 V (min = +2.67 V, max = +3.26 V)

in8: +3.26 V

fan1: 777 RPM (min = 3245 RPM)

fan2: 0 RPM (min = 3245 RPM)

fan3: 0 RPM (min = 3245 RPM)

fan4: 1194 RPM (min = -1 RPM)

fan5: 0 RPM (min = -1 RPM)

temp1: +21.0



Edited by AJW256

Share this post

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now
  • Create New...