Noob: Lapack API - using methods

Open discussion regarding features, bugs, issues, vendors, etc.

Postby Julie » Mon Aug 28, 2006 6:37 pm


1- yes that's kind of it, if you really want to work in row-major format, you declare and initialize your matrix in row format, then convert it to column major and let LAPACK do its business. Input/output format for LAPACK routines is the same (column-major), so you can plug several routines on the top of each other, once you are done with LAPACK you come back to your row major format if you wish.
After some practice, I think most of the people does everything in column major from beginning to end and avoid row major.

2- ESSL is an implementation of LAPACK. Their interface and ours is not 100% compatible. LAPACK does not support the LWORK=0 trick, ESSL does. If you are working with LAPACK, calling DGEQRF with LWORK=0 returns you an error. This is not allowed.

3- Well once more, you really need to take the habit to open the LAPACK routines to have a look at the interface and the header comments. For example have a look at:
I hope that now what I meant by A and C is clearer.

Come back if you have more questions.

Posts: 299
Joined: Wed Feb 23, 2005 12:32 am
Location: ICL, Denver. Colorado

Postby Julie » Tue Aug 29, 2006 9:47 am

Just a follow up on the topic how to get the Q-factor from xGEQRF. Sven has just reminded me on the mailing list that the easiest way to do this is to use DORGQR
DORMQR applied on the identity does the work as well but DORGQR is clearly simpler to use in this case.
Posts: 299
Joined: Wed Feb 23, 2005 12:32 am
Location: ICL, Denver. Colorado

DORGQR works

Postby wxiong » Tue Aug 29, 2006 12:46 pm

hi, julie:

You are right, DORGQR is much easier to get Q. thanks.

Do you know how to set up an optimal workspace? Usually I set LWORK is max(1,N), and WORK is LWORK*LWORK dimension array. I do not think the performance is optimized. I read this from documents “For optimum performance LWORK >= N*NB, where NB is the optimal block size”. What does optimal block size mean? My array is big, 3343 by 3343.

Posts: 3
Joined: Mon Aug 28, 2006 3:04 pm

Postby Julie » Sun Sep 10, 2006 9:17 pm

All wrong! :D You allocate too much workspace and moreover you do not use it. Not a big deal, here are the tips to get you on track.

1. your workspace is as big as your matrix, this is never necessary
2. when saying LWORK = MAX(1,N), basically you say to LAPACK to use only the N first element of your workspace, this means that the code is unblocked and that LAPACK leaves (N-1)*N entries of the workspace unused.

So what you should do, is call DORGQR a first time with all the arguments as if you would do your regular call but LWORK=-1 and WORK should be at least of size 1. This does nothing else than computing the optimal workspace size (optimal in term of speed). In output the optimal workspace size is returned in WORK(1), the first entry of WORK.

Then you set LWORK to WORK(1), free WORK, reallocate it of size LWORK and here you go. You can call again DORGQR. This time the computation are done and this will run hopefully way faster.

The input argument LWORK specifies the number of entry in WORK LAPACK is allowed to use.

Posts: 299
Joined: Wed Feb 23, 2005 12:32 am
Location: ICL, Denver. Colorado

Postby Ingesson » Thu Sep 21, 2006 7:22 am

ok, thanks ;)

i have tried it...

best regards

Posts: 1
Joined: Thu Sep 21, 2006 7:11 am


Return to User Discussion

Who is online

Users browsing this forum: Bing [Bot] and 9 guests