MSVC2017 32-bit compiler considered as not supporting OpenMP library

3 views (last 30 days)
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.

Accepted Answer

Anakin Zheng
Anakin Zheng on 13 Apr 2020
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);

More Answers (0)

Categories

Find more on Code Generation in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!