Ubuntu 11.10 F@H smp and gpu3 instructions

Uppsala9496

Diamond Member
Nov 2, 2001
5,272
19
81
Since the 6th Annual Folding at Home race is underway, I thought it might be good to put out some instructions on how to get F@H running in Ubuntu. I had a heck of a time in the past getting things to function correctly. Lots of googling for the answer, so I thought putting a post here that can just fade away, but be easily searchable, would be helpful.

The instructions I'm posting are from the F@H site for the smp, and a combination of instructions for the gpu3 client for nvidia cuda based cards. This is for Ubuntu 11.10. While I can not guarantee that these will work for you, I have used them 4 times on two separate machines with no issues. I ditched the Unity interface for gnome (let me know if you need help with that).

SMP client - requires the 64bit version of Ubuntu - so make sure you have 64bit, not 32bit.
type the following code in the terminal code:

sudo apt-get install ia32-libs

sudo apt-get install curl

When prompted for your password, type it in and press enter.

In the same terminal that you previously entered the instructions to get curl, copy/paste each line that follows separately and hit enter. When copy/pasting, use the right mouse button (terminal does NOT like ctrl-v).

mkdir -p ~/folding

cd ~/folding

curl -O http://www.stanford.edu/group/pandegroup/folding/release/FAH6.34-Linux64.tgz

tar xzf FAH6.34-Linux64.tgz

After each line of code above, make sure you have hit enter and let it do its thing before proceeding to the next line. It should look something like this:
user@box:~$ mkdir -p ~/folding

user@box:~$ cd ~/folding

user@box /folding:~$ curl -O http://www.stanford.edu/group/pandegroup/folding/release/FAH6.34-Linux64.tgz

user@box /folding:~$ tar xzf FAH6.34-Linux64.tgz

After the FAH client is downloaded, the client needs to be configured. Please run these 2 commands:

chmod +x fah6

./fah6 -configonly -smp


After the client is configured, there are different methods for starting the FAH client. The most basic method is to enter in following command:

./fah6 -smp -verbosity 9

OPTIONAL (which is what I did): To make starting FAH a little easier, make a script by running the following commands:

echo "./fah6 -smp -verbosity 9 $* &" > fah


chmod +x fah

Now simply enter this command to run FAH...

./fah

...and all those additional FAH client flags will get added automatically.

The mistake that I kept making was I failed to change the directory in the terminal in order to run F@H after it had been closed for whatever reason.

So, after a computer restart for any reason, or having shut the client down, you need to make sure you change the directory in the terminal to run F@H.
run:
cd ~/folding

and then:
./fah

In terminal you can use your up arrow key on the keyboard to start scrolling through your recent entries, so it's only 2 or 3 key strokes to get F@H running.

You will have the smp client up and running. The instructions were taken from http://folding.stanford.edu/English/LinSMPGuide

The gpu3 client is a little more work to get up and running, however once everything is set, it's simple to run. This is assuming you have a CUDA based card.

How to get F@H GPU3 to work in Ubuntu:
Step 1
Install CUDA drivers. The Ubuntu (post-release)(version current-updates) work just fine.

Now we need to get and install the CUDA 3.0 toolkit. Version 4+ is out, however 3.0 is verified to work so that is what we will be using.

Step 2
Go to: http://developer.nvidia.com/cuda-toolkit-30-downloads
Download the 32bit CUDA Toolkit for Ubuntu Linux 9.04 even though you are on a 64bit system on Ubuntu 11.10.

Step 3
Once the drivers are saved (toolkit_3.0_linux_32_ubuntu9.04.run), save them to your desktop.
Location: /home/yourUserName/Desktop
mine is at /home/tim/desktop

Step 4
In your Terminal, execute the CUDA toolkit installer. When you are prompted for the installation path, just press Enter.
Terminal Code:
sudo sh ~/Desktop/cuda*.run

CUDA will be installed on your system.

Step 5
The system must be configured so that it can locate the CUDA binaries and libraries. Execute the following commands in your Terminal separately.
Terminal Code:

sudo sh -c "echo PATH=/usr/local/cuda/bin:$PATH > /etc/profile.d/cuda.sh"
_________________________________________________________________________________
sudo sh -c "echo PATH=/usr/local/cuda/bin: $PATH > /etc/profile.d/cuda.sh"
please note that there is no space between bin: and $path. Silly smiley face messed up the code.
_________________________________________________________________________________

sudo sh -c "echo /usr/local/cuda/lib > /etc/ld.so.conf.d/cuda.conf"

