How to compile matlab library with C including openmp?
2 views (last 30 days)
Show older comments
Using mbuild to compile my C code reports the following error: Unknown MEX argument '-fopenmp'. I'm wondering how to integrate the matlab library into my C code including openmp?
1 Comment
Walter Roberson
on 6 Feb 2018
You need to be careful with this; see https://www.mathworks.com/matlabcentral/answers/362692-is-it-possible-make-parallel-processing-using-mex-and-openmp-on-matlab#answer_287564
Answers (1)
Walter Roberson
on 6 Feb 2018
This question was brought to an uncertain resolution in https://www.mathworks.com/matlabcentral/answers/373649-mex-file-maker-not-working-when-using-thread-header
If you are using Visual Studio then there was a Community Edition that did not support OpenMP. I remember that at some point I listed which version it was but I am not finding the posting at the moment, but see
2 Comments
Walter Roberson
on 7 Feb 2018
For Linux I would use the same approach as on Mac:
mex -v CXXFLAGS="$CXXFLAGS -fopenmp"
See Also
Categories
Find more on MATLAB Support for MinGW-w64 C/C++ Compiler in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!