← Back to team overview

dolfin team mailing list archive

Re: LAPACK link problem

 

On Wed, Dec 16, 2009 at 01:12:14PM +0100, Johannes Ring wrote:
> On Wed, Dec 16, 2009 at 1:00 PM, Anders Logg <logg@xxxxxxxxx> wrote:
> > On Wed, Dec 16, 2009 at 12:51:37PM +0100, Johannes Ring wrote:
> >> On Wed, Dec 16, 2009 at 12:36 PM, Anders Logg <logg@xxxxxxxxx> wrote:
> >> > On Wed, Dec 16, 2009 at 12:01:01PM +0100, Johannes Ring wrote:
> >> >> On Wed, Dec 16, 2009 at 11:50 AM, Johannes Ring <johannr@xxxxxxxxx> wrote:
> >> >> > On Wed, Dec 16, 2009 at 10:47 AM, Anders Logg <logg@xxxxxxxxx> wrote:
> >> >> >> Is anyone else able to compile and link the test in
> >> >> >>
> >> >> >>  sandbox/misc/
> >> >> >>
> >> >> >> ?
> >> >> >
> >> >> > It compiles fine on my system. I can also run the demo but when I
> >> >> > press 'q' to exit the plot I get a segmentation fault.
> >> >>
> >> >> Also:
> >> >>
> >> >> johannr@simula-x61:~$ nm -D /usr/lib/liblapack.so | grep dgels_
> >> >> 00191a70 T dgels_
> >> >> johannr@simula-x61:~$ dpkg -S /usr/lib/liblapack.so
> >> >> liblapack-dev: /usr/lib/liblapack.so
> >> >> johannr@simula-x61:~$
> >> >
> >> > ok, good. I thought that DGLES was missing from the standard Ubuntu
> >> > LAPACK.
> >> >
> >> > Do we have a test for LAPACK or should we add one? The buildbot is
> >> > failing.
> >>
> >> No, we don't have a test for LAPACK but several of the other
> >> pkg-config generators adds -llapack to their pkg-config files. Maybe
> >> we should add pkg-config generator for LAPACK and then add 'Requires:
> >> lapack' in the other pkg-config files instead.
> >
> > Thats sounds like a good idea.
> >
> > Should I create a simple test program for LAPACK or what do you need
> > to create the test?
>
> Yes, a minimal test program would be good. Also, do you know how to
> find the LAPACK version?
>
> Johannes

Here's a simple test program:

  extern "C"
  {
    void dgels_(char* trans, int* m, int* n, int* nrhs,
                double* a, int* lda, double* b, int* ldb,
                double* work, int* lwork, int* info);
  }

  int main()
  {
    double A[4] = {1, 0, 0, 1};
    double b[2] = {1, 1};

    char trans = 'N';
    int m = 2;
    int n = 2;
    int nrhs = 1;
    int lda = 2;
    int ldb = 2;
    int lwork = 4;
    int status = 0;
    double* work = new double[m*lwork];

    dgels_(&trans, &m, &n, &nrhs,
           A, &lda, b, &ldb,
           work, &lwork, &status);

    delete [] work;

    return status;
  }

On my machine, this compiles with

  g++ main.cpp -L/usr/lib/atlas -llapack

I have no idea how to find the LAPACK version but as far as I know,
most of the interface of LAPACK has been fixed the last 30 years or so
so I assume we don't need to worry too much about that.

--
Anders

Attachment: signature.asc
Description: Digital signature


Follow ups

References