[gmx-developers] Question about Gromacs BLAS / LAPACK.

Lee-Ping Wang leeping at stanford.edu
Sat Nov 10 17:59:59 CET 2012

Hi there,


I have some questions about BLAS and LAPACK in Gromacs, and how to best call
these functions from inside my code.  


On my local machine, I migrated my fluctuating charge code from Gromacs
4.0.7 to 4.5.5.  It took a bit of time, but I think the implementation is
now a lot cleaner.  At some point, I would like to create a branch on the
Gromacs repository, but first I need to solve a few issues with BLAS and
LAPACK.  Basically, when I was originally writing the code I used the Intel
headers and libraries, but now I want to convert this to something more


At the top of my code, I have the following two includes:


#include <mkl_cblas.h>

#include <mkl_lapack.h>


When I build the executables, I need to source the Intel compiler variables
and make sure to link with the following line:


LDFLAGS="-lrt -L$INTEL_PATH/lib/intel64 -L$MKLROOT/lib/em64t
-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm"


I understand this needs to be changed.  I would prefer to use the BLAS and
LAPACK provided by Gromacs, but I don't know how to do this most
effectively, and whether this will result in a performance hit.


In my code I call the BLAS and LAPACK functions like this (there are perhaps
100 such calls):





However, when Gromacs calls its own BLAS and LAPACK functions it looks quite












The only example I could find for this function call is in
"tools/eigensolver.c" .  I'm worried that conversion will be difficult, plus
I would like to retain the option to use the Intel libraries.  


My questions are:


1)      How can I most effectively convert my BLAS / LAPACK calls in qtpie.c
so that it uses the Gromacs provided libraries? (link
<https://dl.dropbox.com/u/5381783/qtpie.c> )

2)      How should I write my code so that a user can compile and link using
Intel headers / libraries if they want to?  I imagine it's related to the
--use-external-blas and --use-external-lapack command line options to the
configure script, but I don't know how to use this.


Your response is greatly appreciated.




- Lee-Ping


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20121110/cf7285d7/attachment.html>

More information about the gromacs.org_gmx-developers mailing list