How can I use parallelized code when converting to a .mex file?

1 次查看(过去 30 天)
Hi all,
I am converting a .m function to .mex in order to increase the speed. There is a loop that I cannot avoid. The conversion works fine and there is an increase of speed of a HUGE magnitude. However, when I build the .mex file using Matlab Coder I always get this message:
"The specified compiler (msvcsdk) does not support the OpenMP library; turning off parallelization."
I guess that parallelization will increase the speed even more (especially since the loop can be parallelized). Does anyone know how can I use the OpenMP library? I use Matlab R2012b, Windows 8, and the compiler I installed is the one from Microsoft Software Development Kit (SDK) 7.1
Thanks!

回答(2 个)

Sean de Wolski
Sean de Wolski 2013-9-12
Hi Carlos,
I would recommend upgrading to R2013b. A lot of new support for parfor was added in this release:
  2 个评论
Carlos
Carlos 2013-9-12
Thank you very much! I will try to get it, but I work on a campus-wide license, so it is not really up to me :(
Sean de Wolski
Sean de Wolski 2013-9-12
On a campus-wide license, if the SMS is current, upgrading will be free and just require the physical download.

请先登录,再进行评论。


Jan
Jan 2013-9-12
You need MSVC professional for OpenMP support.
You can find a complicated set of instructions for including the freely available OpenMP runtime libs and an explanantions how to modifying the setup of the free SDK compiler. I did not try this although it seems to be legal to combine different libs and downloads, which can be obtained legally. But for a stable procedure and the possibility to debug the code I'd prefer to buy the professional version of the compiler instead.
  3 个评论
Fred Smith
Fred Smith 2013-9-12
OpenMP is supported by gcc on linux for free. It is not supported by clang on Mac at all.
Jan
Jan 2013-9-12
@Carlos: You can check if your university participates on Microsoft's DreamSpark program. I do not understand the required details to participate on DreamSpark in any way, although I've read through https://www.dreamspark.com several times. But all I've found is that there is a chance that students get MSVC professional for free, almost free, a handful of money or perhaps not at all. In every case DreamSpark is extremely interesting, most likely.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 MATLAB Compiler 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by