Last week I was helping to sort abstracts for the 2007 March Meeting. It's a more or less a tradition, meaning that I can't get out of it until I convince someone else to take over. While I was there, I got into a conversation about electronic structure codes. These are computer programs which more or less accurately solve the Schrödinger equation for the electrons moving in atoms, molecules, and solids. This allows physicists to determine atomic configurations in molecules and solids and to calculate how they would react to external forces. I've used variety of programs in my time, mostly based on the Linearized Augmented Plane Wave (LAPW) method. However, there is another method quite popular with physicists because it is usually faster, but somewhat less accurate, than LAPW, the pseudopotential method. Pseudopotentials are sort of fake atoms, with their shapes fixed up to speed computations.
Some of my colleagues were touting a package of pseudopotential codes called Quantum Espresso (QE). It's released under the GPL, which means you can run it at work, at home, in the car, in the air, etc., without worrying about licensing.
I downloaded the QE code to good old Hal, here. It compiles nicely using version 9.1 of the Intel Fortran compiler for Linux, which is free for non-commercial use. I've discussed how to install the compiler on Ubuntu before. The QE code compiles beautifully and runs quite well.
But it can run faster. Many of the mathematical operations done by QE run more quickly if the code is optimized for the CPU. For Intel chips, this can be done by installing the Intel Math Kernel Library (MKL), which is also free for non-commercial use. But the installation script for MKL/Linux creates and installs an RPM package. You can install RPMs on a Debian system such as Ubuntu, but it's not recommended, since you can't keep it in sync with the Debian package database.
So how to install it? This has bothered others as well. Putting together notes from this forum I was able to figure out the procedure. Now I did this last night and I might have forgotten a step or to, so if I leave something out please correct me:
- Download the package from the Intel site and register to get a key.
Uncompress the package:
tar xvf l_mkl_p_8.1.014.tgz
In the subdirectories thus created, find the install script. Change to that directory and run
This will eventually fail, but in the directory /tmp/mkl you'll find a file named intel-mkl-8.1p-14.i386.rpm. If you had a RedHat based distribution it would be installed, but we need to convert it to a Debian package using alien:
sudo alien --to-deb --scripts intel-mkl-8.1p-14.i386.rpm
This creates a Debian package named intel-mkl_8.1p-15_all.deb that we can install in the standard way:
dpkg -i intel-mkl_8.1p-15_all.deb
Quantum Espresso automatically finds the package and uses the libraries. For other Fortran programs, say to compile a file named progname.f, you need to do something such as
ifort -o progname progname.f -L/opt/intel/mkl/8.1/lib/32 -lmkl_lapack -lmkl_ia32 -lguide -lpthread
Programs written in "C" will link in a similar fashion.
I haven't done timings on the difference between QE and QE+MKL, but it seems significantly faster. Now I just have to figure out how to use the code in the way I want to use it.