Compartir a través de


Contents

1. Introduction

1.1 Scope

1.2 Definition of Terms

1.3 Execution Model

1.4 Compliance

1.5 Normative References

1.6 Organization

2. Directives

2.1 Directive Format

2.2 Conditional Compilation

2.3 parallel Construct

2.4 Work-sharing Constructs

2.4.1 for Construct

2.4.2 sections Construct

2.4.3 single Construct

2.5 Combined Parallel Work-sharing Constructs

2.5.1 parallel for Construct

2.5.2 parallel sections Construct

2.6 Master and Synchronization Directives

2.6.1 master Construct

2.6.2 critical Construct

2.6.3 barrier Directive

2.6.4 atomic Construct

2.6.5 flush Directive

2.6.6 ordered Construct

2.7 Data Environment

2.7.1 threadprivate Directive

2.7.2 Data-Sharing Attribute Clauses

2.7.2.1 private

2.7.2.2 firstprivate

2.7.2.3 lastprivate

2.7.2.4 shared

2.7.2.5 default

2.7.2.6 reduction

2.7.2.7 copyin

2.7.2.8 copyprivate

2.8 Directive Binding

2.9 Directive Nesting

3. Run-time Library Functions

3.1 Execution Environment Functions

3.1.1 omp_set_num_threads Function

3.1.2 omp_get_num_threads Function

3.1.3 omp_get_max_threads Function

3.1.4 omp_get_thread_num Function

3.1.5 omp_get_num_procs Function

3.1.6 omp_in_parallel Function

3.1.7 omp_set_dynamic Function

3.1.8 omp_get_dynamic Function

3.1.9 omp_set_nested Function

3.1.10 omp_get_nested Function

3.2 Lock Functions

3.2.1 omp_init_lock and omp_init_nest_lock Functions

3.2.2 omp_destroy_lock and omp_destroy_nest_lock Functions

3.2.3 omp_set_lock and omp_set_nest_lock Functions

3.2.4 omp_unset_lock and omp_unset_nest_lock Functions

3.2.5 omp_test_lock and omp_test_nest_lock Functions

3.3 Timing Routines

3.3.1 omp_get_wtime Function

3.3.2 omp_get_wtick Function

4. Environment Variables

4.1 OMP_SCHEDULE

4.2 OMP_NUM_THREADS

4.3 OMP_DYNAMIC

4.4 OMP_NESTED

A. Examples

A.1 Executing a Simple Loop in Parallel

A.2 Specifying Conditional Compilation

A.3 Using Parallel Regions

A.4 Using the nowait Clause

A.5 Using the critical Directive

A.6 Using the lastprivate Clause

A.7 Using the reduction Clause

A.8 Specifying Parallel Sections

A.9 Using single Directives

A.10 Specifying Sequential Ordering

A.11 Specifying a Fixed Number of Threads

A.12 Using the atomic Directive

A.13 Using the flush Directive with a List

A.14 Using the flush Directive without a List

A.15 Determining the Number of Threads Used

A.16 Using Locks

A.17 Using Nestable Locks

A.18 Nested for Directives

A.19 Examples Showing Incorrect Nesting of Work-sharing Directives

A.20 Binding of barrier Directives

A.21 Scoping Variables with the private Clause

A.22 Using the default(none) Clause

A.23 Examples of the ordered Directive

A.24 Example of the private Clause

A.25 Examples of the copyprivate Data Attribute Clause

A.26 Using the threadprivate Directive

A.27 Use of C99 Variable Length Arrays

A.28 Use of num_threads Clause

A.29 Use of Work-Sharing Constructs Inside a critical Construct

A.30 Use of Reprivatization

A.31 Thread-Safe Lock Functions

B. Stubs for Run-time Library Functions

C. OpenMP C and C++ Grammar

C.1 Notation

C.2 Rules

D. Using the schedule Clause

E. Implementation-Defined Behaviors in OpenMP C/C++

F. New Features and Clarifications in Version 2.0

See Also

Concepts

OpenMP C and C++ Application Program Interface