Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7222 Discussions

IPP or MKL for Lease-Squares Proceesing?

simbalee
Beginner
1,334 Views
I am going to write a program that deals matrixes by using Least-Squares method.
Size of matrix is around 100x12 to 1000x12. And the matrixes may be iterativly operated some 10,000 times for one task.
The problem is that I do not know if I should use small-matrix operation routines of IPP or MKL.
According to what I found in this forum, small matrix object of IPP is really small. The size is under 10x10.
On the other hand, I suppose that MKL deals with huge size matrix such as a matrix with millions elements.
Can anyone make a short comment on the choice bwteen IPP or MKL? Thanks.
0 Kudos
5 Replies
TimP
Honored Contributor III
1,334 Views
Not knowing about your partiicular application, MKL is generally at least competitive when the smaller dimension of the matrix is 8 or more. As you may have guessed, MKL gains more of an advantage for matrices large enough to benefit from threading and tiliing. As MKL BLAS and Lapack use the most popular calling interface, they are directly compatible with several other libraries, both source and binary, so you can easily test which suits your application.
0 Kudos
ArturGuzik
Valued Contributor I
1,334 Views
You should follow Tim's suggestion - try yourself as the result depends on your specific problem. However, from the docs:

IPP MX functions are optimized for operations on small matrices and small vectors, particularly for matrices of the size 3x3, 4x4, 5x5, 6x6, and for vectors of the length 3, 4, 5, 6. Note that when operating on small arrays, for example, a matrix array made up of two or three matrices of the size 3x3, overhead caused by function call and input parameters check may be greater than the optimization gain.

Apart from that as far as I know (and may be wrong) the IPP MX solves linear LS problem (uses QR decomposition to get solution). You mentioned something about iterations. This would suggest you're dealing with non-linear problem (and need Levenberg-Marquardt ....) and that MKL would be the path to take, as there all you need to do is to provide routine calculating Jacobian.

A.
0 Kudos
simbalee
Beginner
1,334 Views
Quoting - ArturGuzik
You should follow Tim's suggestion - try yourself as the result depends on your specific problem. However, from the docs:

IPP MX functions are optimized for operations on small matrices and small vectors, particularly for matrices of the size 3x3, 4x4, 5x5, 6x6, and for vectors of the length 3, 4, 5, 6. Note that when operating on small arrays, for example, a matrix array made up of two or three matrices of the size 3x3, overhead caused by function call and input parameters check may be greater than the optimization gain.

Apart from that as far as I know (and may be wrong) the IPP MX solves linear LS problem (uses QR decomposition to get solution). You mentioned something about iterations. This would suggest you're dealing with non-linear problem (and need Levenberg-Marquardt ....) and that MKL would be the path to take, as there all you need to do is to provide routine calculating Jacobian.

A.
Thank you, tim & Artur.
The task I am going to solve includes both linear and non-linear problems. From that point of view, MKL maybe the better choice.
However, the confusing thing here is that both IPP MX and MKL supply solutions for LS problems. Peopel may want to have a general idea about performance or choice. Say, to deal with up to 1 milliion data, you should use IPP, otherwise choose MKL. This kind of comment will be quite helpful for a lazy person like me.

0 Kudos
Gennady_F_Intel
Moderator
1,334 Views
Quoting - simbalee
Thank you, tim & Artur.
The task I am going to solve includes both linear and non-linear problems. From that point of view, MKL maybe the better choice.
However, the confusing thing here is that both IPP MX and MKL supply solutions for LS problems. Peopel may want to have a general idea about performance or choice. Say, to deal with up to 1 milliion data, you should use IPP, otherwise choose MKL. This kind of comment will be quite helpful for a lazy person like me.


Hi, here is my 2 cents :)
IPP contains some functions for solving the least squares problem of linear equations, but as Artur pointed above, all these functions are highly optimized for sizes into the range 3x3 ... 6x6. All of these functions will produce the correct output beyond this range, but the performance will be negligible because of will be running of reference code ....
--Gennady

0 Kudos
simbalee
Beginner
1,334 Views

Hi, here is my 2 cents :)
IPP contains some functions for solving the least squares problem of linear equations, but as Artur pointed above, all these functions are highly optimized for sizes into the range 3x3 ... 6x6. All of these functions will produce the correct output beyond this range, but the performance will be negligible because of will be running of reference code ....
--Gennady


I like your 2 cents Gennady. And that is actually what I want to know. Thank you very much.
0 Kudos
Reply