如何使OpenMP线程或任务在某个内核上运行 [英] How to make OpenMP thread or task run on a certain core

查看:185
本文介绍了如何使OpenMP线程或任务在某个内核上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法可以使OMP线程或任务在某个内核上运行?
我发现了,然后点击了链接,但是我找不到测试它的源代码.这也是英特尔的解决方案(我认为). OMP本身支持吗?

Is there a way to make an OMP thread or task run on a certain core?
I found this, followed the link, but I couldn't find the source code to test it. Also this is an Intel solution to it (I think). Does OMP support this itself?

推荐答案

据我所知,对于OpemMP 3.0,它们都是特定于供应商的扩展.

As far as I know as of OpemMP 3.0 they're all vendor specific extensions.

例如,GOMP(GCC的实现)使用环境变量GOMP_CPU_AFFINITY来设置线程亲和力.

For example GOMP (GCC's implementation) honours the environment variable GOMP_CPU_AFFINITY for setting thread affinity.

在他们的文档中,给出了示例:

In their documentation they give the example:

GOMP_CPU_AFFINITY="0 3 1-2 4-15:2"

他们声明:

将初始线程绑定到CPU 0,将第二个线程绑定到CPU 3,第三个 到CPU 1,第四到CPU 2,第五到CPU 4,第六到 分别分配给CPU 6、8、10、12和14,然后启动 从列表的开头分配回来. GOMP_CPU_AFFINITY = 0 将所有线程绑定到CPU 0

will bind the initial thread to CPU 0, the second to CPU 3, the third to CPU 1, the fourth to CPU 2, the fifth to CPU 4, the sixth through tenth to CPUs 6, 8, 10, 12, and 14 respectively and then start assigning back from the beginning of the list. GOMP_CPU_AFFINITY=0 binds all threads to CPU 0

这篇关于如何使OpenMP线程或任务在某个内核上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