MSVC2017 32-bit compiler considered as not supporting OpenMP library

1 次查看(过去 30 天)
I would like to generate and build a 32-bit library to run on 64-bit Windows using Matlab Coder.
To achieve this, I registered a custom MSVC 32-bit toolchain using the example « Build 32-bit DLL on 64-bit Windows® Platform Using MSVC Toolchain ». I use version 15.0 (2017) of MSVC.
My problem is that Matlab Coder considers this compiler does not support OpenMP, and consequently doesn’t generate the #pragma omp directives it would otherwise. This prevents taking advantage of the parfor loops in Matlab code.
MSVC2017 does actually supports OpenMP, even when used in 32-bit mode on 64-bit Windows. So I was wondering if it could be possible to change this custom toolchain's definition in a way that makes Matlab Coder consider it supports OpenMP ?
Thank you.

采纳的回答

Anakin Zheng
Anakin Zheng 2020-4-13
Hi Jean-Alain,
To support OpenMP, toolchain needs to contain an OpenMP setion.
In my_msvc_32bit_tc add something like this:
openMPCFlags = ...;
openMPLFlags = ...;
toolchainObjectHandle.addCustomBuildConfiguration('OpenMP', ...
'C Compiler', openMPCFlags, 'Linker', openMPLFlags, ...
'C++ Compiler', openMPCFlags, 'C++ Linker', openMPLFlags);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Coder 的更多信息

标签

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by