omp_set_dynamic(enable_expr)

Purpose

The omp_set_dynamic subroutine enables or disables dynamic adjustment, by the run-time environment, of the number of threads available to execute parallel regions.

If you call omp_set_dynamic with a scalar_logical_expression that evaluates to .TRUE., the run-time environment can automatically adjust the number of threads that are used to execute subsequent parallel regions to obtain the best use of system resources. The number of threads you specify using omp_set_num_threads becomes the maximum, not exact, thread count.

If you call the subroutine with a scalar_logical_expression which evaluates to .FALSE., dynamic adjustment of the number of threads is disabled. The run-time environment cannot automatically adjust the number of threads used to execute subsequent parallel regions. The value you pass to omp_set_num_threads becomes the exact thread count.

By default, dynamic thread adjustment is enabled. If your code depends on a specific number of threads for correct execution, you should explicitly disable dynamic threads.

This subroutine has precedence over the OMP_DYNAMIC environment variable.

Class

Subroutine.

Argument Type and Attributes

enable_expr
Logical.

Result Type and Attributes

None.

Result Value

None. IBM Copyright 2003