MATLAB Answers

How to disable openMP with Matlab Coder?

20 views (last 30 days)
Matthias Frühwirth
Matthias Frühwirth on 7 Jun 2016
Commented: Anton Semechko on 14 May 2021
I want to use Matlab Coder to compile a function that will not profit much from multithreading. Although I use
codegen -O disable:openmp
the resulting C source includes omp.h and tries to find vcompXXX.dll when run.
How can I switch off OpenMP use completely?
System: Matlab Coder 2016a/Windows 10/Visual C++ 2013

Answers (1)

Ryan Livingston
Ryan Livingston on 1 Mar 2017
Try:
cfg = coder.config('dll');
cfg.EnableOpenMP = false;
codegen -config cfg ...
  1 Comment
Anton Semechko
Anton Semechko on 14 May 2021
Or if you are using the Matlab Coder GUI, once you reach the Generate Code stage click on "More Settings"
Then go to All Settings --> Advanced --> Enable OpenMP library if possible --> No

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!