Parallel Computation of Covariance and C Code Generation

1 vue (au cours des 30 derniers jours)
Manjinder Benning
Manjinder Benning le 16 Jan 2013
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?

Réponses (1)

Ryan Livingston
Ryan Livingston le 16 Jan 2013
Modifié(e) : Ryan Livingston le 25 Oct 2018
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.

Catégories

En savoir plus sur Execution Speed dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by