How to disable openMP with Matlab Coder?

19 visualizaciones (últimos 30 días)
Matthias Frühwirth
Matthias Frühwirth el 7 de Jun. de 2016
Editada: Joe Barrus el 8 de En. de 2024
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

Respuestas (1)

Ryan Livingston
Ryan Livingston el 1 de Mzo. de 2017
Try:
cfg = coder.config('dll');
cfg.EnableOpenMP = false;
codegen -config cfg ...
  3 comentarios
Jingyang Yan
Jingyang Yan el 18 de Feb. de 2022
In MATLABT R2021b version, even I disable the OpenMP libarart if possible, the omp.h file is still included in the header files.
Joe Barrus
Joe Barrus el 8 de En. de 2024
Editada: Joe Barrus el 8 de En. de 2024
In MATLAB 2023b, with All Settings --> Advanced --> Enable OpenMP library if possible --> No, Coder still generates #include "omp.h" and generates omp_nest_lock_t variable.
If I generate a new Coder project file from scratch and select No to "Enable OpenMP library if possible" it seems to work, but changing that setting after initial creation does not seem to work.

Iniciar sesión para comentar.

Categorías

Más información sobre Code Generation en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by