Borrar filtros
Borrar filtros

Parallel Computation of Covariance and C Code Generation

2 visualizaciones (últimos 30 días)
Manjinder Benning
Manjinder Benning el 16 de En. de 2013
Editada: Ryan Livingston el 25 de Oct. de 2018
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?

Respuestas (1)

Ryan Livingston
Ryan Livingston el 16 de En. de 2013
Editada: Ryan Livingston el 25 de Oct. de 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.


Más información sobre Execution Speed en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by