Sun Logo


OpenMP API User's Guide

Suntrademark ONE Studio 8

817-0933-10



Contents

Before You Begin

Typographic Conventions

Shell Prompts

Accessing Compiler Collection Tools and Man Pages

Accessing Compiler Collection Documentation

Accessing Related Solaris Documentation

Resources for Developers

Contacting Sun Technical Support

Sun Welcomes Your Comments

1. OpenMP API Summary

1.1 Where to Find the OpenMP Specifications

1.2 Special Conventions Used Here

1.3 Directive Formats

1.4 Conditional Compilation

1.5 PARALLEL - Parallel Region Construct

1.6 Work-Sharing Constructs

1.6.1 DO and for Constructs

1.6.2 SECTIONS Construct

1.6.3 SINGLE Construct

1.6.4 Fortran WORKSHARE Construct

1.7 Combined Parallel Work-sharing Constructs

1.7.1 PARALLEL DO and parallel for Constructs

1.7.2 PARALLEL SECTIONS Construct

1.7.3 PARALLEL WORKSHARE Construct

1.8 Synchronization Constructs

1.8.1 MASTER Construct

1.8.2 CRITICAL Construct

1.8.3 BARRIER Construct

1.8.4 ATOMIC Construct

1.8.5 FLUSH Construct

1.8.6 ORDERED Construct

1.9 Data Environment Directives

1.9.1 THREADPRIVATE Directive

1.10 OpenMP Directive Clauses

1.10.1 Data Scoping Clauses

1.10.1.1 PRIVATE Clause

1.10.1.2 SHARED Clause

1.10.1.3 DEFAULT Clause

1.10.1.4 FIRSTPRIVATE Clause

1.10.1.5 LASTPRIVATE Clause

1.10.1.6 COPYIN Clause

1.10.1.7 COPYPRIVATE Clause

1.10.1.8 REDUCTION Clause

1.10.2 Scheduling Clauses

1.10.2.1 STATIC Scheduling

1.10.2.2 DYNAMIC Scheduling

1.10.2.3 GUIDED Scheduling

1.10.2.4 RUNTIME Scheduling

1.10.3 NUM_THREADS Clause

1.10.4 Placement of Clauses on Directives

1.11 OpenMP Runtime Library Routines

1.11.1 Fortran OpenMP Routines

1.11.2 C/C++ OpenMP Routines

1.11.3 Run-time Thread Management Routines

1.11.3.1 OMP_SET_NUM_THREADS Routine

1.11.3.2 OMP_GET_NUM_THREADS Routine

1.11.3.3 OMP_GET_MAX_THREADS Routine

1.11.3.4 OMP_GET_THREAD_NUM Routine

1.11.3.5 OMP_GET_NUM_PROCS Routine

1.11.3.6 OMP_IN_PARALLEL Routine

1.11.3.7 OMP_SET_DYNAMIC Routine

1.11.3.8 OMP_GET_DYNAMIC Routine

1.11.3.9 OMP_SET_NESTED Routine

1.11.3.10 OMP_GET_NESTED Routine

1.11.4 Routines That Manage Synchronization Locks

1.11.4.1 OMP_INIT_LOCK and OMP_INIT_NEST_LOCK Routines

1.11.4.2 OMP_DESTROY_LOCK and OMP_DESTROY_NEST_LOCK Routines

1.11.4.3 OMP_SET_LOCK and OMP_SET_NEST_LOCK Routines

1.11.4.4 OMP_UNSET_LOCK and OMP_UNSET_NEST_LOCK Routines

1.11.4.5 OMP_TEST_LOCK and OMP_TEST_NEST_LOCK Routines

1.11.5 Timing Routines

1.11.5.1 OMP_GET_WTIME Routine

1.11.5.2 OMP_GET_WTICK Routine

2. Implementation-Dependent Issues

3. Compiling for OpenMP

3.1 Compiler Options To Use

3.2 Fortran 95 OpenMP Validation

3.3 OpenMP Environment Variables

3.4 Stacks and Stack Sizes

4. Converting to OpenMP

4.1 Converting Legacy Fortran Directives

4.1.1 Converting Sun-Style Fortran Directives

4.1.1.1 Issues Between Sun-Style Fortran Directives and OpenMP

4.1.2 Converting Cray-Style Fortran Directives

4.1.2.1 Issues Between Cray-Style Fortran Directives and OpenMP Directives

4.2 Converting Legacy C Pragmas

4.2.1 Issues Between Legacy C Pragmas and OpenMP