- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All!
I am trying to implement one Linear programming algorithm in C++. For the matrix multiplication, I use Blas and Lapack. However, I find C++ code performs worse than Matlab as the size of problem is large. Indeed, the difference becomes significant as the size increases.
I am wondering if it is caused by the optimization tricks of matlab use to call Intel MKL. Could some one help explain why Matlab sometimes outperform C++ with Blas/Lapack? Is there any way to improve this version of C++ code, or any option to optimize compiling?
Thank you for your time!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does Matlab make affinity settings? Even if you run on a single CPU, those may improve cache locality, particularly as you prevent C++ from fusing loops as it might do if you wrote in-line code in place of level 1 BLAS calls.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Tim.
Thank you for your reply!
Would you like to tell me what affinity settings in Matlab mean? I am not familiar with this. Furthermore, could you tell me how I modify my C++ code to improve the performance?
Thank you for your time!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could anyone help solve this problem? I am still confusing about which optimization tricks Matlab apply to Intel MKL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tianyi,
Could you provide some details, like a test code and test result, compile option, test processor, matlab version, MKL version to explain what the problem you are seeing? otherwise, it is hard to say something.
Regarding MKL and Matlab, you may have known that , Matlab matrix multiply should call MKL. You may check this by enter command in matlab command windows,
version -blas
https://software.intel.com/en-us/articles/using-intel-mkl-with-matlab
Best Regards,
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
two my cents just for info -- Matlab R2015b uses MKL version 11.1.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page