Monday 25 June 2012

compiling cp2k in parallel with compiled fftw3 blacs scalapack lapack and blas!

Welcome to heartbeat. COZ we got life.
I recently managed to get cp2k compiled with my own blas and lapack, and here is how i did it.
First i got myself a copy of BLAS, from netlib

So we decompress the file and get it complied: So i changed the make.inc to reflect my preference for compilers (ifort is available on the cluster i was on) and on the terminal: you should get a file named blas_Linux.a in the build directory Now we can compile fftw3: You should have under the directory 'myname' the header files and the libraries When that is done lets get the next library compiled: LAPACK Now you need to edit make.inc to point to the blas library you just compiled or edit make.inc to point to it Here are some of the values that i changed so now type and when its done got to the TESTING directory and find out if any of the *out files show obvious failures. In the build directory you should now have a file named: Now we need to get MPIBLACS compiled: Now we need to find out the options that are to be set in the Bmake.inc, so you need to know the path to the BLACS source directory that your in. xsyserrors compilation needs the mpilib directory and the libmpi.so file, so make sure you know where it is on your computer. Next we run the programs to get the information we need: Take note of the outputs and adjust in the commands later to what YOU ACTUALLY GET. And we can do some sanity checks, before moving to the next step With this information we go back to the main build directory, and on the same line run: Then: Remember to set the TRANSCOMM option above to -DUseMpi2
Now change directory to TESTING, and on the same line do: Now feel free to run the tests and see what you get. In the main build directory you should have a LIB folder with the libs you just created.
For scalapack: you need to know the path to all the libs you just created above, so lets get the source, I edited the SLmake.inc to reflect my preferences: These are the only things i changed. Then: and there you go, you have the libs you need for cp2k. So now for cp2k I edited one of the make instruction files under the arch directory to suit my needs and i called it myname_mine.popt with the following content: and now cd to the makefiles directory and make: Cool, now all things held constant you should get an executable in the home directory, test it! And i'l go have some tea.

Friday 22 June 2012

Compiling cp2k in parallel

Welcome to heartbeat, coz we got life.
Compiling cp2k in parallel can be a real pain, especially with the almost site specific location of libraries on different computers/clusters or distros. So i attempted to compile cp2k on a stock distribution of CentOS 6.2. Some of the more strenuous parts of this exercise are locating the right libraries for your system. In case you do not know what you need here is a minimal list:
Blacs
Scalapack
Lapack
fftw3
So install these easy ones with the yum command

For centos the rest of the stuff is not in the default repos, but rpms for the packages exist out in the wild, so i head over to Pbone and search for the rpms using their search functionality. The end result is that you should have the following downloaded somewhere on your computer:
blacs-common-1.1-39.el6.1.x86_64.rpm
blacs-openmpi-1.1-39.el6.1.x86_64.rpm
blacs-openmpi-devel-1.1-39.el6.1.x86_64.rpm
blacs-openmpi-static-1.1-39.el6.1.x86_64.rpm
scalapack-common-1.7.5-10.el6.x86_64.rpm
scalapack-openmpi-1.7.5-10.el6.x86_64.rpm
scalapack-openmpi-devel-1.7.5-10.el6.x86_64.rpm
scalapack-openmpi-static-1.7.5-10.el6.x86_64.rpm
Next install the rpm packages using the command, and presto your good to go, though a caveat is that the order in which you install matters since the static libs require the devel libs which require the usual rpms that requires the common rpm. To solve this follow the order in which i have listed them ( commons first then the static last) you can start with scalapack if you find blacs depends on it :) . Now to the cp2k source!
If you haven't got the source, get it. Under the arch directory create a new text file named cp2k_x86-64_gfortran.popt, and make the contents look like this: and change directory to makefile and run make like this: Let it run to completion, when its done try a test with the new executable placed in Like this: Or your preferred method of running in parallel.
if it doesn't segfault, well breath a sigh of relief, and watch it run.
Here are the final few lines of my run: Well, thats all folks.

Thursday 21 June 2012

cp2k, atomistic modelling.

Welcome to heartbeat! Coz we got life.
Cp2k: Atomistic and molecular simulations:
I happened to have met cp2k a few weeks ago at a short summer school, and like most research software, it can be an uphill task to install it, and to make matters worse, this one has a reputation for being hard to install.
So this is my little attempt to remember how got the serial compilation done on my fedora 16 desktop, using the latest gfortran + scalapack + openmpi + blas + lapack+ blas + blacs available on fedora 16 repos in mid june 2012.
First things first we start with updating the system:
and then we get some stuff that might not be present:
finally the scientific-sounding application libraries install;
But as always what you need may vary from distro to distro:
Once all that is done, we now get the cp2k code via svn
once that is done, navigate to the cp2k base directory and find the arch subdirectory:
arch COPYRIGHT cuda_tools doc exe INSTALL lib machine makefiles obj README src tests tools web
So far so good, now we need to ensure that we have a file under the arch directory that looks like this:
This is basically what came with the code going by the name Linux-x86-64-gfortran.sopt , so we now compile, and cross our fingers:

and presto after a little while, were done and an executable residing under the exe directory is created So what are you waiting for? Run it!
Here is a little of the final lines of my output:
if it runs, then your doing pretty well. Congratulate yourself and get a cup of tea. cheers!