Folding@Home performance fix for Ubuntu

For a number of years now, my PC has never sat idle. Its every operating moment has been spent running flat out, looking for a possible cure for cancer, Alzheimer’s disease, Parkinson’s disease and many others. This has been done by running the Folding@Home program. It sits in the background, using any spare CPU cycles that aren’t being used by any other programs you are running. It downloads some data from the servers at Stanford University, processes it, running simulations on protein folding, then uploads its results back to Stanford. It is a great cause, made a little more interesting by the awarding of points for every work unit your PC processes. These points introduce an element of competition - trying to out-produce fellow folders and make your way up the leaderboard. There are teams as well, with their own rankings. I am currently folding for the Overclockers Australia team - currently ranked number 2 in the world and trying to hold onto that spot and make a move to regain number 1.

If you feel like joining, you are more than welcome. Just enter Team 24 when you are setting it up!

Aaaanyway, after updating my system earlier in the year, I noticed my points production had dropped off. What had happened, is that the CPU was not running at full speed: it was throttled back to its slower idle speed. A little fishing around the web turned up this forum thread at techreport.com. It turns out that the CPU speedstep function on was on, with the multiplier dropped back to 6, not 7 (in my case with an intel E6300). The operating system’s frequency scaling control was not treating the folding client as an ‘important’ enough process - it was ignoring the ‘nice’ processes by default. To find what speed the system is running at, open a terminal prompt and enter:

cat /proc/cpuinfo

A bunch of info will come up - look for the cpu MHz field and see if it is the speed it should be. The other way is to install the CPU frequency scaling toolbar applet in Gnome - I have done this and can see at a glance if the cores are running at full speed or not.

To let the frequency governor include ‘nice’ processes, a flag has to be set, as the root user:

sudo su
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load
exit

For a dual- or quad-core machine, you may have to do this for all cpus - cpu0, cpu1, cpu2 and so on. An example for the second core:

echo 0 > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/ignore_nice_load

Note that I only had to set it for the first CPU (cpu0) and the other one changed as well.

To make this change permanent, instead of having to re-enter the above commands after each boot, there are two methods, only one of which worked for me. The first method, which did not work, is to add the echo 0 > … line to the /etc/rc.local file, before the line “exit 0″. This did not work for me, as I found out after rebooting.

Instead, I used the second method, found in this thread at the ubuntu forums, involving changing a setting in the Gnome Configuration editor (found under the Applications -> System Tools menu):

Open gconf-editor, go to /apps/gnome-power-manager/cpufreq
and check box consider_nice.
Takes effect immediately.

I believe that the setting in gconf-editor was overriding the setting in rc.local, so it never took effect. After changing that, my system has been happily folding away ever since.

New linux flash player 9 update a dud

Lately I had been having trouble on flash-based websites where things just wouldn’t display properly - sometimes a screen would come up with the flash content, then just go blank. I was a little puzzled, but thought it more of the usual ‘not tested on linux/firefox’ issues from the web developers. But then it just started getting silly, and looked into it a bit. I remembered that a few weeks back, an update was available for the flash plugin (in ubuntu, the package is called flashplugin-nonfree) that upgraded from 9.0 r48 to 9.0 r115.

Turns out that most of the problems stemmed from that. In a thread in the ubuntu forums, it is stated that the current flash release is still pretty buggy. Kilz from the ubuntu forums has created a script that installs the plugin with the nspluginwrapper, for running in 64-bit installations. The thread in question is here. I tried it, first uninstalling the current plugin using the synaptic package manager, then ran the script. I now have the 9.0 r48 version, and it everything is running fine again.

Damn Adobe Flash - the majority of my linux usability problems have centred around getting the damn plugin to work in browsers at all, then to actually work properly. I can’t wait for the Gnash project to have a viable replacement up and running so I can dump Adobe’s product for good.

Desktop OS in 64K - GEOS

Over the last weekend I had a sudden attack of nostalgia for the Commodore 64. I have fond memories of the thing, having one for my first computer. I remembered how there was an operating system available for it that was able to show a graphical desktop, with icons and all, a WYSIWIG word processor, even a spreadsheet, in only 64 kilobytes of memory. It was amazingly tightly coded, and such a difference from today’s software that needs tens of megabytes to show a pissy icon in a system tray, for instance.

This operating system was GEOS, standing for Graphical Environment Operating System. An excellent article about it is here. I felt like having a bit of a tinker with it, relive some old memories. One problem though was I no longer had a C64 to load it on. However, emulators came to the rescue. For linux, I installed VICE, which is in the ubuntu repositories. To make it work though, you have to download the version from viceteam.org, that contains the ROM files that are not included in the ubuntu version. There are two ways of putting the ROM files in.

