Community
cancel
Showing results for 
Search instead for 
Did you mean: 
ArthurRatz
Novice
109 Views

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

Jump to solution

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

Accepted Solutions
jimdempseyatthecove
Black Belt
109 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

3 Replies
TimP
Black Belt
109 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.

jimdempseyatthecove
Black Belt
110 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

ArthurRatz
Novice
109 Views

Thanks a lot for your reply.