Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

omp_set_dynamic - how does the runtime determine the number of threads?

Tags:

openmp

How does the OpenMP runtime determine the best number of threads when omp_set_dynamic is used?

e.g. Are some sort of timing mechanisms used or does the compiler give hints to the runtime of how large the task size is?

like image 872
Mark Avatar asked Nov 26 '10 19:11

Mark


People also ask

Which function is used to get the number of threads in the parallel section?

omp_get_num_threads() The omp_get_num_threads function returns the number of threads in the team currently executing the parallel region from which it is called.

What does omp_ set_ num_ threads do?

omp_set_num_threads. Sets the number of threads in upcoming parallel regions, unless overridden by a num_threads clause.

What does omp_ set_ dynamic do?

Enables or disables dynamic adjustment of the number of threads available for execution of parallel regions.

What is omp_ get_ num_ threads?

omp_get_num_threads. Returns the number of threads in the parallel region. omp_get_max_threads. Returns an integer that is equal to or greater than the number of threads that would be available if a parallel region without num_threads were defined at that point in the code. omp_get_thread_num.


1 Answers

I don't think that the OpenMP does determine the 'best' number of threads for an application, in any likely sense of the word 'best'. As @aaa has commented, the runtime's behaviour when omp_set_dynamic is true is implementation specific.

I don't think that current Fortran/C/C++ compilers could provide information such as timings or task sizes to the runtime.

I believe that this function is available so that schedulers (and similar) can manage programs on machines, for throughput or similar.

like image 171
High Performance Mark Avatar answered Sep 21 '22 10:09

High Performance Mark