[gmx-users] How to call an external LAPACK function in gromacs

Mark Abraham mark.j.abraham at gmail.com
Tue Apr 14 19:34:29 CEST 2015


Hi,

On Tue, Apr 14, 2015 at 4:15 PM, qian wang <qq.wang630 at gmail.com> wrote:

> Hi,
>
> Here is the information. Thank you.
>
> cmake .. -DGMX_EXTERNAL_BLAS=on -DGMX_EXTERNAL_LAPACK=on
> -DCMAKE_PREFIX_PATH=/usr/lib64:
> ....
>  Looking for sgemm_
> -- Looking for sgemm_ - found
> -- A library with BLAS API found.
> -- Looking for cheev_
> -- Looking for cheev_ - found
> -- A library with LAPACK API found.
> -- Checking for dlopen
> -- Performing Test HAVE_DLOPEN
> -- Performing Test HAVE_DLOPEN - Success
> -- Checking for dlopen - found
> -- Found the ability to use plug-ins when building shared libaries, so will
> compile to use plug-ins (e.g. to read VMD-supported file formats)
> .....
> Configuring done
>

OK, it did find your LAPACK.


> make
> .....
> Linking CXX executable ../../bin/template
> /usr/bin/c++    -march=core-avx2   -std=c++0x -Wextra
> -Wno-missing-field-initializers -Wpointer-arith -Wall
> -Wno-unused-function   -fomit-frame-pointer -funroll-all-loops
> -fexcess-precision=fast  -Wno-array-bounds  -O3 -DNDEBUG
> CMakeFiles/template.dir/template.cpp.o  -o ../../bin/template -rdynamic
> ../../lib/libgromacs.so.0.0.0 -fopenmp -ldl -lrt -lm -lfftw3f -lblas
> -llapack -lblas -llapack -lpthread
> -Wl,-rpath,/home/qw9/Downloads/gromacs-5.0/build/lib
> ../../lib/libgromacs.so.0.0.0: undefined reference to `dpotrf'
> collect2: error: ld returned 1 exit status
> make[2]: *** [bin/template] Error 1
> make[1]: *** [share/template/CMakeFiles/template.dir/all] Error 2
> make: *** [all] Error 2
>

That works for me (i.e. the linker line has system BLAS and LAPACK
libraries). Please try the latest 5.0.4 release, we might well have fixed a
bug in the template compilation stuff.

In any case, in 5.0.x the intended use case for the template is to install
GROMACS, and then copy the installed template machinery somewhere so you
can use it. Even then, per the README you will find in share/template, you
will might have to teach CMake that it should augment the linking path.

Mark


> Sincerely,
> Qian
>
> On Tue, Apr 14, 2015 at 3:56 AM, Mark Abraham <mark.j.abraham at gmail.com>
> wrote:
>
> > Hi,
> >
> > When you ran cmake originally, what did it report about which LAPACK it
> > found and will use? (You may need to clean your build tree and start
> again
> > in order to find this out.) What is the linker command line now (e.g.
> make
> > VERBOSE=1)
> >
> > Mark
> >
> > On Mon, Apr 13, 2015 at 11:30 PM, qian wang <qq.wang630 at gmail.com>
> wrote:
> >
> > > Dear All,
> > >
> > > I am a new user of gromacs 5.0. For my own purposes I made small
> changes
> > in
> > > a gromacs source code where I called a function named "DPOTRF". This
> is a
> > > standard function in LAPACK library but not in the gromacs internal
> > LAPACK
> > > library.
> > >
> > > Now I have a problem of compiling. What I did is:
> > >
> > > cmake .. -DGMX_EXTERNAL_BLAS=on -DGMX_EXTERNAL_LAPACK=on
> > > -DCMAKE_PREFIX_PATH=/usr/lib64 (this is the path of my extenal LAPACK
> > > library)
> > > this step is ok
> > > but next when I "make", the error I got is:
> > >
> > > Linking CXX executable ../../bin/template
> > > ../../lib/libgromacs.so.0.0.0: undefined reference to `dpotrf'
> > > collect2: error: ld returned 1 exit status
> > > make[2]: *** [bin/template] Error 1
> > > make[1]: *** [share/template/CMakeFiles/template.dir/all] Error 2
> > >
> > > Could anyone help me with this problem? Thanks a lot.
> > >
> > > Sincerely,
> > > Qian
> > > --
> > > Gromacs Users mailing list
> > >
> > > * Please search the archive at
> > > http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before
> > > posting!
> > >
> > > * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
> > >
> > > * For (un)subscribe requests visit
> > > https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or
> > > send a mail to gmx-users-request at gromacs.org.
> > >
> > --
> > Gromacs Users mailing list
> >
> > * Please search the archive at
> > http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before
> > posting!
> >
> > * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
> >
> > * For (un)subscribe requests visit
> > https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or
> > send a mail to gmx-users-request at gromacs.org.
> >
> --
> Gromacs Users mailing list
>
> * Please search the archive at
> http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before
> posting!
>
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or
> send a mail to gmx-users-request at gromacs.org.
>


More information about the gromacs.org_gmx-users mailing list