将OpenMP更新为Visual Studio 2022中的更高版本
在VS22中,OpenMP仍处于2.0版。是否可以将其更新为5.0或至少3.0?我尚未设法在VS22安装程序中找到任何选项,这将允许这一点。
In VS22, OpenMP is still at version 2.0. Is it possible to update it to 5.0 or at least 3.0? I haven't managed to find any options in VS22 Installer which would allow that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
长期以来,MSVC使用了自己的运行时,因为它仅支持2002年发布的OpenMP 2.0。由ICC)作为新的后端。您可以使用FLAG
/OpenMP:LLVM
启用它,旨在支持OpenMP 3.1(2011年发布)。您还可以使用FLAG/OpenMP:实验
能够使用OpenMP 4.5的某些功能(尽管这是最实验性的部分,但通常是任务)。尚未支持卸载功能(例如在GPU上)。尚未计划OpenMP 5.0的支持。有关更多信息,请阅读 a>。正如@laci在评论中指出的那样,另一种解决方案是使用Clang-Cl编译器,以便从Visual Studio中的OpenMP相对完整的支持中受益。请注意,使用Clang-CL代替默认编译器可能会导致一些不兼容(尤其是对于大型代码)。例如,Clang不支持某些C ++ 17/C ++ 20功能,例如平行STL,多态性分配器或一些先进的原子特征(与MSVC相反)。您可以获取有关每个编译器C ++功能支持的更多信息。
For a long time, MSVC used its own runtime that is completely obsolete now since it only supports OpenMP 2.0 released in 2002. Since Visual Studio 2019 version 16.9, MSCV now supports LLVM's OpenMP runtime library (
libomp
also used by ICC) as a new backend. You can enable it using the flag/openmp:llvm
meant to support OpenMP 3.1 (released in 2011). You can also use the flag/openmp:experimental
to be able to use some features of OpenMP 4.5 (typically tasks though this is the most experimental part). Offloading features (eg. on GPU) is not supported yet. The support of OpenMP 5.0 is not planed yet. For more information, please read this.As pointed out by @Laci in the comments, an alternative solution is to use the Clang-cl compiler so to benefit from a relatively complete support of OpenMP in Visual studio. Please note that using Clang-cl instead of the default compiler can result in some incompatibility (especially for large codes). For example, Clang does not support some C++17/C++20 features like the parallel STL, polymorphic allocators or some advanced atomic features yet (as opposed to MSVC). You can get more information about the support of C++ features for each compiler here.
Visual Studio 2022(版本17.3)支持OpenMP 3.1的所有任务结构和大多数其他功能。请参阅相关博客: https://devblogs.micros.s.microsoft.com/cppblog/cpplog/category/category/category/category/category/category/openmp/ < /a>
支持仍然是实验性的,libomp140*运行时还不是重新分配的一部分。
@kaiyakha:如果您可以在此处打开一张编译器崩溃的票:太好了,谢谢!
Visual Studio 2022 (version 17.3) supports all tasking constructs and most other features from OpenMP 3.1. See related blogs: https://devblogs.microsoft.com/cppblog/category/openmp/
The support is still experimental, libomp140* runtime is not part of redist yet.
@kaiyakha: if you can please open a ticket for the compiler crash here: https://developercommunity.visualstudio.com/search?space=62&entry=problem that would be great, thank you!