How to disable openMP with Matlab Coder?

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

1 件のコメント

Thomas Langerwerf
Thomas Langerwerf 2017 年 2 月 23 日
I would also like to know this!

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

回答 (1 件)

Ryan Livingston
Ryan Livingston 2017 年 3 月 1 日

3 投票

Try:
cfg = coder.config('dll');
cfg.EnableOpenMP = false;
codegen -config cfg ...

3 件のコメント

Anton Semechko
Anton Semechko 2021 年 5 月 14 日
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
Jingyang Yan
Jingyang Yan 2022 年 2 月 18 日
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 2024 年 1 月 8 日
編集済み: Joe Barrus 2024 年 1 月 8 日
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.

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

カテゴリ

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

製品

タグ

質問済み:

2016 年 6 月 7 日

編集済み:

2024 年 1 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by