Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library
- Questions about sgels example

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

H__Bin

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-24-2019
11:10 AM

78 Views

Questions about sgels example

I have two questions about sgels example:

(1) why need to call sgels twice?

/* Query and allocate the optimal workspace */

lwork = -1;

sgels( "No transpose", &m, &n, &nrhs, a, &lda, b, &ldb, &wkopt, &lwork, &info );

lwork = (MKL_INT)wkopt;

work = (float*)malloc( lwork*sizeof(float) );

/* Solve the equations A*X = B */

sgels( "No transpose", &m, &n, &nrhs, a, &lda, b, &ldb, work, &lwork, &info );

(2) where to decide row-major matrix or column -major matrix?

Thank you very much!

Link Copied

1 Reply

mecej4

Black Belt

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-24-2019
03:06 PM

78 Views

The first call, with lwork already equal to -1, is a "workspace query". The absurd value of -1 (absurd for a matrix size) tells SGEMM, "Don't do any calculations, just tell me how much workspace is going to be needed. I'll allocate the space and then call you again."

The routine you are calling is a Fortran 77 routine. All matrices must be column major. If you want to use other formats, there are other MKL routines for that, as you can see in the MKL reference manual.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.