Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7261 ディスカッション

IPP or MKL for Lease-Squares Proceesing?

simbalee
ビギナー
1,509件の閲覧回数
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 件の賞賛
5 返答(返信)
TimP
名誉コントリビューター III
1,509件の閲覧回数
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.
ArturGuzik
高評価コントリビューター I
1,509件の閲覧回数
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.
simbalee
ビギナー
1,509件の閲覧回数
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.

Gennady_F_Intel
モデレーター
1,509件の閲覧回数
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

simbalee
ビギナー
1,509件の閲覧回数

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.
返信