Intel TBB库有选择核心数量的功能吗?

发布于 2025-01-08 16:06:23 字数 148 浏览 3 评论 0原文

我正在使用 Intel TBB 来加速图形领域的问题。 我想分析我的方法的可扩展性。

为了找到可扩展性,我想运行相同的算法 使用 1、2、3 和 4 个 CPU 核心。

有没有办法告诉 TBB 使用 2 & 3核 在 4 核 CPU 上运行测试。

I am using Intel TBB to speed up a problem in graphics domain.
I want to analyze the scalability of my method.

To find the scalability I want run the same algorithm
using 1, 2, 3 and 4 CPU cores.

Is there a way to tell TBB to use 2 & 3 cores
while running the tests on a 4 core CPU.

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

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

发布评论

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

评论(1

谁许谁一生繁华 2025-01-15 16:06:23

是的,有一种方法可以做到这一点:

task_scheduler_init 类可以让你做到这一点。您必须向类的构造函数传递您想要使用的线程数。您还必须确保所有 TBB 代码在实例构建之后和销毁之前运行。

通常,在主函数中将其声明为变量就足够了,如下所示:

int main()
{
    tbb::task_scheduler_init init(3);//three threads
    do_the_work();
}

Yes, there is a way to do that:

The task_scheduler_init class lets you do that. You have to pass the constructor of the class the number of threads you want to use. You also have to make sure that all your TBB code runs after the instance is constructed and before it is destroyed.

Usually, it is sufficient to declare it as a variable in the main function, like this:

int main()
{
    tbb::task_scheduler_init init(3);//three threads
    do_the_work();
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文