sudo ldconfig

and one of the most critical steps:
Restart your computer.
If you don't restart, you will run into linking errors at step 9 and 10.


Step 6
After the computer restarts, open a terminal.
Verify that the NVIDIA drivers are running by executing the following command.
Terminal Code:

glxinfo | grep vendor

You should see something like the following:
user@box:~$ glxinfo | grep vendor
server glx vendor string: NVIDIA Corporation
client glx string: NVIDIA Corporation
OpenGL vendor string: NVIDIA Corporation
user@box:~$

If you do NOT see NVIDIA Corporation displayed, as above, then run the following command.
Terminal Code:

sudo nvidia-xconfig

After running this command, go to System > Log Out, and then log back in. If the NVIDIA Corporation still does not display, the driver is not configured correctly. Make sure you activated the restricted drivers.
(To use a restricted driver for a device:
Press System → Administration → Hardware drivers
Find the driver which you would like to enable and check the box in the Enabled column, next to its name. We want Ubuntu (post-release)(version current-updates)
You will be asked to confirm that you want to enable the driver. Press Enable Driver
The restricted driver may have to be downloaded and installed
You may need to restart your computer to finish enabling the driver)

I've never had this issue, so I'm guessing that just repeating everything to this point is fine.

Step 7
Install Wine (wine1.3 1.3.32-0ubuntu1~ppa1~oneiric1) from the Ubuntu Sfotware Center.
Also make sure the Windows Compatability Layer (beta release) gets installed. It should automatically do it.

Step 8
We now need to configure Wine.
Applications > Wine > Configure Wine. It may take up to two minutes to start the first time you run it. Be patient.
Once Wine Configuration appears, change the Windows Version displayed at the bottom to Windows XP (this should be there by default). Then click the Audio tab at the top.
When you click the Audio tab, a dialog box will appear saying that defaults have been chosen for your sound card. The defaults are fine, so click OK on the dialog box. Then click OK on the Wine Configuration box to close it. (unsure how necessary this step is, however since it takes little effort, I am leaving it in)

Step 9
Install the Wine CUDA DLL nvcuda.dll by executing the following command. This DLL helps Wine translate Windows CUDA system calls into Linux CUDA system calls.
Code:

sudo sh -c "echo '/usr/local/cuda/lib' > /etc/ld.so.conf.d/cuda.conf"

sudo ldconfig

Step 10
Create the WINE directory structure:
Code:

wine notepad

Disregard the errors; all we need is the directory structure created in ~/.wine when you run it the first time.

Step 11
Download the latest Wine wrappers, save them to Wine's windows/system32 directory, and create a few symlinks:
Code:

cd ~/.wine/drive_c/windows/system32

wget http://www.linuxfah.info/wrapper-3.0/cudart/cudart.dll.so

wget http://www.linuxfah.info/wrapper-3.0/cufft/cufft.dll.so

ln -s cudart.dll.so cudart32_30_14.dll

ln -s cudart.dll.so cudart.dll

ln -s cudart.dll.so nvcuda.dll

ln -s cufft.dll.so cufft32_30_14.dll

ln -s cufft.dll.so cufft.dll

Test to make sure the wrapper is properly linked:
Code:

ldd ~/.wine/drive_c/windows/system32/cudart.dll

The output should look something like this:
Code:
linux-gate.so.1 => (0xf7706000)
libcudart.so.3 => /usr/local/cuda/lib/libcudart.so.3 (0xf7697000)
libwine.so.1 => /usr/lib32/libwine.so.1 (0xf7556000)
libm.so.6 => /lib32/libm.so.6 (0xf752f000)
libc.so.6 => /lib32/libc.so.6 (0xf73cc000)
libdl.so.2 => /lib32/libdl.so.2 (0xf73c8000)
libpthread.so.0 => /lib32/libpthread.so.0 (0xf73af000)
librt.so.1 => /lib32/librt.so.1 (0xf73a6000)
libstdc++.so.6 => /usr/lib32/libstdc++.so.6 (0xf72b7000)
libgcc_s.so.1 => /usr/lib32/libgcc_s.so.1 (0xf72a7000)
/lib/ld-linux.so.2 (0xf7707000)
If you see any of the libraries with "not found" then the linking didn't work. Go back to step 9.

Step 12
Create the following script to initialize CUDA without running X.
Terminal Code:

cd
nano -w cudainit

Paste the following into the file:
Select all of the following and paste:

#!/bin/bash

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

modprobe nvidia

if [ "$?" -eq 0 ]; then

