开发者

How to make OpenMP thread or task run on a certain core

开发者 https://www.devze.com 2023-04-11 23:11 出处:网络
Is there a way to make an OMP thread or task run on a certain core? I fou开发者_如何学Gond this, followed the link, but I couldn\'t find the source code to test it. Also this is an Intel solution to i

Is there a way to make an OMP thread or task run on a certain core?

I fou开发者_如何学Gond 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?


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

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"

Which they state:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号