how do I run a minimal Gnome session for intensive calc ?
September 2, 2008 6:19 AM   Subscribe

[Linux/Ubuntu] I need to run some pretty intensive calculations. How can I load a very minimal Gnome session for that purpose ?

The idea is to create a new user, whose session would load only the minimum necessary.
My script runs in Python with various libraries, but it won't run without an X session because it uses Pylab. It is very CPU intensive and uses lots of RAM too because the dataset is huge.

I know how to add a user to my Ubuntu installation. Once I've done that, what do I do to disable loading of most of the usual services for this user's session, but not for the main user ?
or should I try to use a lighter desktop environment for that ?

I welcome any piece of advice on that ! thanks.
posted by nalf to Computers & Internet (10 answers total)
 
GNOME is an entire desktop environment. You can slim it down a little, but for better performance, I would recommend either a smaller desktop environment like Xfce or just a minimal window manager without a desktop like FVWM.
posted by tomwheeler at 6:45 AM on September 2, 2008


It's going to be difficult eliminating all the things Gnome drags in, going with a lightweight desktop manager is going to be easier, as well as producing better results. I use Fluxbox for all my desktop installs (for aesthetic and efficiency/productivity reasons as well as its relatively light system load). Its easy enough to set that up as a default for just one user.
posted by tallus at 6:47 AM on September 2, 2008


You can launch an X session without loading a window manager at all. (Or maybe it is technically a window manager, but you just get the really crappy lightweight default X grey thing).

Just move your ~/.xsession and make a new file of the same name with the command(s) you need to run in it. All commands except the last should end with &, and when the last command exits the X session goes away too.
posted by moift at 6:54 AM on September 2, 2008


you can just run a virtual frame buffer. X does it's display in a memory buffer without actual screen output. this combines moift's suggestion with the added benefit of no hardware latency/graphics actually required.

http://en.wikipedia.org/wiki/Xvfb

http://packages.ubuntu.com/dapper/x11/xvfb

so you'd want to do something like this. boot into runlevel 3, which prevents X from launching (runlevel 5)

Xvfb :1 & # launches your virtual X frame buffer
./yourscript.sh & # and whatever arguments you need
vi ./youroutput.txt # read what the script ouputs


that should be good as you can get. you could also renice your script so it grabs all the system resources it can get.
posted by jrishel at 7:04 AM on September 2, 2008


In stock ubuntu, you can load no window manager at all by selecting failsafe. Don't do this, instead consider installing (apt-get install, aptitude install, synaptic, whatever) a very light window manager such as xfwm4 or even fvwm2 (still my WM of choice. w0rd). You can then select that as your session on the login screen.

Also, if you need to see the output, so Xvfb above is not enough (from your desciprtion tho, it should be), try vnc4server (again, your favourite apt-get method).

(You'll need universe enabled for this. you can do that in synaptic, or google for how to edit your sources.list)
posted by jaymzjulian at 7:37 AM on September 2, 2008


Looking at matplotlib's requirements, it doesn't look like it requires an X session, just that it requires a bunch of X libraries. So you should be able to run this from a console.

You might still have a bunch of cruft running from any servers you've installed in the past, though. To be sure of a minimal installation, you may want to repartition your drive and reinstall an instance of Ubuntu from the alternate install CD -- a command-line-only system -- and then install onto that only what you need to run your app. Boot into that instance, and you'll be running about as lightweight a system as could be hoped without going to a lot of effort.

It's generally easier to start with a stripped-down system and build up than to start with a big desktop environment and try to strip down.
posted by Zed_Lopez at 8:07 AM on September 2, 2008


Also check out psyco, which can massively speed up python execution.
posted by Zed_Lopez at 8:09 AM on September 2, 2008


Response by poster: Thanks for the input, I will try some of your solutions and see what works best for me.

Looking at matplotlib's requirements, it doesn't look like it requires an X session, just that it requires a bunch of X libraries. So you should be able to run this from a console.
I don't know, I tried without an X session and it couldn't load the libraries...

Also check out psyco, which can massively speed up python execution.
I think my code is as optimised as it can get, any cpu intensive stuff is compiled in C with cython.
posted by nalf at 8:27 AM on September 2, 2008


Simplest X-Session:
put "exec xterm" into ~/.xinitrc and make in executable (chmod 755 .xinitrc).

It starts an X-Server and now window manager, just an xterm where you can start your application.
posted by donut at 10:15 AM on September 2, 2008


So, which method did you use? I think we gave you about 3 different ways to skin this cat :)
posted by jrishel at 11:52 AM on September 11, 2008


« Older Recommend me a room for talks and drinks in London...   |   Hair straightening in Chicago Newer »
This thread is closed to new comments.