# Count the number of NVIDIA controllers found.
N3D=`/usr/bin/lspci | grep -i NVIDIA | grep "3D controller" | wc -l`
NVGA=`/usr/bin/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


To exit nano and save the file, hit CTRL-X.

Step 13
Make the cudainit file executable.
Code:

chmod u+x cudainit

Step 14
Run the cudainit script as root.
Code:

sudo ./cudainit

You should now have a few extra devices in /dev; check to make sure:
Code:

ls /dev/nv*

If you have one video card, you should see the following:
Code:
/dev/nvidia0 /dev/nvidiactl
You will need to rerun this script before starting the client whenever you reboot your system. You may want to include this in a login/startup script so it executes automatically whenever you reboot.
(wife is currently watching tv, so I can't get on my ubuntu machine to see exactly what I did to have it auto run. I'll update this later when I have access to the tv).

Step 15
Time to download the console version of the GPU3 folding client (finally!):
Select all of the following code:

wget http://www.stanford.edu/~friedrim/.Folding@home-Win32-GPU_XP-631.zip -O Folding@home-Win32-GPU_XP-631.zip

Step 16
Ubuntu doesn't come with an unzip program, so we'll install it:
Code:

sudo apt-get install unzip

Step 17
Create a directory to keep your folding files, then unzip the client into it, and delete the Stanford-supplied .dll files:
Code:

mkdir ~/fahgpu3

unzip Folding@home-Win32-GPU_XP-631.zip -d fahgpu3

rm ~/fahgpu3/*.dll

Step 18
Time for the moment of truth: let's start the client!
For all 400-series (Fermi) GeForce cards:
Code:

cd ~/fahgpu3

nice wine Folding@home-Win32-GPU.exe -verbosity 9 -forcegpu nvidia_fermi

If you have more than one video card, you can run a separate instance of the client using the -gpu flag. Use -gpu 0 for the first card, then -gpu 1 for the second card, etc. If you have only one card, you don't need the -gpu flag. Make sure that you assign different Machine IDs during the configuration if you run more than one client!

Step 19
To make sure the GPU client doesn't use an entire CPU core, use the Auto-Mator script to start the client. Auto-Mator will lower the CPU demand of the GPU client by automatically adjusting the SLEEPWAIT environmental variable:
Code:

cd ~/fahgpu3

wget http://www.linuxfah.info/wrapper-3.0/auto-mator-fermi.sh
chmod +x auto-mator-fermi.sh


./auto-mator-fermi.sh


Now you are all set. To run the gpu3 client, change the directory to
cd ~/fahgpu3

then the following to run the client:
./auto-mator-fermi.sh

You should now be up and running with the gpu3 client. I have done with for a GT440 and 2 separate GTS450's.
Compiled from using
http://www.evga.com/forumsarchive/tm...00561984&mpage
through steps through wine. Unable to Install the Wine CUDA DLL nvcuda.dll by executing the following command. This DLL helps Wine translate Windows CUDA system calls into Linux CUDA system calls.
Code: sudo wget http://www.gpu2.twomurs.com/wrapper2ndgen/2.1/cudart.dll.so -O /usr/lib32/wine/nvcuda.dll.so

The webaddress for gpu2 failed, so proceeded to http://foldingforum.org/viewtopic.php?f=54&t=6793
for steps 10 to the end. GPU3 has been running fine for my GT440 and GTS450's.

Hope this is helpful for someone. It looks like a lot of work, but it really isn't that bad to get the GPU3 client up and running. You will get some silly wine popup box error stating that the card is not supported by folding at home, but click ok and it will fold just fine. No errors on any of my gpu3 work units.
 
Last edited:

GoStumpy

Golden Member
Sep 14, 2011
1,212
11
81
I tried.. and failed... I hate Linux:

stumpy@stumpy-desktop:~$ sudo apt-get install curl
[sudo] password for stumpy:
Reading package lists... Done
Building dependency tree
Reading state information... Done
curl is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
stumpy@stumpy-desktop:~$ mkdir -p ~/folding
stumpy@stumpy-desktop:~$ cd ~/folding
stumpy@stumpy-desktop:~/folding$ curl -O http://www.stanford.edu/group/pandeg...34-Linux64.tgz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7135 0 7135 0 0 30209 0 --:--:-- --:--:-- --:--:-- 50602
stumpy@stumpy-desktop:~/folding$ curl -O http://www.stanford.edu/group/pandegroup/folding/release/FAH6.34-Linux64.tgz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 142k 100 142k 0 0 152k 0 --:--:-- --:--:-- --:--:-- 205k
stumpy@stumpy-desktop:~/folding$ tar xzf FAH6.34-Linux64.tgz
stumpy@stumpy-desktop:~/folding$ chmod +x fah6
stumpy@stumpy-desktop:~/folding$ ./fah6 -configonly -smp
bash: ./fah6: cannot execute binary file
stumpy@stumpy-desktop:~/folding$ ./fah6 -smp -verbosity 9
bash: ./fah6: cannot execute binary file
stumpy@stumpy-desktop:~/folding$ ./fah6 -verbosity 9
bash: ./fah6: cannot execute binary file

I also at one point installed the GUI version.. It didn't work either:
Failed to execute child process "/usr/bin/FAHControl" (No such file or directory)
 
Last edited:

biodoc

Diamond Member
Dec 29, 2005
6,262
2,238
136
Are you running the 64bit version of Ubuntu?

If he is running 64-bit Ubuntu, then it's possible there may be some 32-bit code in the binary. Did you have to install the 32-bit libraries to get this running?

sudo apt-get install ia32-libs

very nice tutorial Uppsala!! :)
 

Uppsala9496

Diamond Member
Nov 2, 2001
5,272
19
81
biodoc, thanks for pointing out the ia32-libs. I had a feeling I was forgetting something. I went ahead and updated the guide.
 

theAnimal

Diamond Member
Mar 18, 2003
3,828
23
76
Nice guide! :)

I download the SMP client from Stanford with Firefox and use File Manager to extract and to create directory and copy files. And then the command line takes over from the chmod.
 

Uppsala9496

Diamond Member
Nov 2, 2001
5,272
19
81
Hmmm. It tried it on 2 separate machines and it went through.
I would try all of the steps again.
 

Uppsala9496

Diamond Member
Nov 2, 2001
5,272
19
81
I tried.. and failed... I hate Linux:



I also at one point installed the GUI version.. It didn't work either:

I just used this guide to install on a fresh linux install and ran into the same issues you did. No idea why, but if you go to the standford site linked here you can follow the exact same steps to get the smp client running.


sudo apt-get install curl


When prompted for your password, type it in and press enter.

To download the FAH client for 64 bit versions of linux, a requirement for SMP, type in (or copy/paste) the following commands. Enter one line at a time, in to the terminal command line, and press enter:

mkdir -p ~/folding
cd ~/folding
curl -O http://www.stanford.edu/group/pandegroup/folding/release/FAH6.34-Linux64.tgz
tar xzf FAH6.34-Linux64.tgz

After the FAH client is downloaded, the client needs to be configured. Please run these 2 commands:

chmod +x fah6
./fah6 -configonly -smp

After the client is configured, there are different methods for starting the FAH client. The most basic method is to enter in following command:

./fah6 -smp -verbosity 9

OPTIONAL: To make starting FAH a little easier, make a script by running the following commands:

echo "./fah6 -smp -verbosity 9 $* &" > fah
chmod +x fah

Now simply enter this command to run FAH...

./fah
 

blckgrffn

Diamond Member
May 1, 2003
9,123
3,064
136
www.teamjuchems.com
I just used this guide to install on a fresh linux install and ran into the same issues you did. No idea why, but if you go to the standford site linked here you can follow the exact same steps to get the smp client running.


sudo apt-get install curl


When prompted for your password, type it in and press enter.

To download the FAH client for 64 bit versions of linux, a requirement for SMP, type in (or copy/paste) the following commands. Enter one line at a time, in to the terminal command line, and press enter:

mkdir -p ~/folding
cd ~/folding
curl -O http://www.stanford.edu/group/pandegroup/folding/release/FAH6.34-Linux64.tgz
tar xzf FAH6.34-Linux64.tgz

After the FAH client is downloaded, the client needs to be configured. Please run these 2 commands:

chmod +x fah6
./fah6 -configonly -smp

After the client is configured, there are different methods for starting the FAH client. The most basic method is to enter in following command:

./fah6 -smp -verbosity 9

OPTIONAL: To make starting FAH a little easier, make a script by running the following commands:

echo "./fah6 -smp -verbosity 9 $* &" > fah
chmod +x fah

Now simply enter this command to run FAH...

./fah

I've done that a ... few ... times in the last couple days without fail.

Also, able to follow the directions for fahmon that I linked to a couple posts up without issues as well as long as I just copied and pasted the commands in :)

I've reference this post several times, thank you again for taking the time to put it together.