C++17 并行算法是否已经实现?

2021-12-30 00:00:00 parallel-processing g++ c++ c++17 clang++

我试图尝试使用 C++17 标准中提出的新并行库功能,但我无法让它工作.我尝试使用 g++ 8.1.1clang++-6.0-std=c++17 的最新版本进行编译,但似乎都不支持 #include std::execution::par 或任何类似的东西.

I was trying to play around with the new parallel library features proposed in the C++17 standard, but I couldn't get it to work. I tried compiling with the up-to-date versions of g++ 8.1.1 and clang++-6.0 and -std=c++17, but neither seemed to support #include <execution>, std::execution::par or anything similar.

在查看并行算法的 cppreference 时,有一长串算法,声称

When looking at the cppreference for parallel algorithms there is a long list of algorithms, claiming

技术规范提供了来自algorithmnumericmemory的以下69种算法的并行版本:( ... long list...)

Technical specification provides parallelized versions of the following 69 algorithms from algorithm, numeric and memory: ( ... long list ...)

听起来算法已经纸上",但还没有准备好使用?

which sounds like the algorithms are ready 'on paper', but not ready to use yet?

在这个SO问题中一年前,答案声称这些功能尚未实现.但到现在为止,我本来希望看到某种实现.有什么我们可以使用的吗?

In this SO question from over a year ago the answers claim these features hadn't been implemented yet. But by now I would have expected to see some kind of implementation. Is there anything we can use already?

推荐答案

可以参考https://en.cppreference.com/w/cpp/compiler_support 检查所有 C++ 功能实现状态.对于您的情况,只需搜索Standardization of Parallelism TS",您会发现现在只有 MSVCIntel C++ 编译器支持此功能.

You can refer https://en.cppreference.com/w/cpp/compiler_support to check all C++ feature implementation status. For your case, just search "Standardization of Parallelism TS", and you will find only MSVC and Intel C++ compilers support this feature now.

相关文章