First, the way I tried, was to unzip the version 1.22 file from viceteam, and copy the ROM files into the installation directories (in ubuntu, it is /usr/lib/vice/). The ROM files are the ones without file extensions that live in the data directory in the zip file. They are named ‘kernal’, ‘basic’, ‘chargen’, and so on, and are in different subdirectories for different commodore models the program emulates. Once it is installed and the ROM files are in the right spots, you can start the C64 emulator by typing ‘x64′ at the command prompt. If all goes well, you will see the C64 screen come up in a window.

The second way, which I did not try, is to follow the instructions here for compiling the latest version of VICE.

Once you have the emulator running, you can download a copy of GEOS. Put the *.D64 files in a directory somewhere, and using VICE, choose the File -> Attach a disk image -> Unit #8 menu. Point it to the GEOS64.D64 file, and it should start loading. You can then marvel at the mid-1980’s computing experience. It is similar to the first Mac desktop, but was available for a fraction of the price.

There are other productive things you can do with the Commodore 64 emulator, too…

Flash 9 player crashing in Linux? Try This

I was experiencing some annoying crashes of Firefox while viewing Youtube videos, or any other streaming flash-based video sites. I could watch video for a while, but if I hit the back button, or chose another video to watch, the browser would just lock up hard. Looking on the Ubuntu Forums came up with a few possible causes and solutions, but none really worked for me. Until I saw this post, where someone suggested that the onboard sound on the motherboard could be at fault. They disabled the onboard sound in BIOS, and the crashing went away. Re-enabling sound in BIOS caused the crashes to come back.

This person used the same sound chip that is in my Abit AB9 motherboard, the Realtek ALC-888. It looks like Adobe is having issues with Realtek chips. I tried disabling onboard sound on my system, and the crashes stopped for me as well. Fortunately I still had another sound card that I plugged into a free PCI slot - an old Aureal Vortex 2 - based card made by Videologic. Ubuntu booted up, detected the card and the thing worked straight away! Bloody impressive, if you ask me. Here was a card that I bought about a week before Aureal was swallowed up by Creative, meaning the last fully working driver set was for Windows 98. The card was only partly usable in Windows 2000 and XP, and yet Linux has given the thing a new life. I’m happy.

The only downside to this fix is that you will have to shell out for an external sound card if you don’t have one lying around. Maybe in the future Adobe will come out with a fix that lets the Realtek audio work, but until then this is the best fix, or rather, workaround, available.

An update on using Ubuntu

When I built my current PC late last year, I made a decision to not spend another couple of hundred dollars on buying Windows XP for it. Instead, I made the machine run on Ubuntu linux. How is it going? Just fine. In the post from December 26 linked above, I listed the things I can do on this box that I could also do on windows, like use Rhythmbox for mp3 playback and podcast subscriptions, and getting things on and off my PDA. All of that still works, but I still haven’t really looked at getting Avantgo to update.

Another thing I missed from windows was having a monitor program for Folding@Home, a distributed computing project looking to find how proteins don’t form, or fold, correctly, and the causes of various diseases related to it. On windows I used Electron Microscope III, which had a nice graphical display of how far along each frame was from completion, and the number of points per day were being produced.

Prior to finding another program, I had to check the log files produced by each client (I’m running two, since it’s a dual core machine). Now, the program FahMon has come to my aid, showing the progress of each unit, estimated time to completion and a handy benchmarking tool, showing how many points per day are produced for each unit.

I am really quite enjoying using Ubuntu on this machine - although I have used linux for a few years now, the distro I used (and still have, as a dual-boot option) on the old PC was gentoo. I found I was devoting a large portion of my time to administrating and maintaining the OS itself - visiting the forums, looking for fixes to things that may have broken during an update, or just general tweaking. And since it is source-based, new or updated software involved compiling. I shudder to think about having a look at what needs updating now on the machine - it would probably be a week solid of compilation time required.

On this new PC, however, I hardly have to do anything. New software is installed from a binary format, so no compilation is needed. Updates have (so far) just worked, without breaking things. I can get on with just using the machine. Sure, it is probably a few percent slower than if I ran gentoo, but it is really not noticeable.

I enjoy not having any viruses to worry about, nor spyware. I have a software firewall set up, and am also behind a hardware firewall/router, so the machine is fairly secure.

Do I think I will end up installing Vista? Not for quite a while, I’d say. It depends on if something were developed, some killer app, that ran on windows and windows only. More likely it will be some Digital Rights Management, copy protection scheme that will render the box unusable for half the internet or something. Even then, I would definitely retain the linux install and dual-boot the machine. Buying Windows Vista would be something that is at least a year or two off for me. That’s my prediction at the moment, anyway. Besides, I’d need another Gig of memory, just to do the same things I’m doing now with one in linux.