Parallel Computation of Covariance and C Code Generation
2 ビュー (過去 30 日間)
古いコメントを表示
Hi i am trying to parallelize the computation of a large covariance matrix and then use CODER to generate C output ready to compile and deploy on a multi-core system.
Parfor wont work unless i break out the COV function into 3 for loops. So pain in the ass.
Can i somehow use the matlab COV function and then use CODER to create C code ready for Multi-core optimizations?
Or can i somehow convert matlab large inline matrix multiplication code to parallel C code using a multi-core lib like BLAS or OpenMP?
0 件のコメント
回答 (1 件)
Ryan Livingston
2013 年 1 月 16 日
編集済み: Ryan Livingston
2018 年 10 月 25 日
Update Starting in R2018b you can generate code that calls a CBLAS as well as an LAPACK library:
My answer here:
has more details.
Original Response
If you post a little of the troublesome PARFOR code the community may be able to give you some tips on it to simplify the implementation.
Using MATLAB Coder to generate code for the COV function will generally generate serial code. However, Coder does support replacing matrix operations with BLAS calls so large matrix calculations can be replaced by calls to the BLAS.
In a MEX build you can use the 'EnableBlas' property of a MEX configuration object described here:
and here
Note that the replacement occurs for matrices over a certain threshold to mitigate the overhead of calling the BLAS.
For generating standalone libraries or executables code replacement may be used to replace matrix operations with the BLAS. Doing so is described here:
under the heading "BLAS Support". This demo uses the BLAS shipped with MATLAB but the CRL approach allows you to swap in your desired BLAS implementation as well.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Execution Speed についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!