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

1 view (last 30 days)
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!

Answers (2)

Sean de Wolski
Sean de Wolski on 12 Sep 2013
Hi Carlos,
I would recommend upgrading to R2013b. A lot of new support for parfor was added in this release:
  2 Comments
Carlos
Carlos on 12 Sep 2013
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 on 12 Sep 2013
On a campus-wide license, if the SMS is current, upgrading will be free and just require the physical download.

Sign in to comment.


Jan
Jan on 12 Sep 2013
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 Comments
Fred Smith
Fred Smith on 12 Sep 2013
OpenMP is supported by gcc on linux for free. It is not supported by clang on Mac at all.
Jan
Jan on 12 Sep 2013
@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.

Sign in to comment.

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!