![]() |
![]() |
|
|
![]() |
![]() |
HP C/HP-UX Release Notes for HP-UX 11i/11x: HP 9000 Computers > Chapter 1 New and Changed Features ![]() OpenMP pragmas and options |
|
A set of OpenMP pragmas have been added to this version of the HP C compiler for HP-UX. OpenMP is an industry-standard parallel programming model which implements a fork-join model of parallel execution. The HP C OpenMP pragmas included in this release are based upon the OpenMP Standard for C, version 1.0. To view details about the standard and details about usage, syntax and values, please go to htpp://www.openmp.org/specs. You can download either a postscript (ps) or Adobe Acrobat (PDF) version of the C/C++ Version 1.0 OpenMP standard from this website The OpenMP driver option +Oopenmp is added to this release of the HP C compiler. When used with the +Oparallel option, +Oopenmp prompts the compiler to recognize the OpenMP pragmas and pragmas implemented with this release of the compiler.
When the +Oopenmp is used, most of the HP Programming Model (HPPM)pragmas are not accepted.The following HPPM pragmas, howevr, are accepted by the HP C compiler when +Oopenmp is issued.
Every C program that contains OpenMP pragmas and is to be compiled for the current version of HP-UX must include the header file <omp.h> . If it does not, the OpenMP pragmas will be ignored. The default path for <omp.h> is /opt/ansic/include . A set of OpenMP pragmas for HP C are introduced in this release of the compiler. These include work sharing pragmas and synchronization pragmas. The following are the OpenMP work-sharing pragmas to be implemented for HP C.
The following are the OpenMP synchronization pragmas to be implemented for HP C.
Each of the pragmas to be implemented are discussed in brief below .Only mapping of pragmas is covered here and not the complete functionality of a pragma. The OMP_PARALLEL pragma defines a parallel region, which is a region of the program that is executed by multiple threads in parallel.This is the fundamental construct that starts parallel execution. Syntax#pragma OMP PARALLEL [clause1, clause2...] new-line structured block where [clause1, clause2...] indicates that the clauses are optional. There can be zero (0) or more clauses, where clause may be one of the following:
The following clauses are not currently supported in this initial release of the OMP PARALLEL pragma for HP C.
The OMP FOR pragma for HP C identifies a construct that specifies a region in which the iterations of the associated loop should be executed in parallel. The iterations of the loop are distributed across threads that already exist. This initial release of OMP FOR in the HP C compiler only supports static scheduling. In the case of multiple schedule clauses, the first clause is considered and the rest are silently ignored. Syntax
#pragma OMP FOR
[clause1,clause2...] newline where [clause1, clause2...] indicates that the clauses are optional. There can be zero (0) or more clauses, where clause may be one of the following:
The following clauses are not currently supported in this initial release of the OMP FOR pragma for HP C.
The OMP SECTION/SECTIONS pragmas identify a construct that specifies a set of constructs to be divided among threads in a team. Each section is executed once by a thread in the team. Syntax
#pragma OMP SECTIONS
[clause1, clause2...]new-line where [clause1, clause2...] indicates that the clauses are optional. There can be zero (0) or more clauses, where clause may be one of the following:
The following clauses are not currently supported in this initial release of the OMP SECTION/SECTIONS pragmas for HP C.
The OMP PARALLEL FOR pragma for HP C is a shortcut for an OMP PARALLEL region that contains a single OMP FOR pragma. Syntax
#pragma OMP PARALLEL FOR
clause1,clause2... new-line OMP PARALLEL FOR admits all the allowable clauses of the OMP PARALLEL pragma and the OMP FOR pragma. The PRIVATE clause is supported. The OMP PARALLEL SECTIONS pragma for HP C is a shortcut for specifying a parallel region containing a single OMP SECTIONS pragma. Syntax
#pragma OMP PARALLEL SECTIONS
[clause1, clause2...]new-line OMP PARALLEL SECTIONS admits all the allowable clauses of the OMP PARALLEL pragma and the OMP SECTIONS pragma. The PRIVATE clause is supported. The OMP PARALLEL CRITICAL pragma identifies a construct that restricts the execution of the associated structured block to one thread at a time. Syntax
#pragma OMP CRITICAL
[(name)] new-line The critical section name parameter is optional. All unnamed critical sections globally map to a single name; this is provided by the HP C compiler. The OMP_BARRIER pragma synchronizes all the threads in a team. When encountered , each thread waits until all the threads in the team have reached that point. Syntax#pragma OMP BARRIER new-line The smallest statement to contain a barrier must be a block or a compound statement. OMP BARRIER is valid only inside a parallel region and outside the scope of a OMP FOR, OMP SECTION/SECTIONS, OMP CRITICAL, OMP ORDERED, and OMP MASTER. The OMP ORDERED pragma indicates that the following structured block should be executed in the same order in which iterations would be executed in a sequential loop. Syntax
#pragma OMP ORDERED
new-line The OMP ORDERED pragmas must be called within theOMP FOR and/or OMP PARALLEL FOR loops. |
![]() |
||
![]() |
![]() |
![]() |
|||||||||||||
|