Backing up a little - Trying to get LAPACK to work... [SOLVED]

Kevin D. Clark kevin_d_clark at comcast.net
Thu May 27 09:24:03 EDT 2010


Bruce Labitt writes:

> The good news is that I have zgesvd_ from the LAPACK library working.  
> The bad news is I've wasted a lot of time (the list's and mine) finding 
> the error.  Root cause: did not allocate enough memory for the RWORK 
> array.  For some reason, a small problem worked, whereas the larger one 
> would not.  In hind sight, this all makes sense.

I was looking at this last night, in fact.  I was sort-of stumbling
around in this area of the code as well.  Your comment here:

  int lwork = 2*max(1, 2*mn+MN );     // this is the wrong size...

...kindof drew my attention but because the use of the array is split
across two files it sort-of threw me for a loop.

This is the source of your stack-smashing.  This is why the debugger
tools you were using gave you such strange errors.

Had you allocated this array on the heap, Valgrind would have told you
about the problem right away.


I have couple of suggestions:

1:  You have two variables in your code:

        char JOBU, JOBVT;
        JOBU = 'A';     JOBVT = 'A';

    It isn't entirely clear to me that these are right.  You
    might want to consider transmorgifying these to this:

        char JOBU[] = "A", JOBVT[] = "A";

    ...and then making other corresponding changes to the code.

    I say that this is "unclear" to me because it is unclear to
    me what the underlying Fortran code is doing with these things.
    All I know is that your code does not produce nul-terminated
    C strings, which might lead to some weirdness.

2:  your build process turns on the optimizer and also
    includes debugging symbols.  The thing that you need to 
    understand is that while you are debugging this stuff, you
    probably don't want the optimizer turned on, because it makes
    debugging a lot more tricky.

--kevin
-- 
alumni.unh.edu!kdc / http://kdc-blog.blogspot.com/
GnuPG: D87F DAD6 0291 289C EB1E 781C 9BF8 A7D8 B280 F24E

 Wipe him down with gasoline 'til his arms are hard and mean
 From now on boys this iron boat's your home
 So heave away, boys.
   -- Tom Waits


More information about the gnhlug-discuss mailing list