Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

What actually happens if I specify the number of OpenMP threads exceeding the actual number of CPU's logical cores ?

ArthurRatz
Novice
1,362 Views

Dear Collegues,

I've got a question about what actually happens if I specify the number of OpenMP threads exceeding the actual number of CPU's logical cores in #pragma omp parallel directive construct ( #pragma omp parallel num_threads(10) if the maximum number of logical cores for my CPU is 8 ) ? And is that efficient since each OpenMP thread is mapped to a corresponding CPU logical core ?

I'm sorry, I know that OpenMP questions is offtopic for this forum, but I would prefer to get answers about in this particular forum and not forum.openmp.org.

Thanks for your reply in advance.

Cheers, Arthur.

0 Kudos
1 Solution
jimdempseyatthecove
Honored Contributor III
1,362 Views

Your question is quite valid.

There are some cases where you may wish to oversubscribe and experience improved performance. In situations where a, or some, or all threads in the parallel region perform thread blocking operations such as I/O. In those cases an otherwise oversubscribed thread can compute during the I/O wait time. As to how much to oversubscribe, this is more of a matter of experimentation.

A similar situation exists where you may find it advantageous to undersubscribe. An example of this you have a modeless dialog box and support threads providing visualizations of the state of the computation.

Jim Dempsey

View solution in original post

0 Kudos
3 Replies
TimP
Honored Contributor III
1,362 Views

If you have pinned 2 threads to each of certain hardware logical processors, you would expect those threads to swap periodically and each get 50% of that processor's resources.  If you don't pin them, you would expect the os scheduler to rotate threads so as to give each equal time, further worsening cache locality.

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,363 Views

Your question is quite valid.

There are some cases where you may wish to oversubscribe and experience improved performance. In situations where a, or some, or all threads in the parallel region perform thread blocking operations such as I/O. In those cases an otherwise oversubscribed thread can compute during the I/O wait time. As to how much to oversubscribe, this is more of a matter of experimentation.

A similar situation exists where you may find it advantageous to undersubscribe. An example of this you have a modeless dialog box and support threads providing visualizations of the state of the computation.

Jim Dempsey

0 Kudos
ArthurRatz
Novice
1,362 Views

Thanks a lot for your reply.

0 Kudos
Reply