[Rd] "LAPACK routine DGESDD gave error code -12" with Debian (PR#2822)

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Thu Apr 24 14:28:21 MEST 2003


Camm Maguire <camm at enhanced.com> writes:

> 2) Given the error code, and the scaling behavior with matrix size,
>    I'd say the lwork parameter (size of the work array) passed to
>    dgesdd is not always large enough, i.e. is not scaling properly
>    with n,m.  Please see 'man dgesdd' for interpretations of the error
>    code.  It is the responsibility of the calling routine to allocate
>    and pass the work array to dgesdd.  With most lapack routines, one
>    can make a 'workspace query' call first by setting lwork to -1, or
>    some such.  check the man page for details.  This of course would
>    have to be done with each change in n,m.  Alternatively, you could
>    take the minimum workspace requirements from the manpage.  

Right, but that's actually what we do, use the workspace query. It's
all very weird, because the -12 value indicates that the lwork
parameter is wrong, but it is computed from an exactly identical call,
except lwork=-l:

        lwork = -1;

        F77_CALL(dgesdd)(CHAR(STRING_ELT(jobu, 0)),
                         &n, &p, xvals, &n, REAL(s),
                         REAL(u), &ldu,
                         REAL(v), &ldvt,
                         &tmp, &lwork, iwork, &info);
        lwork = (int) tmp;

        work = (double *) R_alloc(lwork, sizeof(double));
        F77_CALL(dgesdd)(CHAR(STRING_ELT(jobu, 0)),
                         &n, &p, xvals, &n, REAL(s),
                         REAL(u), &ldu,
                         REAL(v), &ldvt,
                         work, &lwork, iwork, &info);


Also, this must be happening in the early parts of DGESDD which seem
to be all integer storage size calculations and so shouldn't need the
BLAS. Nevertheless people are seeing different behaviour when linking
against different BLAS libraries.
 
There are a lot of calls similar to this one, though:

      WRKBL = M + M*ILAENV( 1, 'DGELQF', ' ', M, N, -1, -1 )

so whether or not the BLAS is being used is hard to tell precisely.

>    lapack is the relevant lib, so I don't know what --without-blas is
>    supposed to do.  And working under windows, while nice, doesn't
>    exactly inspire confidence :-).

--without-blas means to use generic blas routines in the R
sources rather than any (tuned) system set.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907



More information about the R-devel mailing list