简体   繁体   English

OMP - 线程数多于处理器数量?

[英]OMP - more threads than the number of processors?

By default OpenMP directive: 默认情况下,OpenMP指令:

opm_get_num_threads gives number of threads equivalent to processors/cores. opm_get_num_threads给出等同于处理器/核心的线程数。

I have an 8 core machine, so it gives me 8 threads. 我有一个8核机器,所以它给了我8个线程。 Is that the maximum? 那是最大的吗? Can I get more threads than 8, if I deliberately specify more than 8? 如果我故意指定超过8个,我可以获得比8更多的线程吗?

Thanks 谢谢

You can set as many threads as you want with: 您可以根据需要设置多个线程:

int threads = 16;
omp_set_num_threads(threads);

http://msdn.microsoft.com/en-US/library/e16bady3%28v=vs.80%29 http://msdn.microsoft.com/en-US/library/e16bady3%28v=vs.80%29

But be sure you are aware of the drawbacks of using more threads than there are logical cores in the system. 但请确保您了解使用更多线程的缺点,而不是系统中的逻辑核心。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM