Prev Next

@(@\newcommand{\W}[1]{ \; #1 \; } \newcommand{\R}[1]{ {\rm #1} } \newcommand{\B}[1]{ {\bf #1} } \newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} } \newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} } \newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} } \newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }@)@
A Quick OpenMP Memory Allocator Used by CppAD

Syntax
# include <cppad/omp_alloc.hpp>


Purpose
The C++ new and delete operators are thread safe, but this means that a thread may have to wait for a lock on these operations. Once memory is obtained for a thread, the omp_alloc memory allocator keeps that memory omp_available for the thread so that it can be re-used without waiting for a lock. All the CppAD memory allocations use this utility. The omp_free_available function should be used to return memory to the system (once it is no longer required by a thread).

Include
The routines in sections below are defined by cppad/omp_alloc.hpp. This file is included by cppad/cppad.hpp, but it can also be included separately with out the rest of the CppAD.

Deprecated 2011-08-23
Use thread_alloc instead.

Contents
omp_max_num_threadsSet and Get Maximum Number of Threads for omp_alloc Allocator
omp_in_parallelIs The Current Execution in OpenMP Parallel Mode
omp_get_thread_numGet the Current OpenMP Thread Number
omp_get_memoryGet At Least A Specified Amount of Memory
omp_return_memoryReturn Memory to omp_alloc
omp_free_availableFree Memory Currently Available for Quick Use by a Thread
omp_inuseAmount of Memory a Thread is Currently Using
omp_availableAmount of Memory Available for Quick Use by a Thread
omp_create_arrayAllocate Memory and Create A Raw Array
omp_delete_arrayReturn A Raw Array to The Available Memory for a Thread
omp_efficientCheck If A Memory Allocation is Efficient for Another Use
old_max_num_threadsSet Maximum Number of Threads for omp_alloc Allocator
omp_alloc.cppOpenMP Memory Allocator: Example and Test

Input File: omh/appendix/deprecated/omp_alloc.omh