2 # ifndef CPPAD_UTILITY_OMP_ALLOC_HPP
3 # define CPPAD_UTILITY_OMP_ALLOC_HPP
138 return omp_in_parallel() != 0;
186 size_t thread =
static_cast<size_t>( omp_get_thread_num() );
597 template <
class Type>
599 {
return thread_alloc::create_array<Type>(size_min, size_out); }
668 template <
class Type>
static void return_memory(void *v_ptr)
Return memory that was obtained by get_memory.
static void return_memory(void *v_ptr)
Return memory that was obtained by get_memory.
static Type * create_array(size_t size_min, size_t &size_out)
Use omp_alloc to Create a Raw Array.
static size_t available(size_t thread)
Determine the amount of memory that is currently available for use.
static size_t inuse(size_t thread)
Determine the amount of memory that is currently inuse.
static size_t inuse(size_t thread)
Determine the amount of memory that is currently inuse.
static size_t available(size_t thread)
Determine the amount of memory that is currently available for use.
static void free_available(size_t thread)
Return all the memory being held as available for a thread to the system.
static bool in_parallel(void)
Are we in a parallel execution state; i.e., is it possible that other threads are currently executing...
static size_t num_threads(void)
Get the current number of threads that thread_alloc can use.
static void * get_memory(size_t min_bytes, size_t &cap_bytes)
Use thread_alloc to get a specified amount of memory.
static void hold_memory(bool value)
Change the thread_alloc hold memory setting.
static void delete_array(Type *array)
Return Memory Used for an Array to the Available Pool (include destructor call for each element)...
static void set_max_num_threads(size_t number)
Inform omp_alloc of the maximum number of OpenMP threads and enable parallel execution mode by initia...
static void * get_memory(size_t min_bytes, size_t &cap_bytes)
Use omp_alloc to get a specified amount of memory.
static void free_available(size_t thread)
Return all the memory being held as available for a thread to the system.
static void delete_array(Type *array)
Return Memory Used for a Raw Array to the Available Pool.
File used to define the CppAD multi-threading allocator class.
static void parallel_setup(size_t num_threads, bool(*in_parallel)(void), size_t(*thread_num)(void))
Set thread_alloc up for parallel mode usage.
static size_t get_thread_num(void)
Get current OpenMP thread number (zero if _OpenMP not defined).
static size_t get_max_num_threads(void)
Get the current maximum number of OpenMP threads that omp_alloc can use.