ppl 的替代品

发布于 2024-11-18 00:18:33 字数 546 浏览 5 评论 0原文

我之前的问题我问过,我接触了微软提供的ppl.h中的parallel_for主题。
但不久之后,我意识到使用它会使他的应用程序变得不可移植(如果我是对的,它特定于 Microsoft(ppl.h 标头))。
在我看来,这破坏了 C++ 编程的一个非常重要的方面 - 可移植性,而我只是不准备这样做。
所以我的问题是:
1.我是否正确地说,使用ppl中的parallel_for会使您的代码不可移植(不可移植我的意思是它不能由除MS编译器之外的其他编译器编译)
2. 我是否正确地说,如果在后期我想为我目前正在开发的应用程序提供 UI(在 Qt 中完成),在我的代码中使用 parallel_for 将成为一个障碍,这意味着我要么'将用其他(便携式)替代方案替换parallel_for,否则我将无法在Qt中执行UI并在VS中执行核心?
3. ppl 的(便携式)替代品是什么?

In my previous question I've asked, I touched the parallel_for subject from ppl.h provided by Microsoft.
But shortly after I've realized that by using it one makes his application unportable (if I'm right it is specific to Microsoft (the ppl.h header)).
In my opinion this breaks very important aspect of programming in C++ - portability, and I'm just not prepare to do it.
So my questions are:
1. Am I right in saying that using parallel_for from ppl makes your code unportable (by unportable I mean that it cannot be compiled by other compiler than the one from MS)
2. Am I right in saying that if on later stage I want to provide UI (done in Qt) for the application I'm working on at the momment, using parallel_for in my code will be an obstruction which would mean that either I'll replace parallel_for with some other (portable) alternative or I won't be able to do UI in Qt and core in VS?
3. What are the (portable) alternatives to ppl?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

意中人 2024-11-25 00:18:33

您可能需要考虑英特尔的线程构建块。与 OpenMP 不同,TBB 实际上使用 C++,而不是简单地在 C++ 编译器下编译(即:作为可以编译为 C++ 的 C 库)。它具有您在 PPL 中看到的许多功能,但它是跨平台的。

还有Boost.Thread,它是C++(虽然不像TBB那么直接),并且是跨平台的。

You may want to consider Intel's Thread Building Blocks. Unlike OpenMP, TBB actually uses C++, rather than simply compiling under a C++ compiler (ie: being a C library that can compile as C++). It has many of the things you see in PPL, but it is cross-platform.

There is also Boost.Thread, which is C++ (though not quite as direct as TBB is), and it is cross-platform.

妄想挽回 2024-11-25 00:18:33

Casablanca 项目的工作人员一直在制作 PPL 的便携式版本,称为 PPLX。它根据 Apache 2.0 许可证获得许可。

他们之前曾表示,他们正在与 PPL 团队密切合作,以保持两个版本在功能和错误修复方面保持同步(请参阅 此线程)。

The people working on the Casablanca project have been making a portable version of PPL, called PPLX. It's licensed under an Apache 2.0 license.

They previously have said they are working closely together with the PPL team to keep both versions in sync feature and bugfix wise (see last post in this thread).

压抑⊿情绪 2024-11-25 00:18:33

无论您使用 PPL 还是 TBB(或 HPX)……非常相似的东西都将被标准化。例如,请参阅: http://www.open -std.org/jtc1/sc22/wg21/docs/papers/2015/n4411.pdf

Whether you use PPL or TBB (or HPX) ... something very similar is going to be standardised. For instance see: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4411.pdf

罪#恶を代价 2024-11-25 00:18:33

我说得对吗?
ppl 的 parallel_for 使您的代码
不可移植(不可移植我的意思是
它不能被其他人编译
编译器比 MS 的编译器)

如果您切换平台本身 则无法移植。如果您想使用其他编译器,可能可以在 Windows 上移植。但要知道PPL是Concurrency Runtime的一部分,它被放置在MSVCRT100.DLL中,你需要链接到这个(或者静态链接,运行时不需要DLL)。我不确定如何使用其他编译器/链接器来完成此操作,但我确实相信这是可行的。

我说得对吗,如果稍后
我想提供 UI 阶段(完成于
Qt)对于我正在开发的应用程序
目前,使用parallel_for
我的代码将成为一个障碍
意味着我要么替换
parallel_for 与其他一些
(便携式)替代方案,否则我不会
能够在Qt中做UI,在VS中做核心

您可以使用 PPL/VC++ 编写核心框架,并在 QT/其他编译器中编写其他 GUI 对应部分。为此,只需创建一个将使用 PPL 的 DLL,然后您的 GUI 应用程序将使用该 DLL。我相信你明白我的意思。这也减轻了您头脑中关于可移植性(在 Windows 上)的负担。

  1. ppl 的(便携式)替代品是什么?

很多,但我更喜欢在 Windows/VC++ 上使用 PPL。你可以考虑使用Intel的TBB。 OpenMP 很麻烦,并且与 TBB/ConcRT 相比没有优势

Am I right in saying that using
parallel_for from ppl makes your code
unportable (by unportable I mean that
it cannot be compiled by other
compiler than the one from MS)

Unportable if you switch the platform itself. May be portable on Windows, if you want to use other compilers. But know that PPL is part of Concurrency Runtime, which is placed in MSVCRT100.DLL, and you need to link to this (or statically link, without needing DLL at runtime). I am not sure how this can be done with other compilers/linkers, but I do believe it is doable.

Am I right in saying that if on later
stage I want to provide UI (done in
Qt) for the application I'm working on
at the momment, using parallel_for in
my code will be an obstruction which
would mean that either I'll replace
parallel_for with some other
(portable) alternative or I won't be
able to do UI in Qt and core in VS

You can write your core-framework in using PPL/VC++, and other GUI counterpart in QT/other-compiler. For this just make a DLL which would use PPL, and your GUI application would use the DLL. I do believe you understand what I mean here. This also reduces burden from your head about portability (on Windows).

  1. What are the (portable) alternatives to ppl?

Many, but I prefer using PPL on Windows/VC++. You may consider using Intel's TBB. OpenMP is troublesome, and doesn't give advantages as compared to TBB/ConcRT

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文