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

女生的网名这么多〃 提交于 2019-12-08 07:54:50

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/7703069/how-to-make-openmp-thread-or-task-run-on-a-certain-core

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!