omp_max_num_threads

View page source

Set and Get Maximum Number of Threads for omp_alloc Allocator

Deprecated 2011-08-31

Use the functions thread_alloc::parallel_setup and thread_alloc:num_threads instead.

Syntax

# include <cppad/utility/omp_alloc.hpp>
omp_alloc::set_max_num_threads ( number )
number = omp_alloc::get_max_num_threads ()

Purpose

By default there is only one thread and all execution is in sequential mode (not parallel ).

number

The argument and return value number has prototype

size_t number

and must be greater than zero.

set_max_num_threads

Informs omp_alloc of the maximum number of OpenMP threads.

get_max_num_threads

Returns the valued used in the previous call to set_max_num_threads . If there was no such previous call, the value one is returned (and only thread number zero can use omp_alloc ).

Restrictions

The function set_max_num_threads must be called before the program enters parallel execution mode. In addition, this function cannot be called while in parallel mode.