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

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 日

0 投票

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 日

0 投票

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 件のコメント

Carlos
Carlos 2013 年 9 月 12 日
Thanks! It is just a bit expensive for me though, I am a graduate student. But I will try to get it through the Department. In any case, what about Linux? Is it easier to use OpenMP there?
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.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeMATLAB Coder についてさらに検索

製品

質問済み:

2013 年 9 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by