Software Adventures: Building ABINIT

After much frustration, consternation, and other words that I either can’t think of or can’t say, I have built ABINIT on the cluster. It has taken much more work then it should have as I encountered one of my greatest gripes about software built by scientists and not software developers. There was little to no documentation on the dependencies.

So only after much trial and error, and much more error and trails and tribulations, I was able to figure out what was needed to get as much of the dependencies built. ABINIT doesn’t require them, but they do help as these dependencies are usually much faster then whats included.

1)The system version of the GNU GCC compilers on CentOS 5 are too old to compile ABINIT. You’ll get an error in regards to the GSL library:

error: bad value (native) for -march= switch

Only after searching did I find this nugget of helpfulness in their forums. So time to build the compilers, which also has its own dependencies(GMP, MPFR, MPC). Build and install these somewhere outside of the system compilers, you’ve been warned. I created a source file to hold the PATH and LD_LIBRARY_PATH needed for the new gcc that I could source as needed.

Next is OpenMPI. It needs to be recompiled as its wrappers, mpicc, mpif90, etc need to be updated. Again install someplace outside of the system version, then add to the source file.

Next is NetCDF/HDF5 for parallel I/O. Compile and test HDF5 first, then do the same for NetCDF. Testing is important since if you run into any problems, that is the first question asked. I followed the instructions here to build NetCDF/HDF5 to include parallel support. Oh and one more thing, very important, I had to use version 4.1.1(along with HDF5-1.8.5) to get a working built that passed all tests. There is a problem in later versions of NetCDF where it mangles the library path.

I had already built BLAS/LAPACK/BLACS/ScaLAPACK, but I rebuilt using the new gcc just in case. Though linking to these libraries is kinda weird, I had to experiment to figure out the right order, otherwise the configure script would fail with all sorts of undefined variables.

with_linalg_libs=”-L/share/apps/netlib/lib -lscalapack -L/share/apps/netlib -llapack -lblas -L/share/apps/netlib/lib -lblacs -lblacsC -lblacs -lblacsF77”

Weird right? Don’t ask me, library linking is a dark art.

Built libXc, nothing much to report there. I tried to build etsf-io, but it keeps rejecting the NetCDF libraries in the config test. More library linking problems I couldn’t figure out. Even though I used the output of nc-config —libs, it would act as if NetCDF couldn’t locate the HDF5 libraries. So I passed on that.

I then built BigDFT, though the latest version doesn’t work. Use version, I found this out as ABINIT has a gentoo package and lists that version as a dependency. I also built FoX, a XML library for Fortran. I had to point it to the right compiler as it looks for f95 and not gfortran by default. Also it’s library linking also needed some testing to get the order correct.

with_fox_libs=”-L/share/apps/FoX/4.1.0-gcc-4.6.1/lib -lFoX_wxml -lFoX_wcml -lFoX_wkml -lFoX_sax -lFoX_utils -lFoX_common -lFoX_fsys”

Now I would call this a bug. I already had GSL prebuilt and added it to the configure script, yet when you run make, it will complain about not being able to find a header file. So I edit the Makefile in src/01_gsl_ext/ and added the include directory to DEFAULT_INCLUDES. This gets past that problem and I’m able to successfully make ABINIT.

One last interesting tidbit, checking the output of the configure script, it checks to see if NetCDF supports MPI I/O, but the test fails. Not sure why, I posted it as a question on their forums. If I get a response that fixes is, I’ll update this post.  Otherwise as of right now ABINIT is running through its tests. Finally done after four long days.

My config file for ABINIT can be found on PasteBin.