C 的任务库?

发布于 2024-12-11 08:04:46 字数 91 浏览 0 评论 0 原文

有C语言的任务库吗?我说的是 C# 或 Java 中存在的并行任务库。换句话说,我需要 Linux 的 pthread 上的一个抽象层。谢谢。

Is there a task library for C? I'm talking about the parallel task library as it exists in C#, or Java. In other words, I need a layer of abstraction over pthread for Linux. Thanks.

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

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

发布评论

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

评论(5

平安喜乐 2024-12-18 08:04:46

查看 OpenMP
特别是,您可能对 OpenMP 的 任务 功能感兴趣3.0。

不过,我建议您尝试看看是否可以使用其他“基本”结构(例如并行 for)来解决您的问题,因为它们更易于使用。

Give a look at OpenMP.
In particular, you might be interested in the Task feature of OpenMP 3.0.

I suggest you, however, to try to see if your problem can be solved using other, "basic" constructs, such as parallel for, since they are simpler to use.

反话 2024-12-18 08:04:46

除了 Win32 之外,最广泛使用的并行编程原语可能是 pthreads 提供的那些。

它们的级别相当低,但包含编写高效阻塞队列所需的一切,因此可以创建执行异步任务队列的工作线程池。

还有一个 Win32 实现,因此您可以在 Windows 和 POSIX 系统上使用相同的代码库。

Probably the most widely-used parallel programming primitives aside from the Win32 ones are those provided by pthreads.

They are quite low-level but include everything you need to write an efficient blocking queue and so create a thread pool of workers that carry out a queue of asynchronous tasks.

There is also a Win32 implementation so you can use the same codebase on Windows as well as POSIX systems.

-残月青衣踏尘吟 2024-12-18 08:04:46

TPL 中的许多概念(任务、工作窃取调度程序等)都受到一个非常成功的项目的启发,该项目名为 Cilk 在麻省理工学院。他们的先进框架 (Cilk Plus) 被英特尔收购并集成到英特尔并行构建模块中。您仍然可以将 Cilk 用作开源项目 没有一些高级功能。好消息是英特尔正在 GCC 中以开源方式发布 Cilk Plus< /a>.

您应该尝试 Cilk,因为它为 C 添加了另一层抽象,这使得表达并行算法变得容易,但它与 C 足够接近以确保良好的性能。

Many concepts in TPL (Task, Work-Stealing Scheduler,...) are inspired by a very successful project named Cilk at MIT. Their advanced framework (Cilk Plus) was acquired by Intel and integrated to Intel Parallel Building Block. You still can use Cilk as an open source project without some advanced features. The good news is Intel is releasing Cilk Plus as open source in GCC.

You should try out Cilk as it adds another layer of abstraction to C, which makes it easy to express parallel algorithms but it is close enough to C to ensure good performance.

不甘平庸 2024-12-18 08:04:46

我一直想查看 libdispatch。是的,它是为 OS X 和块构建的,但它们也有函数接口。还没有真正有时间查看它,所以不确定它是否满足您的所有需求。

I've been meaning to checking out libdispatch. Yeah it's built for OS X and blocks, but they have function interfaces as well. Haven't really had time to look at it yet though so not sure if it fills all your needs.

青巷忧颜 2024-12-18 08:04:46

有一个名为 Wool 的学术项目,它在 C 中实现了工作窃取调度程序(在C 预处理器 AFAIK)。可能值得一看,尽管它似乎没有积极开发。

There is an academia project called Wool that implements work stealing scheduler in C (with significant help of C preprocessor AFAIK). Might be worth looking at, though it does not seem actively developed.

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