Using OpenMP 3/4 in Visual Studio 2017
Trying to use features from OpenMP 3
#pragma omp parallel for collapse(2)
in Visual Studio 2017; I receive a message error c3005: 'collapse' unexpected token encountered on openmp 'parallel for' directive
Visual Studio 2017 seems to only support OpenMP2. A request to support OpenMP4.5 was said from the VS team
We have no plans at this time.
Another answer said
Fortunately, clang-cl has become a viable alternative with OpenMP 4 support. In the worst case, you can still enable the / fallback option.
How do I use clang-cl with Visual Studio 2017 and what's the fallback?
source to share
Update: The integration has been improved and you can now even install it via the VS installer. They are also working on supporting / MP.
You can get clang-cl from http://llvm.org/builds/
But you may run into integration issues starting from VS2017:
- https://bugs.llvm.org/show_bug.cgi?id=33672
- https://www.reddit.com/r/cpp/comments/6oepq4/making_windows_clang_401_play_nice_with_visual/
- There is an attempt to solve this problem : https://github.com/WubbaLubba/LlvmForVS2017
/ fallback is a clang-cl option that forces it to use the Microsoft compiler if it can't compile something by itself.
But be aware that hacking / MP is not supported: http://clang-developers.42468.n3.nabble.com/clang-windows-clang-cl-support-for-MP-tp4045651p4045659.html
source to share